patch.olc
Rom24olc201/patch.olc · 155.0 KB
From the archive olc201english.zip
Download the archive « Back to the archive contents
diff -ur src/Makefile new/Makefile
--- src/Makefile Sat May 23 21:23:45 1998
+++ new/Makefile Thu Mar 16 00:23:35 2000
@@ -1,14 +1,16 @@
CC = gcc
-PROF = -O -g
+PROF = -O -ggdb
NOCRYPT =
-C_FLAGS = -Wall $(PROF) $(NOCRYPT)
-L_FLAGS = $(PROF)
+C_FLAGS = -Wall $(PROF) $(NOCRYPT) -DFIRST_BOOT
+L_FLAGS = $(PROF) -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
+ update.o mob_cmds.o mob_prog.o olc.o olc_act.o olc_save.o bit.o \
+ mem.o string.o pedit.o hedit.o cmdedit.o raedit.o skedit.o \
+ sedit.o gedit.o tablesave.o screen.o
rom: $(O_FILES)
rm -f rom
@@ -16,3 +18,6 @@
.c.o: merc.h
$(CC) -c $(C_FLAGS) $<
+
+clean:
+ rm *.o
diff -ur src/Makefile.linux new/Makefile.linux
--- src/Makefile.linux Mon May 25 07:24:59 1998
+++ new/Makefile.linux Wed Mar 15 22:57:16 2000
@@ -1,7 +1,7 @@
CC = gcc
PROF = -O -g
NOCRYPT =
-C_FLAGS = -Wall $(PROF) $(NOCRYPT)
+C_FLAGS = -Wall $(PROF) $(NOCRYPT) -DFIRST_BOOT
L_FLAGS = $(PROF)
LIBS = -lcrypt
@@ -9,7 +9,9 @@
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
+ update.o mob_cmds.o mob_prog.o olc.o olc_act.o olc_save.o bit.o \
+ mem.o string.o pedit.o hedit.o cmdedit.o raedit.o skedit.o \
+ sedit.o gedit.o tablesave.o screen.o
rom: $(O_FILES)
rm -f rom
diff -ur src/Makefile.normal new/Makefile.normal
--- src/Makefile.normal Tue Apr 14 02:52:21 1998
+++ new/Makefile.normal Wed Mar 15 22:57:16 2000
@@ -1,14 +1,16 @@
CC = gcc
PROF = -O -g
NOCRYPT =
-C_FLAGS = -Wall $(PROF) $(NOCRYPT)
+C_FLAGS = -Wall $(PROF) $(NOCRYPT) -DFIRST_BOOT
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
+ update.o mob_cmds.o mob_prog.o olc.o olc_act.o olc_save.o bit.o \
+ mem.o string.o pedit.o hedit.o cmdedit.o raedit.o skedit.o \
+ sedit.o gedit.o tablesave.o screen.o
rom: $(O_FILES)
rm -f rom
diff -ur src/Makefile.solaris new/Makefile.solaris
--- src/Makefile.solaris Tue Apr 14 03:36:40 1998
+++ new/Makefile.solaris Wed Mar 15 22:57:16 2000
@@ -1,7 +1,7 @@
CC = gcc
PROF = -O -g
NOCRYPT =
-C_FLAGS = -Wall $(PROF) $(NOCRYPT)
+C_FLAGS = -Wall $(PROF) $(NOCRYPT) -DFIRST_BOOT
L_FLAGS = $(PROF)
LIBS = -lsocket -lresolv -lnsl
@@ -9,7 +9,9 @@
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
+ update.o mob_cmds.o mob_prog.o olc.o olc_act.o olc_save.o bit.o \
+ mem.o string.o pedit.o hedit.o cmdedit.o raedit.o skedit.o \
+ sedit.o gedit.o tablesave.o screen.o
rom: $(O_FILES)
rm -f rom
diff -ur src/act_comm.c new/act_comm.c
--- src/act_comm.c Wed May 27 23:23:48 1998
+++ new/act_comm.c Wed Mar 15 22:57:16 2000
@@ -39,6 +39,8 @@
#include "interp.h"
#include "recycle.h"
#include "tables.h"
+#include "vt.h"
+#include "screen.h"
/* RT code to delete yourself */
@@ -753,6 +755,18 @@
act( "$n says '$T'", ch, NULL, argument, TO_ROOM );
act( "You say '$T'", ch, NULL, argument, TO_CHAR );
+
+ if ( !IS_NPC(ch) )
+ {
+ CHAR_DATA *mob, *mob_next;
+ for ( mob = ch->in_room->people; mob != NULL; mob = mob_next )
+ {
+ mob_next = mob->next_in_room;
+ if ( IS_NPC(mob) && HAS_TRIGGER( mob, TRIG_SPEECH )
+ && mob->position == mob->pIndexData->default_pos )
+ mp_act_trigger( argument, mob, ch, NULL, NULL, TRIG_SPEECH );
+ }
+ }
return;
}
@@ -893,6 +907,9 @@
act_new("$n tells you '$t'",ch,argument,victim,TO_VICT,POS_DEAD);
victim->reply = ch;
+ if ( !IS_NPC(ch) && IS_NPC(victim) && HAS_TRIGGER(victim,TRIG_SPEECH) )
+ mp_act_trigger( argument, victim, ch, NULL, NULL, TRIG_SPEECH );
+
return;
}
@@ -1018,8 +1035,10 @@
return;
}
+ MOBtrigger = FALSE;
act( "$n $T", ch, NULL, argument, TO_ROOM );
act( "$n $T", ch, NULL, argument, TO_CHAR );
+ MOBtrigger = TRUE;
return;
}
@@ -1052,7 +1071,9 @@
if ((letter = strstr(argument,vch->name)) == NULL)
{
+ MOBtrigger = FALSE;
act("$N $t",vch,argument,ch,TO_CHAR);
+ MOBtrigger = TRUE;
continue;
}
@@ -1102,7 +1123,9 @@
name = vch->name;
}
+ MOBtrigger = FALSE;
act("$N $t",vch,temp,ch,TO_CHAR);
+ MOBtrigger = TRUE;
}
return;
@@ -1619,7 +1642,7 @@
argument = one_argument( argument, arg );
one_argument(argument,arg2);
- if (!str_cmp(arg2,"delete"))
+ if (!str_cmp(arg2,"delete") || !str_cmp(arg2,"mob"))
{
send_to_char("That will NOT be done.\n\r",ch);
return;
@@ -1947,3 +1970,26 @@
if ( bch->leader != NULL ) bch = bch->leader;
return ach == bch;
}
+
+void do_clear(CHAR_DATA *ch, char *argument)
+{
+ if ( !str_cmp( argument, "reset" ) )
+// send_to_char(VT_SETWIN_CLEAR VT_HOMECLR, ch);
+ send_to_char(VT_CLENSEQ, ch);
+ else
+ send_to_char(VT_CLEAR_SCREEN, ch);
+
+ if (ch->desc && ch->desc->screenmap)
+ InitScreenMap(ch->desc);
+
+ return;
+}
+
+void do_olcx(CHAR_DATA *ch, char *argument)
+{
+ TOGGLE_BIT(ch->comm, COMM_OLCX);
+ if (IS_SET(ch->comm, COMM_OLCX))
+ send_to_char("Activated extensions VT100/OLC.\n\r", ch );
+ else
+ send_to_char("Dectivated extensions VT100/OLC\n\r", ch );
+}
diff -ur src/act_enter.c new/act_enter.c
--- src/act_enter.c Thu May 28 00:37:33 1998
+++ new/act_enter.c Wed Mar 15 22:57:16 2000
@@ -206,6 +206,16 @@
}
extract_obj(portal);
}
+
+ /*
+ * If someone is following the char, these triggers get activated
+ * for the followers before the char, but it's safer this way...
+ */
+ if ( IS_NPC( ch ) && HAS_TRIGGER( ch, TRIG_ENTRY ) )
+ mp_percent_trigger( ch, NULL, NULL, NULL, TRIG_ENTRY );
+ if ( !IS_NPC( ch ) )
+ mp_greet_trigger( ch );
+
return;
}
diff -ur src/act_info.c new/act_info.c
--- src/act_info.c Thu May 28 00:37:17 1998
+++ new/act_info.c Wed Mar 15 22:57:16 2000
@@ -591,7 +591,7 @@
col = 0;
- for (iSocial = 0; social_table[iSocial].name[0] != '\0'; iSocial++)
+ for (iSocial = 0; !IS_NULLSTR(social_table[iSocial].name); iSocial++)
{
sprintf(buf,"%-12s",social_table[iSocial].name);
send_to_char(buf,ch);
@@ -1027,7 +1027,8 @@
/* '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)))
+ if ( (IS_IMMORTAL(ch) && (IS_NPC(ch) || IS_SET(ch->act,PLR_HOLYLIGHT)))
+ || IS_BUILDER(ch, ch->in_room->area) )
{
sprintf(buf," [Room %d]",ch->in_room->vnum);
send_to_char(buf,ch);
@@ -1861,8 +1862,12 @@
/* a little formatting */
sprintf(buf, "[%2d %6s %s] %s%s%s%s%s%s%s%s\n\r",
wch->level,
+#if defined(FIRST_BOOT)
wch->race < MAX_PC_RACE ? pc_race_table[wch->race].who_name
: " ",
+#else
+ race_table[wch->race].who_name,
+#endif
class,
wch->incog_level >= LEVEL_HERO ? "(Incog) ": "",
wch->invis_level >= LEVEL_HERO ? "(Wizi) " : "",
@@ -2058,8 +2063,12 @@
*/
sprintf( buf, "[%2d %6s %s] %s%s%s%s%s%s%s%s\n\r",
wch->level,
+#if defined(FIRST_BOOT)
wch->race < MAX_PC_RACE ? pc_race_table[wch->race].who_name
: " ",
+#else
+ race_table[wch->race].who_name,
+#endif
class,
wch->incog_level >= LEVEL_HERO ? "(Incog) " : "",
wch->invis_level >= LEVEL_HERO ? "(Wizi) " : "",
diff -ur src/act_move.c new/act_move.c
--- src/act_move.c Thu May 28 00:40:32 1998
+++ new/act_move.c Wed Mar 15 22:57:16 2000
@@ -76,6 +76,12 @@
return;
}
+ /*
+ * Exit trigger, if activated, bail out. Only PCs are triggered.
+ */
+ if ( !IS_NPC(ch) && mp_exit_trigger( ch, door ) )
+ return;
+
in_room = ch->in_room;
if ( ( pexit = in_room->exit[door] ) == NULL
|| ( to_room = pexit->u1.to_room ) == NULL
@@ -231,6 +237,15 @@
}
}
+ /*
+ * If someone is following the char, these triggers get activated
+ * for the followers before the char, but it's safer this way...
+ */
+ if ( IS_NPC( ch ) && HAS_TRIGGER( ch, TRIG_ENTRY ) )
+ mp_percent_trigger( ch, NULL, NULL, NULL, TRIG_ENTRY );
+ if ( !IS_NPC( ch ) )
+ mp_greet_trigger( ch );
+
return;
}
diff -ur src/act_obj.c new/act_obj.c
--- src/act_obj.c Thu May 28 00:11:12 1998
+++ new/act_obj.c Wed Mar 15 22:57:16 2000
@@ -720,6 +720,12 @@
sprintf(buf,"You give $N %d %s.",amount, silver ? "silver" : "gold");
act( buf, ch, NULL, victim, TO_CHAR );
+ /*
+ * Bribe trigger
+ */
+ if ( IS_NPC(victim) && HAS_TRIGGER( victim, TRIG_BRIBE ) )
+ mp_bribe_trigger( victim, ch, silver ? amount : amount * 100 );
+
if (IS_NPC(victim) && IS_SET(victim->act,ACT_IS_CHANGER))
{
int change;
@@ -815,9 +821,18 @@
obj_from_char( obj );
obj_to_char( obj, victim );
+ MOBtrigger = FALSE;
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 );
+ MOBtrigger = TRUE;
+
+ /*
+ * Give trigger
+ */
+ if ( IS_NPC(victim) && HAS_TRIGGER( victim, TRIG_GIVE ) )
+ mp_give_trigger( victim, ch, obj );
+
return;
}
diff -ur src/act_wiz.c new/act_wiz.c
--- src/act_wiz.c Thu May 28 20:14:17 1998
+++ new/act_wiz.c Wed Mar 15 22:57:16 2000
@@ -1692,6 +1692,12 @@
victim->pet ? victim->pet->name : "(none)");
send_to_char( buf, ch );
+ if (!IS_NPC(victim))
+ {
+ sprintf( buf, "Security: %d.\n\r", victim->pcdata->security ); /* OLC */
+ send_to_char( buf, ch ); /* OLC */
+ }
+
sprintf( buf, "Short description: %s\n\rLong description: %s",
victim->short_descr,
victim->long_descr[0] != '\0' ? victim->long_descr : "(none)\n\r" );
@@ -3343,6 +3349,7 @@
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 );
+ send_to_char( " security\n\r", ch );
return;
}
@@ -3378,6 +3385,38 @@
return;
}
+ if ( !str_cmp( arg2, "security" ) ) /* OLC */
+ {
+ if ( IS_NPC(ch) )
+ {
+ send_to_char( "if, clear.\n\r", ch );
+ return;
+ }
+
+ if ( IS_NPC( victim ) )
+ {
+ send_to_char( "Not on NPC's.\n\r", ch );
+ return;
+ }
+
+ if ( value > ch->pcdata->security || value < 0 )
+ {
+ if ( ch->pcdata->security != 0 )
+ {
+ sprintf( buf, "Valid security is 0-%d.\n\r",
+ ch->pcdata->security );
+ send_to_char( buf, ch );
+ }
+ else
+ {
+ send_to_char( "Valid security is 0 only.\n\r", ch );
+ }
+ return;
+ }
+ victim->pcdata->security = value;
+ return;
+ }
+
if ( !str_cmp( arg2, "int" ) )
{
if ( value < 3 || value > get_max_train(victim,STAT_INT) )
@@ -4103,7 +4142,7 @@
one_argument(argument,arg2);
- if (!str_cmp(arg2,"delete"))
+ if (!str_cmp(arg2,"delete") || !str_prefix(arg2,"mob"))
{
send_to_char("That will NOT be done.\n\r",ch);
return;
diff -ur src/alias.c new/alias.c
--- src/alias.c Mon May 25 06:04:43 1998
+++ new/alias.c Wed Mar 15 22:57:16 2000
@@ -49,7 +49,7 @@
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);
+ send_to_char("Line too long, prefix not processed.\r\n",ch);
else
{
sprintf(prefix,"%s %s",ch->prefix,argument);
@@ -61,7 +61,8 @@
|| !str_prefix("alias",argument) || !str_prefix("una",argument)
|| !str_prefix("prefix",argument))
{
- interpret(d->character,argument);
+ if (!run_olc_editor(d,argument))
+ interpret(d->character,argument);
return;
}
@@ -92,7 +93,8 @@
}
}
}
- interpret(d->character,buf);
+ if (!run_olc_editor(d, buf))
+ interpret(d->character,buf);
}
void do_alia(CHAR_DATA *ch, char *argument)
diff -ur src/comm.c new/comm.c
--- src/comm.c Thu May 28 00:25:22 1998
+++ new/comm.c Wed Mar 15 22:57:16 2000
@@ -56,11 +56,15 @@
#include <string.h>
#include <stdlib.h>
#include <time.h>
+#include <unistd.h> /* OLC -- for close read write etc */
+#include <stdarg.h> /* printf_to_char */
#include "merc.h"
+#include "olc.h"
#include "interp.h"
#include "recycle.h"
#include "tables.h"
+#include "screen.h"
/*
* Malloc debugging stuff.
@@ -173,11 +177,11 @@
int close args( ( int fd ) );
int gettimeofday args( ( struct timeval *tp, struct timezone *tzp ) );
-int read args( ( int fd, char *buf, int nbyte ) );
+/* 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 ) );
+/* int write args( ( int fd, char *buf, int nbyte ) ); */ /* read,write in unistd.h */
#endif
#if defined(macintosh)
@@ -305,7 +309,7 @@
bool newlock; /* Game is newlocked */
char str_boot_time[MAX_INPUT_LENGTH];
time_t current_time; /* time of this pulse */
-
+bool MOBtrigger = TRUE; /* act() switch */
/*
@@ -516,6 +520,9 @@
dcon.next = descriptor_list;
dcon.showstr_head = NULL;
dcon.showstr_point = NULL;
+ dcon.pEdit = NULL; /* OLC */
+ dcon.pString = NULL; /* OLC */
+ dcon.editor = 0; /* OLC */
descriptor_list = &dcon;
/*
@@ -573,10 +580,22 @@
d->fcommand = TRUE;
stop_idling( d->character );
- if ( d->connected == CON_PLAYING )
- substitute_alias( d, d->incomm );
- else
- nanny( d, d->incomm );
+ /* OLC */
+ if ( d->showstr_point )
+ show_string( d, d->incomm );
+ else
+ if ( d->pString )
+ string_add( d->character, d->incomm );
+ else
+ switch ( d->connected )
+ {
+ case CON_PLAYING:
+ substitute_alias( d, d->incomm );
+ break;
+ default:
+ nanny( d, d->incomm );
+ break;
+ }
d->incomm[0] = '\0';
}
@@ -762,12 +781,22 @@
d->fcommand = TRUE;
stop_idling( d->character );
- if (d->showstr_point)
- show_string(d,d->incomm);
- else if ( d->connected == CON_PLAYING )
+ /* OLC */
+ if ( d->showstr_point )
+ show_string( d, d->incomm );
+ else
+ if ( d->pString )
+ string_add( d->character, d->incomm );
+ else
+ switch ( d->connected )
+ {
+ case CON_PLAYING:
substitute_alias( d, d->incomm );
- else
+ break;
+ default:
nanny( d, d->incomm );
+ break;
+ }
d->incomm[0] = '\0';
}
@@ -892,6 +921,9 @@
dnew->showstr_head = NULL;
dnew->showstr_point = NULL;
dnew->outsize = 2000;
+ dnew->pEdit = NULL; /* OLC */
+ dnew->pString = NULL; /* OLC */
+ dnew->editor = 0; /* OLC */
dnew->outbuf = alloc_mem( dnew->outsize );
size = sizeof(sock);
@@ -1221,11 +1253,14 @@
/*
* 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;
+ if ( !merc_down )
+ if ( d->showstr_point )
+ write_to_buffer( d, "[Hit Return to continue]\n\r", 0 );
+ else if ( fPrompt && d->pString && d->connected == CON_PLAYING )
+ write_to_buffer( d, "> ", 2 );
+ else if ( fPrompt && d->connected == CON_PLAYING )
+ {
+ CHAR_DATA *ch;
CHAR_DATA *victim;
ch = d->character;
@@ -1270,12 +1305,16 @@
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);
+
+ if (IS_SET(ch->comm,COMM_OLCX)
+ && d->editor != ED_NONE
+ && d->pString == NULL)
+ UpdateOLCScreen(d);
}
/*
@@ -1440,6 +1479,12 @@
case '%' :
sprintf( buf2, "%%" );
i = buf2; break;
+ case 'o' :
+ sprintf( buf2, "%s", olc_ed_name(ch) );
+ i = buf2; break;
+ case 'O' :
+ sprintf( buf2, "%s", olc_ed_vnum(ch) );
+ i = buf2; break;
}
++str;
while( (*point = *i) != '\0' )
@@ -1843,7 +1888,11 @@
ch->race = race;
/* initialize stats */
for (i = 0; i < MAX_STATS; i++)
+#if defined(FIRST_BOOT)
ch->perm_stat[i] = pc_race_table[race].stats[i];
+#else
+ ch->perm_stat[i] = race_table[race].stats[i];
+#endif
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;
@@ -1854,6 +1903,7 @@
/* add skills */
for (i = 0; i < 5; i++)
{
+#if defined(FIRST_BOOT)
if (pc_race_table[race].skills[i] == NULL)
break;
group_add(ch,pc_race_table[race].skills[i],FALSE);
@@ -1861,6 +1911,15 @@
/* add cost */
ch->pcdata->points = pc_race_table[race].points;
ch->size = pc_race_table[race].size;
+#else
+ if (race_table[race].skills[i] == NULL)
+ break;
+ group_add(ch,race_table[race].skills[i],FALSE);
+ }
+ /* add cost */
+ ch->pcdata->points = race_table[race].points;
+ ch->size = race_table[race].size;
+#endif
write_to_buffer( d, "What is your sex (M/F)? ", 0 );
d->connected = CON_GET_NEW_SEX;
@@ -2005,17 +2064,29 @@
if (!str_cmp(argument,"done"))
{
+#if defined(FIRST_BOOT)
if (ch->pcdata->points == pc_race_table[ch->race].points)
+#else
+ if (ch->pcdata->points == race_table[ch->race].points)
+#endif
{
send_to_char("You didn't pick anything.\n\r",ch);
break;
}
+#if defined(FIRST_BOOT)
if (ch->pcdata->points <= 40 + pc_race_table[ch->race].points)
+#else
+ if (ch->pcdata->points <= 40 + race_table[ch->race].points)
+#endif
{
sprintf(buf,
"You must take at least %d points of skills and groups",
+#if defined(FIRST_BOOT)
40 + pc_race_table[ch->race].points);
+#else
+ 40 + race_table[ch->race].points);
+#endif
send_to_char(buf, ch);
break;
}
@@ -2146,7 +2217,7 @@
* Reserved words.
*/
if (is_exact_name(name,
- "all auto immortal self someone something the you loner"))
+ "all auto immortal self someone something the you loner none"))
{
return FALSE;
}
@@ -2472,7 +2543,9 @@
for ( ; to != NULL; to = to->next_in_room )
{
- if ( to->desc == NULL || to->position < min_pos )
+ if ( (!IS_NPC(to) && to->desc == NULL )
+ || ( IS_NPC(to) && !HAS_TRIGGER(to, TRIG_ACT) )
+ || to->position < min_pos )
continue;
if ( (type == TO_CHAR) && to != ch )
@@ -2551,10 +2624,14 @@
*point++ = '\n';
*point++ = '\r';
+ *point = '\0';
buf[0] = UPPER(buf[0]);
+ if ( to->desc != NULL )
write_to_buffer( to->desc, buf, point - buf );
+ else
+ if ( MOBtrigger )
+ mp_act_trigger( buf, to, ch, arg1, arg2, TRIG_ACT );
}
-
return;
}
@@ -2570,3 +2647,38 @@
tp->tv_usec = 0;
}
#endif
+
+/* source: EOD, by John Booth <???> */
+
+void printf_to_char (CHAR_DATA *ch, char *fmt, ...)
+{
+ char buf [MAX_STRING_LENGTH];
+ va_list args;
+ va_start (args, fmt);
+ vsprintf (buf, fmt, args);
+ va_end (args);
+
+ send_to_char (buf, ch);
+}
+
+void bugf (char * fmt, ...)
+{
+ char buf [2*MSL];
+ va_list args;
+ va_start (args, fmt);
+ vsprintf (buf, fmt, args);
+ va_end (args);
+
+ bug (buf, 0);
+}
+
+void flog (char * fmt, ...)
+{
+ char buf [2*MSL];
+ va_list args;
+ va_start (args, fmt);
+ vsprintf (buf, fmt, args);
+ va_end (args);
+
+ log_string (buf);
+}
diff -ur src/const.c new/const.c
--- src/const.c Sat May 23 22:27:14 1998
+++ new/const.c Wed Mar 15 22:57:16 2000
@@ -161,6 +161,7 @@
{ NULL, NULL, 0 }
};
+#if defined(FIRST_BOOT)
/* race table */
const struct race_type race_table [] =
{
@@ -424,7 +425,7 @@
{ 16, 11, 13, 11, 14 }, { 22, 15, 18, 15, 20 }, SIZE_LARGE
}
};
-
+#endif
@@ -991,6 +992,7 @@
*/
#define SLOT(n) n
+#if defined(FIRST_BOOT)
const struct skill_type skill_table [MAX_SKILL] =
{
@@ -2123,3 +2125,4 @@
};
+#endif
diff -ur src/db.c new/db.c
--- src/db.c Fri May 29 22:22:58 1998
+++ new/db.c Wed Mar 15 22:57:16 2000
@@ -42,8 +42,12 @@
#include "db.h"
#include "recycle.h"
#include "music.h"
+#include "tables.h"
#include "lookup.h"
+#include "olc.h"
+COMMAND(do_asave)
+MPROG_CODE * pedir_prog(int);
#if !defined(macintosh)
extern int _filbuf args( (FILE *) );
@@ -72,11 +76,15 @@
HELP_DATA * help_first;
HELP_DATA * help_last;
+HELP_AREA * had_list;
+
SHOP_DATA * shop_first;
SHOP_DATA * shop_last;
NOTE_DATA * note_free;
+MPROG_CODE * mprog_list;
+
char bug_buf [2*MAX_INPUT_LENGTH];
CHAR_DATA * char_list;
char * help_greeting;
@@ -154,6 +162,7 @@
AREA_DATA * area_first;
AREA_DATA * area_last;
+AREA_DATA * current_area;
char * string_space;
char * top_string;
@@ -169,6 +178,10 @@
int top_reset;
int top_room;
int top_shop;
+int top_vnum_room; /* OLC */
+int top_vnum_mob; /* OLC */
+int top_vnum_obj; /* OLC */
+int top_mprog_index; /* OLC */
int mobile_count = 0;
int newmobs = 0;
int newobjs = 0;
@@ -210,7 +223,8 @@
*/
void init_mm args( ( void ) );
void load_area args( ( FILE *fp ) );
-void load_helps args( ( FILE *fp ) );
+void new_load_area args( ( FILE *fp ) ); /* OLC */
+void load_helps args( ( FILE *fp, char *fname ) );
void load_old_mob args( ( FILE *fp ) );
void load_mobiles args( ( FILE *fp ) );
void load_old_obj args( ( FILE *fp ) );
@@ -222,8 +236,11 @@
void load_specials args( ( FILE *fp ) );
void load_notes args( ( void ) );
void load_bans args( ( void ) );
+void load_mobprogs args( ( FILE *fp ) );
+void load_groups ( void );
void fix_exits args( ( void ) );
+void fix_mobprogs args( ( void ) );
void reset_area args( ( AREA_DATA * pArea ) );
@@ -253,6 +270,14 @@
init_mm( );
}
+#if !defined(FIRST_BOOT)
+ cargar_skills();
+ cargar_razas();
+ cargar_comandos();
+ cargar_socials();
+ load_groups();
+#endif
+
/*
* Set time and weather.
*/
@@ -332,6 +357,8 @@
}
}
+ current_area = NULL;
+
for ( ; ; )
{
char *word;
@@ -346,9 +373,11 @@
if ( word[0] == '$' ) break;
else if ( !str_cmp( word, "AREA" ) ) load_area (fpArea);
- else if ( !str_cmp( word, "HELPS" ) ) load_helps (fpArea);
+ /* OLC */ else if ( !str_cmp( word, "AREADATA" ) ) new_load_area(fpArea);
+ else if ( !str_cmp( word, "HELPS" ) ) load_helps (fpArea, strArea);
else if ( !str_cmp( word, "MOBOLD" ) ) load_old_mob (fpArea);
else if ( !str_cmp( word, "MOBILES" ) ) load_mobiles (fpArea);
+ else if ( !str_cmp( word, "MOBPROGS" ) ) load_mobprogs(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);
@@ -378,13 +407,26 @@
*/
{
fix_exits( );
+ fix_mobprogs( );
fBootDb = FALSE;
+ convert_objects( ); /* ROM OLC */
area_update( );
load_notes( );
load_bans();
load_songs();
}
+#if defined(FIRST_BOOT)
+ grabar_skills();
+ grabar_razas();
+ grabar_tabla_comandos();
+ grabar_socials();
+ save_groups();
+ do_asave(NULL,"");
+ flog("Now recompile without -DFIRST_BOOT.");
+ exit(0);
+#endif
+
return;
}
@@ -398,9 +440,13 @@
AREA_DATA *pArea;
pArea = alloc_perm( sizeof(*pArea) );
- pArea->reset_first = NULL;
- pArea->reset_last = NULL;
pArea->file_name = fread_string(fp);
+
+ pArea->area_flags = AREA_LOADING; /* OLC */
+ pArea->security = 9; /* OLC */ /* 9 -- Hugin */
+ pArea->builders = str_dup( "None" ); /* OLC */
+ pArea->vnum = top_area; /* OLC */
+
pArea->name = fread_string( fp );
pArea->credits = fread_string( fp );
pArea->min_vnum = fread_number(fp);
@@ -409,33 +455,185 @@
pArea->nplayer = 0;
pArea->empty = FALSE;
- if ( area_first == NULL )
+ if ( !area_first )
area_first = pArea;
- if ( area_last != NULL )
+ if ( area_last )
+ {
area_last->next = pArea;
- area_last = pArea;
- pArea->next = NULL;
+ REMOVE_BIT(area_last->area_flags, AREA_LOADING); /* OLC */
+ }
+ area_last = pArea;
+ pArea->next = NULL;
+ current_area = pArea;
top_area++;
return;
}
+/*
+ * OLC
+ * Use these macros to load any new area formats that you choose to
+ * support on your MUD. See the new_load_area format below for
+ * a short example.
+ */
+#if defined(KEY)
+#undef KEY
+#endif
+
+#define KEY( literal, field, value ) \
+ if ( !str_cmp( word, literal ) ) \
+ { \
+ field = value; \
+ fMatch = TRUE; \
+ break; \
+ }
+
+#define SKEY( string, field ) \
+ if ( !str_cmp( word, string ) ) \
+ { \
+ free_string( field ); \
+ field = fread_string( fp ); \
+ fMatch = TRUE; \
+ break; \
+ }
+
+
+
+/* OLC
+ * Snarf an 'area' header line. Check this format. MUCH better. Add fields
+ * too.
+ *
+ * #AREAFILE
+ * Name { All } Locke Newbie School~
+ * Repop A teacher pops in the room and says, 'Repop coming!'~
+ * Recall 3001
+ * End
+ */
+void new_load_area( FILE *fp )
+{
+ AREA_DATA *pArea;
+ char *word;
+ bool fMatch;
+ pArea = alloc_perm( sizeof(*pArea) );
+ pArea->age = 15;
+ pArea->nplayer = 0;
+ pArea->file_name = str_dup( strArea );
+ pArea->vnum = top_area;
+ pArea->name = str_dup( "New Area" );
+ pArea->builders = str_dup( "" );
+ pArea->security = 9; /* 9 -- Hugin */
+ pArea->min_vnum = 0;
+ pArea->max_vnum = 0;
+ pArea->area_flags = 0;
+/* pArea->recall = ROOM_VNUM_TEMPLE; ROM OLC */
+
+ for ( ; ; )
+ {
+ word = feof( fp ) ? "End" : fread_word( fp );
+ fMatch = FALSE;
+
+ switch ( UPPER(word[0]) )
+ {
+ case 'N':
+ SKEY( "Name", pArea->name );
+ break;
+ case 'S':
+ KEY( "Security", pArea->security, fread_number( fp ) );
+ break;
+ case 'V':
+ if ( !str_cmp( word, "VNUMs" ) )
+ {
+ pArea->min_vnum = fread_number( fp );
+ pArea->max_vnum = fread_number( fp );
+ }
+ break;
+ case 'E':
+ if ( !str_cmp( word, "End" ) )
+ {
+ fMatch = TRUE;
+ if ( area_first == NULL )
+ area_first = pArea;
+ if ( area_last != NULL )
+ area_last->next = pArea;
+ area_last = pArea;
+ pArea->next = NULL;
+ current_area = pArea;
+ top_area++;
+
+ return;
+ }
+ break;
+ case 'B':
+ SKEY( "Builders", pArea->builders );
+ break;
+ case 'C':
+ SKEY( "Credits", pArea->credits );
+ break;
+ }
+ }
+}
+
+/*
+ * Sets vnum range for area using OLC protection features.
+ */
+void assign_area_vnum( int vnum )
+{
+ if ( area_last->min_vnum == 0 || area_last->max_vnum == 0 )
+ area_last->min_vnum = area_last->max_vnum = vnum;
+ if ( vnum != URANGE( area_last->min_vnum, vnum, area_last->max_vnum ) )
+ if ( vnum < area_last->min_vnum )
+ area_last->min_vnum = vnum;
+ else
+ area_last->max_vnum = vnum;
+ return;
+}
/*
* Snarf a help section.
*/
-void load_helps( FILE *fp )
+void load_helps( FILE *fp, char *fname )
{
HELP_DATA *pHelp;
+ int level;
+ char *keyword;
for ( ; ; )
{
- pHelp = alloc_perm( sizeof(*pHelp) );
- pHelp->level = fread_number( fp );
- pHelp->keyword = fread_string( fp );
- if ( pHelp->keyword[0] == '$' )
- break;
+ HELP_AREA * had;
+
+ level = fread_number( fp );
+ keyword = fread_string( fp );
+
+ if ( keyword[0] == '$' )
+ break;
+
+ if ( !had_list )
+ {
+ had = new_had ();
+ had->filename = str_dup( fname );
+ had->area = current_area;
+ if ( current_area )
+ current_area->helps = had;
+ had_list = had;
+ }
+ else
+ if ( str_cmp( fname, had_list->filename ) )
+ {
+ had = new_had ();
+ had->filename = str_dup( fname );
+ had->area = current_area;
+ if ( current_area )
+ current_area->helps = had;
+ had->next = had_list;
+ had_list = had;
+ }
+ else
+ had = had_list;
+
+ pHelp = new_help( );
+ pHelp->level = level;
+ pHelp->keyword = keyword;
pHelp->text = fread_string( fp );
if ( !str_cmp( pHelp->keyword, "greeting" ) )
@@ -446,8 +644,18 @@
if ( help_last != NULL )
help_last->next = pHelp;
- help_last = pHelp;
- pHelp->next = NULL;
+ help_last = pHelp;
+ pHelp->next = NULL;
+
+ if ( !had->first )
+ had->first = pHelp;
+ if ( !had->last )
+ had->last = pHelp;
+
+ had->last->next_area = pHelp;
+ had->last = pHelp;
+ pHelp->next_area = NULL;
+
top_help++;
}
@@ -466,6 +674,12 @@
int race;
char name[MAX_STRING_LENGTH];
+ if ( !area_last ) /* OLC */
+ {
+ bug( "Load_mobiles: no #AREA seen yet.", 0 );
+ exit( 1 );
+ }
+
for ( ; ; )
{
sh_int vnum;
@@ -493,6 +707,7 @@
pMobIndex = alloc_perm( sizeof(*pMobIndex) );
pMobIndex->vnum = vnum;
+ pMobIndex->area = area_last; /* OLC */
pMobIndex->new_format = FALSE;
pMobIndex->player_name = fread_string( fp );
pMobIndex->short_descr = fread_string( fp );
@@ -573,10 +788,14 @@
exit( 1 );
}
+ convert_mobile( pMobIndex ); /* ROM OLC */
+
iHash = vnum % MAX_KEY_HASH;
pMobIndex->next = mob_index_hash[iHash];
mob_index_hash[iHash] = pMobIndex;
top_mob_index++;
+ top_vnum_mob = top_vnum_mob < vnum ? vnum : top_vnum_mob; /* OLC */
+ assign_area_vnum( vnum ); /* OLC */
kill_table[URANGE(0, pMobIndex->level, MAX_LEVEL-1)].number++;
}
@@ -590,6 +809,12 @@
{
OBJ_INDEX_DATA *pObjIndex;
+ if ( !area_last ) /* OLC */
+ {
+ bug( "Load_objects: no #AREA seen yet.", 0 );
+ exit( 1 );
+ }
+
for ( ; ; )
{
sh_int vnum;
@@ -617,6 +842,7 @@
pObjIndex = alloc_perm( sizeof(*pObjIndex) );
pObjIndex->vnum = vnum;
+ pObjIndex->area = area_last; /* OLC */
pObjIndex->new_format = FALSE;
pObjIndex->reset_num = 0;
pObjIndex->name = fread_string( fp );
@@ -724,14 +950,42 @@
pObjIndex->next = obj_index_hash[iHash];
obj_index_hash[iHash] = pObjIndex;
top_obj_index++;
+ top_vnum_obj = top_vnum_obj < vnum ? vnum : top_vnum_obj; /* OLC */
+ assign_area_vnum( vnum ); /* OLC */
}
return;
}
+/*
+ * Adds a reset to a room. OLC
+ * Similar to add_reset in olc.c
+ */
+void new_reset( ROOM_INDEX_DATA *pR, RESET_DATA *pReset )
+{
+ RESET_DATA *pr;
+
+ if ( !pR )
+ return;
+ pr = pR->reset_last;
+
+ if ( !pr )
+ {
+ pR->reset_first = pReset;
+ pR->reset_last = pReset;
+ }
+ else
+ {
+ pR->reset_last->next = pReset;
+ pR->reset_last = pReset;
+ pR->reset_last->next = NULL;
+ }
+/* top_reset++; no estamos asignando memoria!!!! */
+ return;
+}
/*
* Snarf a reset section.
@@ -739,8 +993,11 @@
void load_resets( FILE *fp )
{
RESET_DATA *pReset;
+ EXIT_DATA *pexit;
+ ROOM_INDEX_DATA *pRoomIndex;
+ int rVnum = -1;
- if ( area_last == NULL )
+ if ( !area_last )
{
bug( "Load_resets: no #AREA seen yet.", 0 );
exit( 1 );
@@ -748,10 +1005,7 @@
for ( ; ; )
{
- ROOM_INDEX_DATA *pRoomIndex;
- EXIT_DATA *pexit;
char letter;
- OBJ_INDEX_DATA *temp_index;
if ( ( letter = fread_letter( fp ) ) == 'S' )
break;
@@ -762,7 +1016,7 @@
continue;
}
- pReset = alloc_perm( sizeof(*pReset) );
+ pReset = new_reset_data();
pReset->command = letter;
/* if_flag */ fread_number( fp );
pReset->arg1 = fread_number( fp );
@@ -773,87 +1027,61 @@
? fread_number(fp) : 0;
fread_to_eol( fp );
- /*
- * Validate parameters.
- * We're calling the index functions for the side effect.
- */
- switch ( letter )
+ switch( pReset->command )
{
- 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 );
- }
+ case 'M':
+ case 'O':
+ rVnum = pReset->arg3;
+ break;
- break;
+ case 'P':
+ case 'G':
+ case 'E':
+ break;
- case 'R':
- pRoomIndex = get_room_index( pReset->arg1 );
+ case 'D':
+ pRoomIndex = get_room_index( (rVnum = pReset->arg1) );
+ if ( pReset->arg2 < 0
+ || pReset->arg2 >= MAX_DIR
+ || !pRoomIndex
+ || !( pexit = pRoomIndex->exit[pReset->arg2] )
+ || !IS_SET( pexit->rs_flags, EX_ISDOOR ) )
+ {
+ bugf( "Load_resets: 'D': exit %d, room %d not door.", pReset->arg2, pReset->arg1 );
+ exit( 1 );
+ }
- if ( pReset->arg2 < 0 || pReset->arg2 > 6 )
- {
- bug( "Load_resets: 'R': bad exit %d.", pReset->arg2 );
- exit( 1 );
- }
+ switch ( pReset->arg3 )
+ {
+ default: bug( "Load_resets: 'D': bad 'locks': %d." , pReset->arg3); break;
+ case 0: break;
+ case 1: SET_BIT( pexit->rs_flags, EX_CLOSED );
+ SET_BIT( pexit->exit_info, EX_CLOSED ); break;
+ case 2: SET_BIT( pexit->rs_flags, EX_CLOSED | EX_LOCKED );
+ SET_BIT( pexit->exit_info, EX_CLOSED | EX_LOCKED ); break;
+ }
+ break;
- break;
+ case 'R':
+ rVnum = pReset->arg1;
+ 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++;
+ if ( rVnum == -1 )
+ {
+ bugf( "load_resets : rVnum == -1" );
+ exit(1);
+ }
+
+ if ( pReset->command != 'D' )
+ new_reset( get_room_index(rVnum), pReset );
+ else
+ free_reset_data( pReset );
}
return;
}
-
-
/*
* Snarf a room section.
*/
@@ -956,21 +1184,26 @@
pexit->description = fread_string( fp );
pexit->keyword = fread_string( fp );
pexit->exit_info = 0;
- locks = fread_number( fp );
+ pexit->rs_flags = 0; /* OLC */
+ locks = fread_number(fp);
pexit->key = fread_number( fp );
pexit->u1.vnum = fread_number( fp );
+ pexit->orig_door = door; /* OLC */
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 1: pexit->exit_info = EX_ISDOOR;
+ pexit->rs_flags = EX_ISDOOR; break;
+ case 2: pexit->exit_info = EX_ISDOOR | EX_PICKPROOF;
+ pexit->rs_flags = EX_ISDOOR | EX_PICKPROOF; break;
+ case 3: pexit->exit_info = EX_ISDOOR | EX_NOPASS;
+ pexit->rs_flags = EX_ISDOOR | EX_NOPASS; break;
case 4: pexit->exit_info = EX_ISDOOR|EX_NOPASS|EX_PICKPROOF;
+ pexit->rs_flags = EX_ISDOOR|EX_NOPASS|EX_PICKPROOF;
break;
}
pRoomIndex->exit[door] = pexit;
- pRoomIndex->old_exit[door] = pexit;
top_exit++;
}
else if ( letter == 'E' )
@@ -1007,6 +1240,8 @@
pRoomIndex->next = room_index_hash[iHash];
room_index_hash[iHash] = pRoomIndex;
top_room++;
+ top_vnum_room = top_vnum_room < vnum ? vnum : top_vnum_room; /* OLC */
+ assign_area_vnum( vnum ); /* OLC */
}
return;
@@ -1105,6 +1340,8 @@
ROOM_INDEX_DATA *to_room;
EXIT_DATA *pexit;
EXIT_DATA *pexit_rev;
+ RESET_DATA *pReset;
+ ROOM_INDEX_DATA *iLastRoom, *iLastObj;
int iHash;
int door;
@@ -1116,6 +1353,64 @@
{
bool fexit;
+ iLastRoom = iLastObj = NULL;
+
+ /* OLC : nuevo chequeo de resets */
+ for ( pReset = pRoomIndex->reset_first; pReset; pReset = pReset->next )
+ {
+ switch( pReset->command )
+ {
+ default:
+ bugf( "fix_exits : Room %d with reset cmd %c", pRoomIndex->vnum, pReset->command );
+ exit(1);
+ break;
+
+ case 'M':
+ get_mob_index( pReset->arg1 );
+ iLastRoom = get_room_index( pReset->arg3 );
+ break;
+
+ case 'O':
+ get_obj_index( pReset->arg1 );
+ iLastObj = get_room_index( pReset->arg3 );
+ break;
+
+ case 'P':
+ get_obj_index( pReset->arg1 );
+ if (iLastObj == NULL)
+ {
+ bugf( "fix_exits : reset en cuarto %d con iLastObj NULL", pRoomIndex->vnum );
+ exit(1);
+ }
+ break;
+
+ case 'G':
+ case 'E':
+ get_obj_index( pReset->arg1 );
+ if (iLastRoom == NULL)
+ {
+ bugf( "fix_exits : reset en cuarto %d con iLastRoom NULL", pRoomIndex->vnum );
+ exit(1);
+ }
+ iLastObj = iLastRoom;
+ break;
+
+ case 'D':
+ bugf( "???" );
+ break;
+
+ case 'R':
+ get_room_index( pReset->arg1 );
+ if ( pReset->arg2 < 0 || pReset->arg2 > MAX_DIR )
+ {
+ bugf( "fix_exits : reset en cuarto %d con arg2 %d >= MAX_DIR",
+ pRoomIndex->vnum, pReset->arg2 );
+ exit(1);
+ }
+ break;
+ } /* switch */
+ } /* for */
+
fexit = FALSE;
for ( door = 0; door <= 5; door++ )
{
@@ -1164,6 +1459,87 @@
return;
}
+/*
+ * Load mobprogs section
+ */
+void load_mobprogs( FILE *fp )
+{
+ MPROG_CODE *pMprog;
+
+ if ( area_last == NULL )
+ {
+ bug( "Load_mobprogs: no #AREA seen yet.", 0 );
+ exit( 1 );
+ }
+
+ for ( ; ; )
+ {
+ sh_int vnum;
+ char letter;
+
+ letter = fread_letter( fp );
+ if ( letter != '#' )
+ {
+ bug( "Load_mobprogs: # not found.", 0 );
+ exit( 1 );
+ }
+
+ vnum = fread_number( fp );
+ if ( vnum == 0 )
+ break;
+
+ fBootDb = FALSE;
+ if ( get_mprog_index( vnum ) != NULL )
+ {
+ bug( "Load_mobprogs: vnum %d duplicated.", vnum );
+ exit( 1 );
+ }
+ fBootDb = TRUE;
+
+ pMprog = alloc_perm( sizeof(*pMprog) );
+ pMprog->vnum = vnum;
+ pMprog->code = fread_string( fp );
+ if ( mprog_list == NULL )
+ mprog_list = pMprog;
+ else
+ {
+ pMprog->next = mprog_list;
+ mprog_list = pMprog;
+ }
+ top_mprog_index++;
+ }
+ return;
+}
+
+/*
+ * Translate mobprog vnums pointers to real code
+ */
+void fix_mobprogs( void )
+{
+ MOB_INDEX_DATA *pMobIndex;
+ MPROG_LIST *list;
+ MPROG_CODE *prog;
+ int iHash;
+
+ for ( iHash = 0; iHash < MAX_KEY_HASH; iHash++ )
+ {
+ for ( pMobIndex = mob_index_hash[iHash];
+ pMobIndex != NULL;
+ pMobIndex = pMobIndex->next )
+ {
+ for( list = pMobIndex->mprogs; list != NULL; list = list->next )
+ {
+ if ( ( prog = pedir_prog( list->vnum ) ) != NULL )
+ list->code = prog->code;
+ else
+ {
+ bug( "Fix_mobprogs: code vnum %d not found.", list->vnum );
+ exit( 1 );
+ }
+ }
+ }
+ }
+}
/*
@@ -1205,57 +1581,76 @@
return;
}
-
-
-/*
- * Reset one area.
+/* OLC
+ * Reset one room. Called by reset_area and olc.
*/
-void reset_area( AREA_DATA *pArea )
+void reset_room( ROOM_INDEX_DATA *pRoom )
{
- RESET_DATA *pReset;
- CHAR_DATA *mob;
+ RESET_DATA *pReset;
+ CHAR_DATA *pMob;
+ CHAR_DATA *mob;
+ OBJ_DATA *pObj;
+ CHAR_DATA *LastMob = NULL;
+ OBJ_DATA *LastObj = NULL;
+ int iExit;
+ int level = 0;
bool last;
- int level;
- mob = NULL;
- last = TRUE;
- level = 0;
- for ( pReset = pArea->reset_first; pReset != NULL; pReset = pReset->next )
+ if ( !pRoom )
+ return;
+
+ pMob = NULL;
+ last = FALSE;
+
+ for ( iExit = 0; iExit < MAX_DIR; iExit++ )
{
- 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;
+ EXIT_DATA *pExit;
+ if ( ( pExit = pRoom->exit[iExit] )
+ /* && !IS_SET( pExit->exit_info, EX_BASHED ) ROM OLC */ )
+ {
+ pExit->exit_info = pExit->rs_flags;
+ if ( ( pExit->u1.to_room != NULL )
+ && ( ( pExit = pExit->u1.to_room->exit[rev_dir[iExit]] ) ) )
+ {
+ /* nail the other side */
+ pExit->exit_info = pExit->rs_flags;
+ }
+ }
+ }
- switch ( pReset->command )
- {
- default:
- bug( "Reset_area: bad command %c.", pReset->command );
- break;
+ for ( pReset = pRoom->reset_first; pReset != NULL; pReset = pReset->next )
+ {
+ MOB_INDEX_DATA *pMobIndex;
+ OBJ_INDEX_DATA *pObjIndex;
+ OBJ_INDEX_DATA *pObjToIndex;
+ ROOM_INDEX_DATA *pRoomIndex;
+ char buf[MAX_STRING_LENGTH];
+ int count,limit=0;
- case 'M':
- if ( ( pMobIndex = get_mob_index( pReset->arg1 ) ) == NULL )
- {
- bug( "Reset_area: 'M': bad vnum %d.", pReset->arg1 );
- continue;
- }
+ switch ( pReset->command )
+ {
+ default:
+ bug( "Reset_room: bad command %c.", pReset->command );
+ break;
+
+ case 'M':
+ if ( !( pMobIndex = get_mob_index( pReset->arg1 ) ) )
+ {
+ bug( "Reset_room: '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;
- }
-
+ 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)
@@ -1271,66 +1666,80 @@
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);
- }
+ pMob = create_mobile( pMobIndex );
- /* set area */
- mob->zone = pRoomIndex->area;
+ /*
+ * Some more hard coding.
+ */
+ if ( room_is_dark( pRoom ) )
+ SET_BIT(pMob->affected_by, AFF_INFRARED);
+
+ /*
+ * Pet shop mobiles get ACT_PET set.
+ */
+ {
+ ROOM_INDEX_DATA *pRoomIndexPrev;
- char_to_room( mob, pRoomIndex );
- level = URANGE( 0, mob->level - 2, LEVEL_HERO - 1 );
- last = TRUE;
- break;
+ pRoomIndexPrev = get_room_index( pRoom->vnum - 1 );
+ if ( pRoomIndexPrev
+ && IS_SET( pRoomIndexPrev->room_flags, ROOM_PET_SHOP ) )
+ SET_BIT( pMob->act, ACT_PET);
+ }
- case 'O':
- if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL )
- {
- bug( "Reset_area: 'O': bad vnum %d.", pReset->arg1 );
- continue;
- }
+ char_to_room( pMob, pRoom );
- if ( ( pRoomIndex = get_room_index( pReset->arg3 ) ) == NULL )
- {
- bug( "Reset_area: 'R': bad vnum %d.", pReset->arg3 );
- continue;
- }
+ LastMob = pMob;
+ level = URANGE( 0, pMob->level - 2, LEVEL_HERO - 1 ); /* -1 ROM */
+ last = TRUE;
+ break;
- if ( pArea->nplayer > 0
- || count_obj_list( pObjIndex, pRoomIndex->contents ) > 0 )
+ case 'O':
+ if ( !( pObjIndex = get_obj_index( pReset->arg1 ) ) )
+ {
+ bug( "Reset_room: 'O' 1 : bad vnum %d", pReset->arg1 );
+ sprintf (buf,"%d %d %d %d",pReset->arg1, pReset->arg2, pReset->arg3,
+ pReset->arg4 );
+ bug(buf,1);
+ continue;
+ }
+
+ if ( !( pRoomIndex = get_room_index( pReset->arg3 ) ) )
+ {
+ bug( "Reset_room: 'O' 2 : bad vnum %d.", pReset->arg3 );
+ sprintf (buf,"%d %d %d %d",pReset->arg1, pReset->arg2, pReset->arg3,
+ pReset->arg4 );
+ bug(buf,1);
+ continue;
+ }
+
+ if ( pRoom->area->nplayer > 0
+ || count_obj_list( pObjIndex, pRoom->contents ) > 0 )
{
last = FALSE;
break;
}
- obj = create_object( pObjIndex, UMIN(number_fuzzy(level),
- LEVEL_HERO - 1) );
- obj->cost = 0;
- obj_to_room( obj, pRoomIndex );
+ pObj = create_object( pObjIndex, /* UMIN - ROM OLC */
+ UMIN(number_fuzzy( level ), LEVEL_HERO -1) );
+ pObj->cost = 0;
+ obj_to_room( pObj, pRoom );
last = TRUE;
- break;
+ break;
- case 'P':
- if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL )
- {
- bug( "Reset_area: 'P': bad vnum %d.", pReset->arg1 );
- continue;
- }
+ case 'P':
+ if ( !( pObjIndex = get_obj_index( pReset->arg1 ) ) )
+ {
+ bug( "Reset_room: '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 ( !( pObjToIndex = get_obj_index( pReset->arg3 ) ) )
+ {
+ bug( "Reset_room: 'P': bad vnum %d.", pReset->arg3 );
+ continue;
+ }
if (pReset->arg2 > 50) /* old format */
limit = 6;
@@ -1339,60 +1748,62 @@
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 )
+ if ( pRoom->area->nplayer > 0
+ || ( LastObj = get_obj_type( pObjToIndex ) ) == NULL
+ || ( LastObj->in_room == NULL && !last)
+ || ( pObjIndex->count >= limit /* && number_range(0,4) != 0 */ )
+ || ( count = count_obj_list( pObjIndex, LastObj->contains ) ) > pReset->arg4 )
{
last = FALSE;
break;
}
+ /* lastObj->level - ROM */
while (count < pReset->arg4)
{
- obj = create_object( pObjIndex, number_fuzzy(obj_to->level) );
- obj_to_obj( obj, obj_to );
+ pObj = create_object( pObjIndex, number_fuzzy( LastObj->level ) );
+ obj_to_obj( pObj, LastObj );
count++;
if (pObjIndex->count >= limit)
break;
}
+
/* fix object lock state! */
- obj_to->value[1] = obj_to->pIndexData->value[1];
+ LastObj->value[1] = LastObj->pIndexData->value[1];
last = TRUE;
- break;
+ 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;
- }
+ case 'G':
+ case 'E':
+ if ( !( pObjIndex = get_obj_index( pReset->arg1 ) ) )
+ {
+ bug( "Reset_room: 'E' or 'G': bad vnum %d.", pReset->arg1 );
+ continue;
+ }
- if ( !last )
- break;
+ if ( !last )
+ break;
- if ( mob == NULL )
- {
- bug( "Reset_area: 'E' or 'G': null mob for vnum %d.",
- pReset->arg1 );
- last = FALSE;
- break;
- }
+ if ( !LastMob )
+ {
+ bug( "Reset_room: 'E' or 'G': null mob for vnum %d.",
+ pReset->arg1 );
+ last = FALSE;
+ break;
+ }
- if ( mob->pIndexData->pShop != NULL )
- {
- int olevel = 0,i,j;
+ if ( LastMob->pIndexData->pShop ) /* Shop-keeper? */
+ {
+ int olevel=0,i,j;
if (!pObjIndex->new_format)
- switch ( pObjIndex->item_type )
- {
- case ITEM_PILL:
- case ITEM_POTION:
- case ITEM_SCROLL:
- olevel = 53;
+ switch ( pObjIndex->item_type )
+ {
+ default: olevel = 0; break;
+ case ITEM_PILL:
+ case ITEM_POTION:
+ case ITEM_SCROLL:
+ olevel = 53;
for (i = 1; i < 5; i++)
{
if (pObjIndex->value[i] > 0)
@@ -1408,108 +1819,121 @@
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 );
- }
+
+ 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;
+ /* ROM patch weapon, treasure */
+ case ITEM_WEAPON: olevel = number_range( 5, 15 ); break;
+ case ITEM_TREASURE: olevel = number_range( 10, 20 ); break;
+
+#if 0 /* envy version */
+ case ITEM_WEAPON: if ( pReset->command == 'G' )
+ olevel = number_range( 5, 15 );
+ else
+ olevel = number_fuzzy( level );
+#endif /* envy version */
+
+ break;
+ }
+
+ pObj = create_object( pObjIndex, olevel );
+ SET_BIT( pObj->extra_flags, ITEM_INVENTORY ); /* ROM OLC */
+
+#if 0 /* envy version */
+ if ( pReset->command == 'G' )
+ SET_BIT( pObj->extra_flags, ITEM_INVENTORY );
+#endif /* envy version */
- else
+ }
+ else /* ROM OLC else version */
{
- if (pReset->arg2 > 50) /* old format */
+ int limit;
+ if (pReset->arg2 > 50 ) /* old format */
limit = 6;
- else if (pReset->arg2 == -1) /* no limit */
+ else if ( pReset->arg2 == -1 || pReset->arg2 == 0 ) /* no limit */
limit = 999;
else
limit = pReset->arg2;
- if (pObjIndex->count < limit || number_range(0,4) == 0)
+ if ( pObjIndex->count < limit || number_range(0,4) == 0 )
{
- obj=create_object(pObjIndex,UMIN(number_fuzzy(level),
- LEVEL_HERO - 1));
+ pObj = 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
+ if (pObj->level > LastMob->level + 3
+ || (pObj->item_type == ITEM_WEAPON
&& pReset->command == 'E'
- && obj->level < mob->level -5 && obj->level < 45))
+ && pObj->level < LastMob->level -5 && pObj->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);
+ pObj->short_descr,pObj->pIndexData->vnum,pObj->level,
+ LastMob->short_descr,LastMob->pIndexData->vnum,LastMob->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;
+
+#if 0 /* envy else version */
+ else
+ {
+ pObj = create_object( pObjIndex, number_fuzzy( level ) );
+ }
+#endif /* envy else version */
- switch ( pReset->arg3 )
- {
- case 0:
- REMOVE_BIT( pexit->exit_info, EX_CLOSED );
- REMOVE_BIT( pexit->exit_info, EX_LOCKED );
- break;
+ obj_to_char( pObj, LastMob );
+ if ( pReset->command == 'E' )
+ equip_char( LastMob, pObj, pReset->arg3 );
+ last = TRUE;
+ break;
- case 1:
- SET_BIT( pexit->exit_info, EX_CLOSED );
- REMOVE_BIT( pexit->exit_info, EX_LOCKED );
- break;
+ case 'D':
+ break;
- case 2:
- SET_BIT( pexit->exit_info, EX_CLOSED );
- SET_BIT( pexit->exit_info, EX_LOCKED );
- break;
- }
+ case 'R':
+ if ( !( pRoomIndex = get_room_index( pReset->arg1 ) ) )
+ {
+ bug( "Reset_room: 'R': bad vnum %d.", pReset->arg1 );
+ continue;
+ }
- last = TRUE;
- break;
+ {
+ EXIT_DATA *pExit;
+ 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;
+ }
+ }
- case 'R':
- if ( ( pRoomIndex = get_room_index( pReset->arg1 ) ) == NULL )
- {
- bug( "Reset_area: 'R': bad vnum %d.", pReset->arg1 );
- continue;
- }
+ return;
+}
- {
- int d0;
- int d1;
+/* OLC
+ * Reset one area.
+ */
+void reset_area( AREA_DATA *pArea )
+{
+ ROOM_INDEX_DATA *pRoom;
+ int vnum;
- 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;
- }
+ for ( vnum = pArea->min_vnum; vnum <= pArea->max_vnum; vnum++ )
+ {
+ if ( ( pRoom = get_room_index(vnum) ) )
+ reset_room(pRoom);
}
return;
}
-
-
/*
* Create an instance of a mobile.
*/
@@ -1531,13 +1955,14 @@
mob->pIndexData = pMobIndex;
- mob->name = pMobIndex->player_name;
+ mob->name = str_dup( pMobIndex->player_name ); /* OLC */
+ mob->short_descr = str_dup( pMobIndex->short_descr ); /* OLC */
+ mob->long_descr = str_dup( pMobIndex->long_descr ); /* OLC */
+ mob->description = str_dup( pMobIndex->description ); /* OLC */
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;
+ mob->mprog_target = NULL;
if (pMobIndex->wealth == 0)
{
@@ -1845,9 +2270,9 @@
obj->level = UMAX(0,level);
obj->wear_loc = -1;
- obj->name = pObjIndex->name;
- obj->short_descr = pObjIndex->short_descr;
- obj->description = pObjIndex->description;
+ obj->name = str_dup( pObjIndex->name ); /* OLC */
+ obj->short_descr = str_dup( pObjIndex->short_descr ); /* OLC */
+ obj->description = str_dup( pObjIndex->description ); /* OLC */
obj->material = str_dup(pObjIndex->material);
obj->item_type = pObjIndex->item_type;
obj->extra_flags = pObjIndex->extra_flags;
@@ -2140,6 +2565,17 @@
return NULL;
}
+MPROG_CODE *get_mprog_index( int vnum )
+{
+ MPROG_CODE *prg;
+ for( prg = mprog_list; prg; prg = prg->next )
+ {
+ if ( prg->vnum == vnum )
+ return( prg );
+ }
+ return NULL;
+}
+
/*
diff -ur src/db.h new/db.h
--- src/db.h Sat May 23 22:27:21 1998
+++ new/db.h Wed Mar 15 22:57:16 2000
@@ -50,3 +50,12 @@
/* Magic number for memory allocation */
#define MAGIC_NUM 52571214
+
+/* func from db.c */
+extern void assign_area_vnum( int vnum ); /* OLC */
+
+/* from db2.c */
+
+void convert_mobile( MOB_INDEX_DATA *pMobIndex ); /* OLC ROM */
+void convert_objects( void ); /* OLC ROM */
+void convert_object( OBJ_INDEX_DATA *pObjIndex ); /* OLC ROM */
diff -ur src/db2.c new/db2.c
--- src/db2.c Sat May 23 22:27:26 1998
+++ new/db2.c Wed Mar 15 22:57:16 2000
@@ -39,16 +39,24 @@
#include "merc.h"
#include "db.h"
+#include "tables.h"
#include "lookup.h"
+extern int flag_lookup args((const char *name, const struct flag_type *flag_table));
/* values for db2.c */
+#if defined(FIRST_BOOT)
struct social_type social_table [MAX_SOCIALS];
+#else
+struct social_type * social_table;
+#endif
int social_count;
/* snarf a socials file */
void load_socials( FILE *fp)
{
+ extern int maxSocial;
+
for ( ; ; )
{
struct social_type social;
@@ -71,8 +79,8 @@
fprintf(stderr,"%s\n\r",temp);
#endif
- strcpy(social.name,temp);
- fread_to_eol(fp);
+ social.name = str_dup(temp);
+ fread_to_eol(fp);
temp = fread_string_eol(fp);
if (!strcmp(temp,"$"))
@@ -172,6 +180,7 @@
social_table[social_count] = social;
social_count++;
+ maxSocial++;
}
return;
}
@@ -188,6 +197,12 @@
{
MOB_INDEX_DATA *pMobIndex;
+ if ( !area_last ) /* OLC */
+ {
+ bug( "Load_mobiles: no #AREA seen yet.", 0 );
+ exit( 1 );
+ }
+
for ( ; ; )
{
sh_int vnum;
@@ -215,6 +230,7 @@
pMobIndex = alloc_perm( sizeof(*pMobIndex) );
pMobIndex->vnum = vnum;
+ pMobIndex->area = area_last; /* OLC */
pMobIndex->new_format = TRUE;
newmobs++;
pMobIndex->player_name = fread_string( fp );
@@ -287,7 +303,8 @@
pMobIndex->parts = fread_flag( fp )
| race_table[pMobIndex->race].parts;
/* size */
- pMobIndex->size = size_lookup(fread_word(fp));
+ CHECK_POS( pMobIndex->size, size_lookup(fread_word(fp)), "size" );
+/* pMobIndex->size = size_lookup(fread_word(fp)); */
pMobIndex->material = str_dup(fread_word( fp ));
for ( ; ; )
@@ -324,6 +341,26 @@
exit(1);
}
}
+ else if ( letter == 'M' )
+ {
+ MPROG_LIST *pMprog;
+ char *word;
+ int trigger = 0;
+
+ pMprog = alloc_perm(sizeof(*pMprog));
+ word = fread_word( fp );
+ if ( (trigger = flag_lookup( word, mprog_flags )) == NO_FLAG )
+ {
+ bug("MOBprogs: invalid trigger.",0);
+ exit(1);
+ }
+ SET_BIT( pMobIndex->mprog_flags, trigger );
+ pMprog->trig_type = trigger;
+ pMprog->vnum = fread_number( fp );
+ pMprog->trig_phrase = fread_string( fp );
+ pMprog->next = pMobIndex->mprogs;
+ pMobIndex->mprogs = pMprog;
+ }
else
{
ungetc(letter,fp);
@@ -335,6 +372,8 @@
pMobIndex->next = mob_index_hash[iHash];
mob_index_hash[iHash] = pMobIndex;
top_mob_index++;
+ top_vnum_mob = top_vnum_mob < vnum ? vnum : top_vnum_mob; /* OLC */
+ assign_area_vnum( vnum ); /* OLC */
kill_table[URANGE(0, pMobIndex->level, MAX_LEVEL-1)].number++;
}
@@ -348,6 +387,12 @@
{
OBJ_INDEX_DATA *pObjIndex;
+ if ( !area_last ) /* OLC */
+ {
+ bug( "Load_objects: no #AREA seen yet.", 0 );
+ exit( 1 );
+ }
+
for ( ; ; )
{
sh_int vnum;
@@ -375,6 +420,7 @@
pObjIndex = alloc_perm( sizeof(*pObjIndex) );
pObjIndex->vnum = vnum;
+ pObjIndex->area = area_last; /* OLC */
pObjIndex->new_format = TRUE;
pObjIndex->reset_num = 0;
newobjs++;
@@ -382,8 +428,8 @@
pObjIndex->short_descr = fread_string( fp );
pObjIndex->description = fread_string( fp );
pObjIndex->material = fread_string( fp );
-
- pObjIndex->item_type = item_lookup(fread_word( fp ));
+
+ CHECK_POS(pObjIndex->item_type, item_lookup(fread_word( fp )), "item_type" );
pObjIndex->extra_flags = fread_flag( fp );
pObjIndex->wear_flags = fread_flag( fp );
switch(pObjIndex->item_type)
@@ -406,7 +452,7 @@
case ITEM_FOUNTAIN:
pObjIndex->value[0] = fread_number(fp);
pObjIndex->value[1] = fread_number(fp);
- pObjIndex->value[2] = liq_lookup(fread_word(fp));
+ CHECK_POS(pObjIndex->value[2], liq_lookup(fread_word(fp)), "liq_lookup" );
pObjIndex->value[3] = fread_number(fp);
pObjIndex->value[4] = fread_number(fp);
break;
@@ -534,8 +580,445 @@
pObjIndex->next = obj_index_hash[iHash];
obj_index_hash[iHash] = pObjIndex;
top_obj_index++;
+ top_vnum_obj = top_vnum_obj < vnum ? vnum : top_vnum_obj; /* OLC */
+ assign_area_vnum( vnum ); /* OLC */
}
return;
}
+/*****************************************************************************
+ Name: convert_objects
+ Purpose: Converts all old format objects to new format
+ Called by: boot_db (db.c).
+ Note: Loops over all resets to find the level of the mob
+ loaded before the object to determine the level of
+ the object.
+ It might be better to update the levels in load_resets().
+ This function is not pretty.. Sorry about that :)
+ Author: Hugin
+ ****************************************************************************/
+void convert_objects( void )
+{
+ int vnum;
+ AREA_DATA *pArea;
+ RESET_DATA *pReset;
+ MOB_INDEX_DATA *pMob = NULL;
+ OBJ_INDEX_DATA *pObj;
+ ROOM_INDEX_DATA *pRoom;
+
+ if ( newobjs == top_obj_index ) return; /* all objects in new format */
+
+ for ( pArea = area_first; pArea; pArea = pArea->next )
+ {
+ for ( vnum = pArea->min_vnum; vnum <= pArea->max_vnum; vnum++ )
+ {
+ if ( !( pRoom = get_room_index( vnum ) ) ) continue;
+
+ for ( pReset = pRoom->reset_first; pReset; pReset = pReset->next )
+ {
+ switch ( pReset->command )
+ {
+ case 'M':
+ if ( !( pMob = get_mob_index( pReset->arg1 ) ) )
+ bug( "Convert_objects: 'M': bad vnum %d.", pReset->arg1 );
+ break;
+
+ case 'O':
+ if ( !( pObj = get_obj_index( pReset->arg1 ) ) )
+ {
+ bug( "Convert_objects: 'O': bad vnum %d.", pReset->arg1 );
+ break;
+ }
+
+ if ( pObj->new_format )
+ continue;
+
+ if ( !pMob )
+ {
+ bug( "Convert_objects: 'O': No mob reset yet.", 0 );
+ break;
+ }
+
+ pObj->level = pObj->level < 1 ? pMob->level - 2
+ : UMIN(pObj->level, pMob->level - 2);
+ break;
+
+ case 'P':
+ {
+ OBJ_INDEX_DATA *pObj, *pObjTo;
+
+ if ( !( pObj = get_obj_index( pReset->arg1 ) ) )
+ {
+ bug( "Convert_objects: 'P': bad vnum %d.", pReset->arg1 );
+ break;
+ }
+
+ if ( pObj->new_format )
+ continue;
+
+ if ( !( pObjTo = get_obj_index( pReset->arg3 ) ) )
+ {
+ bug( "Convert_objects: 'P': bad vnum %d.", pReset->arg3 );
+ break;
+ }
+
+ pObj->level = pObj->level < 1 ? pObjTo->level
+ : UMIN(pObj->level, pObjTo->level);
+ }
+ break;
+
+ case 'G':
+ case 'E':
+ if ( !( pObj = get_obj_index( pReset->arg1 ) ) )
+ {
+ bug( "Convert_objects: 'E' or 'G': bad vnum %d.", pReset->arg1 );
+ break;
+ }
+
+ if ( !pMob )
+ {
+ bug( "Convert_objects: 'E' or 'G': null mob for vnum %d.",
+ pReset->arg1 );
+ break;
+ }
+
+ if ( pObj->new_format )
+ continue;
+
+ if ( pMob->pShop )
+ {
+ switch ( pObj->item_type )
+ {
+ default:
+ pObj->level = UMAX(0, pObj->level);
+ break;
+ case ITEM_PILL:
+ case ITEM_POTION:
+ pObj->level = UMAX(5, pObj->level);
+ break;
+ case ITEM_SCROLL:
+ case ITEM_ARMOR:
+ case ITEM_WEAPON:
+ pObj->level = UMAX(10, pObj->level);
+ break;
+ case ITEM_WAND:
+ case ITEM_TREASURE:
+ pObj->level = UMAX(15, pObj->level);
+ break;
+ case ITEM_STAFF:
+ pObj->level = UMAX(20, pObj->level);
+ break;
+ }
+ }
+ else
+ pObj->level = pObj->level < 1 ? pMob->level
+ : UMIN( pObj->level, pMob->level );
+ break;
+ } /* switch ( pReset->command ) */
+ }
+ }
+ }
+
+ /* do the conversion: */
+
+ for ( pArea = area_first; pArea ; pArea = pArea->next )
+ for ( vnum = pArea->min_vnum; vnum <= pArea->max_vnum; vnum++ )
+ if ( (pObj = get_obj_index( vnum )) )
+ if ( !pObj->new_format )
+ convert_object( pObj );
+
+ return;
+}
+
+
+
+/*****************************************************************************
+ Name: convert_object
+ Purpose: Converts an old_format obj to new_format
+ Called by: convert_objects (db2.c).
+ Note: Dug out of create_obj (db.c)
+ Author: Hugin
+ ****************************************************************************/
+void convert_object( OBJ_INDEX_DATA *pObjIndex )
+{
+ int level;
+ int number, type; /* for dice-conversion */
+
+ if ( !pObjIndex || pObjIndex->new_format ) return;
+
+ level = pObjIndex->level;
+
+ pObjIndex->level = UMAX( 0, pObjIndex->level ); /* just to be sure */
+ pObjIndex->cost = 10*level;
+
+ switch ( pObjIndex->item_type )
+ {
+ default:
+ bug( "Obj_convert: vnum %d bad type.", pObjIndex->item_type );
+ break;
+
+ case ITEM_LIGHT:
+ case ITEM_TREASURE:
+ 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_SCROLL:
+ break;
+
+ case ITEM_WAND:
+ case ITEM_STAFF:
+ pObjIndex->value[2] = pObjIndex->value[1];
+ break;
+
+ case ITEM_WEAPON:
+
+ /*
+ * The conversion below is based on the values generated
+ * in one_hit() (fight.c). Since I don't want a lvl 50
+ * weapon to do 15d3 damage, the min value will be below
+ * the one in one_hit, and to make up for it, I've made
+ * the max value higher.
+ * (I don't want 15d2 because this will hardly ever roll
+ * 15 or 30, it will only roll damage close to 23.
+ * I can't do 4d8+11, because one_hit there is no dice-
+ * bounus value to set...)
+ *
+ * The conversion below gives:
+
+ level: dice min max mean
+ 1: 1d8 1( 2) 8( 7) 5( 5)
+ 2: 2d5 2( 3) 10( 8) 6( 6)
+ 3: 2d5 2( 3) 10( 8) 6( 6)
+ 5: 2d6 2( 3) 12(10) 7( 7)
+ 10: 4d5 4( 5) 20(14) 12(10)
+ 20: 5d5 5( 7) 25(21) 15(14)
+ 30: 5d7 5(10) 35(29) 20(20)
+ 50: 5d11 5(15) 55(44) 30(30)
+
+ */
+
+ number = UMIN(level/4 + 1, 5);
+ type = (level + 7)/number;
+
+ pObjIndex->value[1] = number;
+ pObjIndex->value[2] = type;
+ break;
+
+ case ITEM_ARMOR:
+ pObjIndex->value[0] = level / 5 + 3;
+ pObjIndex->value[1] = pObjIndex->value[0];
+ pObjIndex->value[2] = pObjIndex->value[0];
+ break;
+
+ case ITEM_POTION:
+ case ITEM_PILL:
+ break;
+
+ case ITEM_MONEY:
+ pObjIndex->value[0] = pObjIndex->cost;
+ break;
+ }
+
+ pObjIndex->new_format = TRUE;
+ ++newobjs;
+
+ return;
+}
+
+
+
+
+/*****************************************************************************
+ Name: convert_mobile
+ Purpose: Converts an old_format mob into new_format
+ Called by: load_old_mob (db.c).
+ Note: Dug out of create_mobile (db.c)
+ Author: Hugin
+ ****************************************************************************/
+void convert_mobile( MOB_INDEX_DATA *pMobIndex )
+{
+ int i;
+ int type, number, bonus;
+ int level;
+
+ if ( !pMobIndex || pMobIndex->new_format ) return;
+
+ level = pMobIndex->level;
+
+ pMobIndex->act |= ACT_WARRIOR;
+
+ /*
+ * Calculate hit dice. Gives close to the hitpoints
+ * of old format mobs created with create_mobile() (db.c)
+ * A high number of dice makes for less variance in mobiles
+ * hitpoints.
+ * (might be a good idea to reduce the max number of dice)
+ *
+ * The conversion below gives:
+
+ level: dice min max diff mean
+ 1: 1d2+6 7( 7) 8( 8) 1( 1) 8( 8)
+ 2: 1d3+15 16( 15) 18( 18) 2( 3) 17( 17)
+ 3: 1d6+24 25( 24) 30( 30) 5( 6) 27( 27)
+ 5: 1d17+42 43( 42) 59( 59) 16( 17) 51( 51)
+ 10: 3d22+96 99( 95) 162( 162) 63( 67) 131( )
+ 15: 5d30+161 166(159) 311( 311) 145( 150) 239( )
+ 30: 10d61+416 426(419) 1026(1026) 600( 607) 726( )
+ 50: 10d169+920 930(923) 2610(2610) 1680(1688) 1770( )
+
+ The values in parenthesis give the values generated in create_mobile.
+ Diff = max - min. Mean is the arithmetic mean.
+ (hmm.. must be some roundoff error in my calculations.. smurfette got
+ 1d6+23 hp at level 3 ? -- anyway.. the values above should be
+ approximately right..)
+ */
+ type = level*level*27/40;
+ number = UMIN(type/40 + 1, 10); /* how do they get 11 ??? */
+ type = UMAX(2, type/number);
+ bonus = UMAX(0, level*(8 + level)*.9 - number*type);
+
+ pMobIndex->hit[DICE_NUMBER] = number;
+ pMobIndex->hit[DICE_TYPE] = type;
+ pMobIndex->hit[DICE_BONUS] = bonus;
+
+ pMobIndex->mana[DICE_NUMBER] = level;
+ pMobIndex->mana[DICE_TYPE] = 10;
+ pMobIndex->mana[DICE_BONUS] = 100;
+
+ /*
+ * Calculate dam dice. Gives close to the damage
+ * of old format mobs in damage() (fight.c)
+ */
+ type = level*7/4;
+ number = UMIN(type/8 + 1, 5);
+ type = UMAX(2, type/number);
+ bonus = UMAX(0, level*9/4 - number*type);
+
+ pMobIndex->damage[DICE_NUMBER] = number;
+ pMobIndex->damage[DICE_TYPE] = type;
+ pMobIndex->damage[DICE_BONUS] = bonus;
+
+ switch ( number_range( 1, 3 ) )
+ {
+ case (1): pMobIndex->dam_type = 3; break; /* slash */
+ case (2): pMobIndex->dam_type = 7; break; /* pound */
+ case (3): pMobIndex->dam_type = 11; break; /* pierce */
+ }
+
+ for (i = 0; i < 3; i++)
+ pMobIndex->ac[i] = interpolate( level, 100, -100);
+ pMobIndex->ac[3] = interpolate( level, 100, 0); /* exotic */
+
+ pMobIndex->wealth /= 100;
+ pMobIndex->size = SIZE_MEDIUM;
+ pMobIndex->material = str_dup("none");
+
+ pMobIndex->new_format = TRUE;
+ ++newmobs;
+
+ return;
+}
+
+void recalc( MOB_INDEX_DATA *pMob )
+{
+ int hplev, aclev, damlev, hitbonus;
+ int i, cnt = 0, clase[10];
+ float n;
+
+ if ( pMob->level == 0 )
+ return;
+
+ hplev = 0; aclev = 0; damlev = 0; hitbonus = 0;
+
+ if ( IS_SET(pMob->act, ACT_WARRIOR) )
+ {
+ hplev += 1;
+ clase[cnt++] = ACT_WARRIOR;
+ }
+
+ if ( IS_SET(pMob->act, ACT_THIEF) )
+ {
+ hplev -= 1; aclev -= 1; damlev -= 1;
+ clase[cnt++] = ACT_THIEF;
+ }
+
+ if ( IS_SET(pMob->act, ACT_CLERIC) )
+ {
+ damlev -= 2;
+ clase[cnt++] = ACT_CLERIC;
+ }
+
+ if ( IS_SET(pMob->act, ACT_MAGE) )
+ {
+// hplev -= 1; aclev -= 1; damlev -= 3;
+ hplev -= 2; aclev -= 1; damlev -= 3;
+ clase[cnt++] = ACT_MAGE;
+ }
+
+ hplev += pMob->level;
+ aclev += pMob->level;
+ damlev += pMob->level;
+
+ hplev = URANGE( 1, hplev, 60 ) - 1;
+ aclev = URANGE( 1, aclev, 60 ) - 1;
+ damlev = URANGE( 1, damlev, 60 ) - 1;
+
+ pMob->hit[DICE_NUMBER] = recval_table[hplev].numhit;
+ pMob->hit[DICE_TYPE] = recval_table[hplev].typhit;
+ pMob->hit[DICE_BONUS] = recval_table[hplev].bonhit;
+
+ pMob->damage[DICE_NUMBER] = recval_table[damlev].numdam;
+ pMob->damage[DICE_TYPE] = recval_table[damlev].typdam;
+ pMob->damage[DICE_BONUS] = recval_table[damlev].bondam;
+
+ pMob->mana[DICE_NUMBER] = pMob->level;
+ pMob->mana[DICE_TYPE] = 10 + (pMob->level / 8);
+ pMob->mana[DICE_BONUS] = 100;
+
+ if ( IS_SET(pMob->act, ACT_CLERIC) || IS_SET(pMob->act, ACT_MAGE) )
+ pMob->mana[DICE_BONUS] *= (1 + pMob->level / 3);
+
+ for ( i = 0; i < 3; i++ )
+ pMob->ac[i] = recval_table[aclev].ac * 10;
+
+ if ( IS_SET(pMob->act, ACT_UNDEAD)
+ || IS_SET(pMob->form, FORM_UNDEAD)
+ || IS_SET(pMob->form, FORM_MAGICAL) )
+ n = 0;
+ else
+ if ( IS_SET(pMob->act, ACT_MAGE) )
+ n = 1;
+ else
+ if ( IS_SET(pMob->act,ACT_THIEF)
+ || IS_SET(pMob->act,ACT_CLERIC) )
+ n = 2;
+ else
+ n = 3;
+
+ aclev = UMAX(0, aclev - n);
+
+ pMob->ac[3] = recval_table[aclev].ac * 10;
+
+ if ( IS_SET(pMob->act, ACT_WARRIOR) )
+ hitbonus = pMob->level * 3 / 2;
+ else
+ if ( IS_SET(pMob->act, ACT_THIEF) )
+ hitbonus = pMob->level * 2 / 3;
+ else
+ if ( IS_SET(pMob->act, ACT_CLERIC) || IS_SET(pMob->act, ACT_MAGE) )
+ hitbonus = pMob->level / 2;
+
+ pMob->hitroll = hitbonus;
+
+ return;
+}
diff -ur src/fight.c new/fight.c
--- src/fight.c Thu May 28 00:39:30 1998
+++ new/fight.c Wed Mar 15 22:57:16 2000
@@ -70,7 +70,7 @@
CHAR_DATA *ch_next;
CHAR_DATA *victim;
- for ( ch = char_list; ch != NULL; ch = ch->next )
+ for ( ch = char_list; ch != NULL; ch = ch_next )
{
ch_next = ch->next;
@@ -89,6 +89,14 @@
* Fun for the whole family!
*/
check_assist(ch,victim);
+
+ if ( IS_NPC( ch ) )
+ {
+ if ( HAS_TRIGGER( ch, TRIG_FIGHT ) )
+ mp_percent_trigger( ch, victim, NULL, NULL, TRIG_FIGHT );
+ if ( HAS_TRIGGER( ch, TRIG_HPCNT ) )
+ mp_hprct_trigger( ch, victim );
+ }
}
return;
@@ -722,7 +730,11 @@
if ( victim->position > POS_STUNNED )
{
if ( victim->fighting == NULL )
+ {
set_fighting( victim, ch );
+ if ( IS_NPC( victim ) && HAS_TRIGGER( victim, TRIG_KILL ) )
+ mp_percent_trigger( victim, ch, NULL, NULL, TRIG_KILL );
+ }
if (victim->timer <= 4)
victim->position = POS_FIGHTING;
}
@@ -893,6 +905,15 @@
else
wiznet(log_buf,NULL,NULL,WIZ_DEATHS,0,0);
+ /*
+ * Death trigger
+ */
+ if ( IS_NPC( victim ) && HAS_TRIGGER( victim, TRIG_DEATH) )
+ {
+ victim->position = POS_STANDING;
+ mp_percent_trigger( victim, ch, NULL, NULL, TRIG_DEATH );
+ }
+
raw_kill( victim );
/* dump the flags */
if (ch != victim && !IS_NPC(ch) && !is_same_clan(ch,victim))
@@ -3047,7 +3068,27 @@
return;
}
+void do_surrender( CHAR_DATA *ch, char *argument )
+{
+ CHAR_DATA *mob;
+ if ( (mob = ch->fighting) == NULL )
+ {
+ send_to_char( "But you're not fighting!\n\r", ch );
+ return;
+ }
+ act( "You surrender to $N!", ch, NULL, mob, TO_CHAR );
+ act( "$n surrenders to you!", ch, NULL, mob, TO_VICT );
+ act( "$n tries to surrender to $N!", ch, NULL, mob, TO_NOTVICT );
+ stop_fighting( ch, TRUE );
+ if ( !IS_NPC( ch ) && IS_NPC( mob )
+ && ( !HAS_TRIGGER( mob, TRIG_SURR )
+ || !mp_percent_trigger( mob, ch, NULL, NULL, TRIG_SURR ) ) )
+ {
+ act( "$N seems to ignore your cowardly act!", ch, NULL, mob, TO_CHAR );
+ multi_hit( mob, ch, TYPE_UNDEFINED );
+ }
+}
void do_sla( CHAR_DATA *ch, char *argument )
{
diff -ur src/flags.c new/flags.c
--- src/flags.c Sat May 23 22:27:35 1998
+++ new/flags.c Wed Mar 15 22:57:16 2000
@@ -203,7 +203,8 @@
break;
pos = flag_lookup(word,flag_table);
- if (pos == 0)
+
+ if (pos == NO_FLAG)
{
send_to_char("That flag doesn't exist!\n\r",ch);
return;
diff -ur src/handler.c new/handler.c
--- src/handler.c Thu May 28 00:30:47 1998
+++ new/handler.c Wed Mar 15 22:57:16 2000
@@ -112,35 +112,6 @@
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;
@@ -169,21 +140,6 @@
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;
@@ -735,7 +691,11 @@
else
{
+#if defined(FIRST_BOOT)
max = pc_race_table[ch->race].max_stats[stat] + 4;
+#else
+ max = race_table[ch->race].max_stats[stat] + 4;
+#endif
if (class_table[ch->class].attr_prime == stat)
max += 2;
@@ -757,7 +717,11 @@
if (IS_NPC(ch) || ch->level > LEVEL_IMMORTAL)
return 25;
+#if defined(FIRST_BOOT)
max = pc_race_table[ch->race].max_stats[stat];
+#else
+ max = race_table[ch->race].max_stats[stat];
+#endif
if (class_table[ch->class].attr_prime == stat)
if (ch->race == race_lookup("human"))
max += 3;
@@ -1972,6 +1936,8 @@
{
if ( wch->reply == ch )
wch->reply = NULL;
+ if ( ch->mprog_target == wch )
+ wch->mprog_target = NULL;
}
if ( ch == char_list )
@@ -2908,3 +2874,70 @@
return ( buf[0] != '\0' ) ? buf+1 : "none";
}
+
+bool emptystring( const char * str )
+{
+ int i = 0;
+
+ for ( ; str[i]; i++ )
+ if ( str[i] != ' ' )
+ return FALSE;
+
+ return TRUE;
+}
+
+char *itos( int temp )
+{
+ static char buf[64];
+
+ sprintf( buf, "%d", temp );
+
+ return buf;
+}
+
+int get_vnum_mob_name_area( char * name, AREA_DATA * pArea )
+{
+ int hash;
+ MOB_INDEX_DATA * mob;
+
+ for ( hash = 0; hash < MAX_KEY_HASH; hash++ )
+ for ( mob = mob_index_hash[hash]; mob; mob = mob->next )
+ if ( mob->area == pArea
+ && !str_prefix(name, mob->player_name) )
+ return mob->vnum;
+
+ return 0;
+}
+
+int get_vnum_obj_name_area( char * name, AREA_DATA * pArea )
+{
+ int hash;
+ OBJ_INDEX_DATA * obj;
+
+ for ( hash = 0; hash < MAX_KEY_HASH; hash++ )
+ for ( obj = obj_index_hash[hash]; obj; obj = obj->next )
+ if ( obj->area == pArea
+ && !str_prefix(name, obj->name) )
+ return obj->vnum;
+
+ return 0;
+}
+
+#if !defined(FIRST_BOOT)
+int get_points( int race, int class )
+{
+ int x;
+
+ x = group_lookup(class_table[class].default_group);
+
+ if ( x == -1 )
+ {
+ bugf( "get_points : group %s doesn't exist, create %d, clase %d",
+ class_table[class].default_group,
+ race, class );
+ return -1;
+ }
+
+ return group_table[x].rating[class] + race_table[race].points;
+}
+#endif
diff -ur src/interp.c new/interp.c
--- src/interp.c Mon May 25 07:12:59 1998
+++ new/interp.c Wed Mar 15 22:57:16 2000
@@ -61,6 +61,7 @@
/*
* Command table.
*/
+#if defined(FIRST_BOOT)
const struct cmd_type cmd_table [] =
{
/*
@@ -246,9 +247,15 @@
{ "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 },
+ { "surrender", do_surrender, POS_FIGHTING, 0, LOG_NORMAL, 1 },
{ "trip", do_trip, POS_FIGHTING, 0, LOG_NORMAL, 1 },
/*
+ * Mob command interpreter (placed here for faster scan...)
+ */
+ { "mob", do_mob, POS_DEAD, 0, LOG_NEVER, 0 },
+
+ /*
* Miscellaneous commands.
*/
{ "enter", do_enter, POS_STANDING, 0, LOG_NORMAL, 1 },
@@ -350,15 +357,121 @@
{ "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 },
+ { "mpdump", do_mpdump, POS_DEAD, IM, LOG_NEVER, 1 },
+ { "mpstat", do_mpstat, POS_DEAD, IM, LOG_NEVER, 1 },
+
+ /*
+ * OLC
+ */
+ { "edit", do_olc, POS_DEAD, 0, LOG_NORMAL, 1 },
+ { "asave", do_asave, POS_DEAD, 0, LOG_NORMAL, 1 },
+ { "alist", do_alist, POS_DEAD, 0, LOG_NORMAL, 1 },
+ { "resets", do_resets, POS_DEAD, 0, LOG_NORMAL, 1 },
+ { "redit", do_redit, POS_DEAD, 0, LOG_NORMAL, 1 },
+ { "medit", do_medit, POS_DEAD, 0, LOG_NORMAL, 1 },
+ { "aedit", do_aedit, POS_DEAD, 0, LOG_NORMAL, 1 },
+ { "oedit", do_oedit, POS_DEAD, 0, LOG_NORMAL, 1 },
+ { "mpedit", do_pedit, POS_DEAD, 0, LOG_NORMAL, 1 },
+ { "hedit", do_hedit, POS_DEAD, 0, LOG_NORMAL, 1 },
+ { "skedit", do_skedit, POS_DEAD, 0, LOG_NORMAL, 1 },
+ { "raedit", do_raedit, POS_DEAD, 0, LOG_NORMAL, 1 },
+ { "sedit", do_sedit, POS_DEAD, 0, LOG_NORMAL, 1 },
+ { "gedit", do_gedit, POS_DEAD, 0, LOG_NORMAL, 1 },
+ { "cmdedit", do_cmdedit, POS_DEAD, 0, LOG_NORMAL, 1 },
+ { "olcx", do_olcx, POS_DEAD, 0, LOG_NORMAL, 1 },
/*
* End of list.
*/
{ "", 0, POS_DEAD, 0, LOG_NORMAL, 0 }
};
+#else
+void ordenar_tabla_com( void )
+{
+ int i, j, cnt, maxcnt = 0, cntl[27], ilet, calc;
+ char letra;
+ struct cmd_type *new_cmd_table;
+ struct cmd_type **temptabla;
+
+ for ( i = 0; i < 27; ++i )
+ cntl[i] = 0;
+
+ for ( i = 0; i < 26; i++ )
+ {
+ cnt = 0;
+
+ for ( j = 0; j < MAX_CMD; ++j )
+ {
+ letra = LOWER(cmd_table[j].name[0]) - 'a';
+ if ( i == (int) letra )
+ cnt++;
+ }
+
+ if ( cnt > maxcnt )
+ maxcnt = cnt;
+ }
+
+ temptabla = calloc( (maxcnt*27), sizeof(struct cmd_type *) );
+
+ for ( i = 0; i < (maxcnt*27); ++i )
+ temptabla[i] = NULL;
+ for ( i = 0; i < MAX_CMD; ++i )
+ {
+ if ( !isalpha(cmd_table[i].name[0]) )
+ temptabla[cntl[0]++] = &cmd_table[i];
+ else
+ {
+ letra = LOWER(cmd_table[i].name[0]);
+ ilet = (int) letra;
+ ilet -= 'a';
+ ilet++;
+ cntl[ilet]++;
+ calc = (maxcnt * ilet) + cntl[ilet];
+ temptabla[calc] = &cmd_table[i];
+ }
+ }
+
+ new_cmd_table = malloc (sizeof(struct cmd_type) * (MAX_CMD + 1));
+
+ i = cnt = 0;
+ while ( i < (maxcnt*27) )
+ {
+ if ( temptabla[i] )
+ new_cmd_table[cnt++] = *temptabla[i];
+ i++;
+ }
+ new_cmd_table[MAX_CMD].name = str_dup( "" );
+
+ free(temptabla);
+ free(cmd_table);
+ cmd_table = new_cmd_table;
+}
+int num_letra[26];
+
+void crear_tabla_com( void )
+{
+ int cmd;
+ char letra;
+
+ /* Ordenar tabla e inicializar vector */
+ ordenar_tabla_com();
+ for ( cmd = 0; cmd < 26; cmd++ )
+ num_letra[cmd] = -1;
+
+ for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; ++cmd )
+ {
+ letra = LOWER(cmd_table[cmd].name[0]);
+ if ( !isalpha(letra) )
+ continue;
+ letra -= 'a'; /* rango 0...26-1 */
+ if ( num_letra[(int) letra] == -1 )
+ num_letra[(int) letra] = cmd;
+ }
+}
+#endif
/*
* The main entry point for executing commands.
@@ -533,7 +646,7 @@
bool found;
found = FALSE;
- for ( cmd = 0; social_table[cmd].name[0] != '\0'; cmd++ )
+ for ( cmd = 0; !IS_NULLSTR(social_table[cmd].name); cmd++ )
{
if ( command[0] == social_table[cmd].name[0]
&& !str_prefix( command, social_table[cmd].name ) )
diff -ur src/interp.h new/interp.h
--- src/interp.h Thu May 28 00:44:20 1998
+++ new/interp.h Wed Mar 15 22:57:16 2000
@@ -51,7 +51,7 @@
*/
struct cmd_type
{
- char * const name;
+ char * name;
DO_FUN * do_fun;
sh_int position;
sh_int level;
@@ -60,239 +60,12 @@
};
/* the command table itself */
+#if defined(FIRST_BOOT)
extern const struct cmd_type cmd_table [];
+#else
+extern struct cmd_type * cmd_table;
+#endif
-/*
- * 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 );
+extern int MAX_CMD;
+
+#include "command.h"
diff -ur src/lookup.c new/lookup.c
--- src/lookup.c Sat May 23 22:27:42 1998
+++ new/lookup.c Wed Mar 15 22:57:16 2000
@@ -32,6 +32,7 @@
#endif
#include <stdio.h>
#include <time.h>
+#include <string.h>
#include "merc.h"
#include "tables.h"
@@ -46,7 +47,7 @@
return flag_table[flag].bit;
}
- return 0;
+ return NO_FLAG;
}
int clan_lookup(const char *name)
@@ -104,3 +105,80 @@
return -1;
}
+
+/* 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 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;
+}
+
+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;
+}
+
+HELP_DATA * help_lookup( char *keyword )
+{
+ HELP_DATA *pHelp;
+ char temp[MIL], argall[MIL];
+
+ argall[0] = '\0';
+
+ while (keyword[0] != '\0' )
+ {
+ keyword = one_argument(keyword, temp);
+ if (argall[0] != '\0')
+ strcat(argall," ");
+ strcat(argall, temp);
+ }
+
+ for ( pHelp = help_first; pHelp != NULL; pHelp = pHelp->next )
+ if ( is_name( argall, pHelp->keyword ) )
+ return pHelp;
+
+ return NULL;
+}
+
+HELP_AREA * had_lookup( char *arg )
+{
+ HELP_AREA * temp;
+ extern HELP_AREA * had_list;
+
+ for ( temp = had_list; temp; temp = temp->next )
+ if ( !str_cmp( arg, temp->filename ) )
+ return temp;
+
+ return NULL;
+}
diff -ur src/lookup.h new/lookup.h
--- src/lookup.h Sat May 23 22:27:43 1998
+++ new/lookup.h Wed Mar 15 22:57:16 2000
@@ -25,8 +25,16 @@
* ROM license, in the file Rom24/doc/rom.license *
***************************************************************************/
+#if !defined(_LOOKUP_H)
+#define _LOOKUP_H
+
+#include "tables.h"
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) );
+int flag_lookup args( (const char *, const struct flag_type *) );
+HELP_DATA * help_lookup args( (char *) );
+HELP_AREA * had_lookup args( (char *) );
+#endif
diff -ur src/magic.h new/magic.h
--- src/magic.h Sat May 23 22:27:47 1998
+++ new/magic.h Wed Mar 15 22:57:16 2000
@@ -30,101 +30,101 @@
* 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 );
+SPELL( spell_null )
+SPELL( spell_acid_blast )
+SPELL( spell_armor )
+SPELL( spell_bless )
+SPELL( spell_blindness )
+SPELL( spell_burning_hands )
+SPELL( spell_call_lightning )
+SPELL( spell_calm )
+SPELL( spell_cancellation )
+SPELL( spell_cause_critical )
+SPELL( spell_cause_light )
+SPELL( spell_cause_serious )
+SPELL( spell_change_sex )
+SPELL( spell_chain_lightning )
+SPELL( spell_charm_person )
+SPELL( spell_chill_touch )
+SPELL( spell_colour_spray )
+SPELL( spell_continual_light )
+SPELL( spell_control_weather )
+SPELL( spell_create_food )
+SPELL( spell_create_rose )
+SPELL( spell_create_spring )
+SPELL( spell_create_water )
+SPELL( spell_cure_blindness )
+SPELL( spell_cure_critical )
+SPELL( spell_cure_disease )
+SPELL( spell_cure_light )
+SPELL( spell_cure_poison )
+SPELL( spell_cure_serious )
+SPELL( spell_curse )
+SPELL( spell_demonfire )
+SPELL( spell_detect_evil )
+SPELL( spell_detect_good )
+SPELL( spell_detect_hidden )
+SPELL( spell_detect_invis )
+SPELL( spell_detect_magic )
+SPELL( spell_detect_poison )
+SPELL( spell_dispel_evil )
+SPELL( spell_dispel_good )
+SPELL( spell_dispel_magic )
+SPELL( spell_earthquake )
+SPELL( spell_enchant_armor )
+SPELL( spell_enchant_weapon )
+SPELL( spell_energy_drain )
+SPELL( spell_faerie_fire )
+SPELL( spell_faerie_fog )
+SPELL( spell_farsight )
+SPELL( spell_fireball )
+SPELL( spell_fireproof )
+SPELL( spell_flamestrike )
+SPELL( spell_floating_disc )
+SPELL( spell_fly )
+SPELL( spell_frenzy )
+SPELL( spell_gate )
+SPELL( spell_giant_strengthShowing the first 100 KB of 155.0 KB. Download the archive for the full file.