39bto40.patch
1stMUD4.0/39bto40.patch · 1005.7 KB
From the archive 1stMUD4.0[1].tgz
Download the archive « Back to the archive contents
diff -ur -x config -x o -x rom src/Makefile new/Makefile
--- src/Makefile Tue May 27 02:45:45 2003
+++ new/Makefile Sun Aug 31 19:23:21 2003
@@ -1,41 +1,11 @@
-CC = g++
-PROF = -ggdb3
-WARN = -Wall -Werror
-LIBS = -lcrypt -lz
-#STRHASH: 0 = no string hashing.
-# 1 = ROM fread_string() hashing only.
-# 2 = full string hashing
-D_FLAGS = -DSTRHASH=0 #-DNO_MCCP -DNO_WEB -DNOCRYPT
-C_FLAGS = $(WARN) $(PROF) $(D_FLAGS)
-L_FLAGS = $(PROF) $(LIBS)
+beginhelp:
+ @echo =============================================================================
+ @echo Change into the config directory and run ./configure to create a makefile
+ @echo
+ @echo Notes: The makefile configure generates requires a version of make that
+ @echo " has the sort function amoung other things."
+ @echo
+ @echo " On the FreeBSD and OpenBSD platforms you will most likely need to"
+ @echo " use gmake to compile the code."
+ @echo =============================================================================
-C_FILES := $(wildcard *.c)
-O_FILES := $(patsubst %.c, %.o, $(C_FILES))
-H_FILES := $(wildcard *.h)
-
-all: rom
-
-rom: $(O_FILES)
- @rm -f rom
- @$(CC) $(L_FLAGS) -o rom $(O_FILES)
- @echo "Done."
-
-.c.o: merc.h
- @echo "`date +"%X"` : Compiling $<..."
- @$(CC) -c $(C_FLAGS) $<
-
-clean:
- @rm -rf *.o *~ *.orig *.rej \#* *core*
- @echo "Done cleaning."
-
-indent:
- @indent $(C_FILES) $(H_FILES)
- @echo "Done formating files."
-
-depend:
- @$(CC) -E -MM $(C_FLAGS) $(C_FILES) -I. > .depend
- @echo "Done making depend file."
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-include .depend
diff -ur -x config -x o -x rom src/act_comm.c new/act_comm.c
--- src/act_comm.c Tue May 27 02:46:35 2003
+++ new/act_comm.c Sun Aug 31 19:23:20 2003
@@ -22,28 +22,17 @@
* By using this code, you have agreed to follow the terms of the *
* ROM license, in the file Rom24/doc/rom.license *
***************************************************************************
-* 1stMUD ROM Derivative (c) 2001-2002 by Ryan Jennings *
+* 1stMUD ROM Derivative (c) 2001-2003 by Ryan Jennings *
* http://1stmud.dlmud.com/ <r-jenn@shaw.ca> *
***************************************************************************/
-#include <sys/types.h>
-#if !defined(WIN32)
-#include <unistd.h>
-#include <sys/time.h>
-#else
-#include "../win32/winstuff.h"
-#endif
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <stdarg.h>
#include "merc.h"
#include "interp.h"
#include "recycle.h"
#include "tables.h"
#include "lookup.h"
#include "olc.h"
+#include "gcn.h"
/* RT code to delete yourself */
@@ -57,14 +46,14 @@
char strsave[MAX_INPUT_LENGTH];
int hash;
ROOM_INDEX_DATA *pRoom;
- void update_webpasses(CHAR_DATA * ch, bool pDelete);
+ PROTOTYPE(void update_webpasses, (CHAR_DATA *, bool));
if (IS_NPC(ch))
return;
if (ch->pcdata->confirm_delete)
{
- if (argument[0] != '\0')
+ if (!IS_NULLSTR(argument))
{
chprintln(ch, "Delete status removed.");
ch->pcdata->confirm_delete = FALSE;
@@ -100,7 +89,7 @@
}
}
- if (argument[0] != '\0')
+ if (!IS_NULLSTR(argument))
{
chprintln(ch, "Just type delete. No argument.");
return;
@@ -113,304 +102,6 @@
wiznet("$N is contemplating deletion.", ch, NULL, 0, 0, get_trust(ch));
}
-void update_last_data(CHAR_DATA * sender, CHAR_DATA * viewer, int last,
- const char *chan, const char *str, int type)
-{
- int i;
- char *time;
- char buf[MSL];
-
- if (IS_NPC(viewer) || IS_NULLSTR(str) || IS_NULLSTR(chan) || last < 0
- || last >= LAST_MAX)
- return;
-
- for (i = LAST_PAGE_LENGTH - 1; i > 0; i--)
- {
- replace_string(viewer->pcdata->history[last][i],
- viewer->pcdata->history[last][i - 1]);
- }
-
- time = str_time(current_time, GET_TZONE(viewer), "%r");
- switch (type)
- {
- case CHANNEL_NORMAL:
- sprintf(buf, "[%s] %s{x %s says '%s'{x", time, chan, PERS(sender,
- viewer), str);
- replace_string(viewer->pcdata->history[last][0], buf);
- break;
- case CHANNEL_SOCIAL:
- sprintf(buf, "[%s] %s{x %s{x", time, chan, str);
- replace_string(viewer->pcdata->history[last][0], buf);
- break;
- case CHANNEL_EMOTE:
- sprintf(buf, "[%s] %s{x %s %s{x",
- time, chan, PERS(sender, viewer), str);
- replace_string(viewer->pcdata->history[last][0], buf);
- break;
- default:
- bugf("bad channel type [%d]", type);
- break;
- }
-}
-
-void view_last_data(CHAR_DATA * ch, int last)
-{
- int i;
- bool found = FALSE;
-
- if (last < 0 || last >= LAST_MAX)
- return;
-
- for (i = LAST_PAGE_LENGTH - 1; i >= 0; i--)
- {
- if (!IS_NULLSTR(ch->pcdata->history[last][i]))
- {
- found = TRUE;
- chprintln(ch, ch->pcdata->history[last][i]);
- }
- }
- if (!found)
- chprintln(ch, "None.");
-}
-
-bool display_channel(CHAR_DATA * ch, CHAR_DATA * victim,
- enum special_flags spec_flag)
-{
- if (!ch || !victim)
- return FALSE;
-
- if (IS_SET(victim->comm, COMM_QUIET))
- return FALSE;
-
- switch (spec_flag)
- {
- case spec_clan_flag:
- if (!is_same_clan(ch, victim))
- return FALSE;
- break;
- case spec_imm_flag:
- if (!IS_IMMORTAL(victim))
- return FALSE;
- break;
- case spec_buddy_flag:
- if (victim != ch
- && (check_buddy(ch, victim) == -1 || check_buddy(victim, ch) == -1))
- return FALSE;
- break;
- case spec_public_flag:
- return TRUE;
- break;
- }
-
- return TRUE;
-}
-
-void channel_social(CHAR_DATA * ch, CHAR_DATA * victim,
- flag_t bit, const char *string, const char *type,
- enum special_flags spec_flag, int last_type)
-{
- DESCRIPTOR_DATA *d;
-
- for (d = descriptor_first; d; d = d->next)
- {
- CHAR_DATA *vch = CH(d);
-
- if (d->connected != CON_PLAYING)
- continue;
-
- if (vch && (vch != ch) && (vch != victim)
- && display_channel(ch, vch, spec_flag)
- && (!bit || !IS_SET(vch->comm, bit))
- && !IS_SET(vch->comm, COMM_NOGOCIAL))
- {
- char buf[MSL];
-
- sprintf(buf, "%s %s", type, string);
- perform_act(buf, ch, NULL, victim, 0, vch);
- update_last_data(ch, vch, last_type, type,
- perform_act_string(string, ch, NULL, victim,
- FALSE), CHANNEL_SOCIAL);
- }
- }
- update_last_data(ch, ch, last_type, type,
- perform_act_string(string, ch, NULL, victim, FALSE),
- CHANNEL_SOCIAL);
-}
-
-void public_ch(CHAR_DATA * ch, const char *argument,
- const char *type, flag_t bitname, enum special_flags spec_flag,
- int last_type)
-{
- char command[MIL + 100];
- DESCRIPTOR_DATA *d;
- bool display_wholist = FALSE, fEmote = FALSE;
- char arg_left[MSL];
-
- if (IS_NULLSTR(argument))
- {
- if (!bitname)
- chprintln(ch, "What do you want to say?");
- else
- {
- set_on_off(ch, &ch->comm, bitname,
- FORMATF("%s channel is now OFF.{x", type),
- FORMATF("%s channel is now ON.{x", type));
- }
- }
- else
- {
- if (IS_SET(ch->comm, COMM_QUIET))
- {
- chprintln(ch, "You must turn off quiet mode first.");
- return;
- }
- if (IS_SET(ch->comm, COMM_NOCHANNELS))
- {
- chprintln(ch, "The gods have revoked your channel priviliges.");
- return;
- }
- if (bitname)
- REMOVE_BIT(ch->comm, (bitname));
-
- strcpy(arg_left, argument);
-
- argument = one_argument(argument, command);
- if (!str_cmp(command, "+"))
- {
- CHAR_DATA *victim;
- char buf[MIL + 200];
- SOCIAL_DATA *cmd;
- char argx[MIL];
-
- argument = one_argument(argument, command);
- if (IS_NULLSTR(command))
- {
- chprintln
- (ch,
- "{W<Channel> + <social> is used for channel based socials.{x");
- return;
- }
- if (!(cmd = find_social(command)))
- {
- chprintln(ch, "{WWhat kind of social is that?!?!{x");
- return;
- }
- one_argument(argument, argx);
- victim = NULL;
- if (IS_NULLSTR(argx))
- {
- sprintf(buf, "%s %s", type, cmd->char_no_arg);
- act_new(buf, ch, NULL, NULL, TO_CHAR, POS_DEAD);
- channel_social(ch, NULL, bitname,
- cmd->others_no_arg, type, spec_flag, last_type);
- }
- else if ((victim = get_char_world(ch, argx)) == NULL)
- {
- chprintln(ch, "They aren't here.");
- return;
- }
- else
- {
- if (!display_channel(ch, victim, spec_flag))
- {
- chprintln(ch, "They can't use that channel.");
- return;
- }
- if (victim == ch)
- {
- sprintf(buf, "%s %s", type, cmd->char_auto);
- act_new(buf, ch, NULL, NULL, TO_CHAR, POS_DEAD);
- channel_social(ch, victim, bitname,
- cmd->others_auto, type,
- spec_flag, last_type);
- }
- else
- {
- sprintf(buf, "%s %s", type, cmd->char_found);
- act_new(buf, ch, NULL, victim, TO_CHAR, POS_DEAD);
- if ((!bitname || !IS_SET(victim->comm, bitname))
- && !IS_SET(victim->comm, COMM_NOGOCIAL)
- && display_channel(ch, victim, spec_flag))
- {
- sprintf(buf, "%s %s", type, cmd->vict_found);
- act_new(buf, ch, NULL, victim, TO_VICT, POS_DEAD);
- }
- channel_social(ch, victim, bitname,
- cmd->others_found, type,
- spec_flag, last_type);
- }
- }
- return;
- }
- else if (!str_cmp(command, "!"))
- {
- fEmote = TRUE;
-
- chprintlnf(ch, "%s %s %s{x", type,
- IS_NPC(ch) ? ch->short_descr : ch->name, argument);
- update_last_data(ch, ch, last_type, type, argument, CHANNEL_EMOTE);
- }
- else if (!str_cmp(command, "wholist"))
- {
- display_wholist = TRUE;
- chprintlnf(ch, "{WPlayers on %s{x", type);
- chprintln(ch, "{C-------------------{x");
- }
- else if (!str_cmp(command, "-h") && !IS_NPC(ch) && last_type >= 0
- && last_type < LAST_MAX)
- {
- chprintlnf(ch, "{WLast %d messages on %s{x", LAST_PAGE_LENGTH,
- type);
- chprintln(ch, "{C------------------------------{x");
- view_last_data(ch, last_type);
- return;
- }
- else
- {
- chprintlnf(ch, "%s You say '%s'{x", type, arg_left);
- update_last_data(ch, ch, last_type, type, arg_left, CHANNEL_NORMAL);
- }
- for (d = descriptor_first; d != NULL; d = d->next)
- {
- CHAR_DATA *victim;
-
- if (d->connected != CON_PLAYING)
- continue;
- if ((victim = d->character) == NULL)
- continue;
- if (victim == ch)
- continue;
- if ((bitname && IS_SET(victim->comm, (bitname)))
- || display_channel(ch, victim, spec_flag) == FALSE)
- continue;
-
- if (!display_wholist)
- {
- if (fEmote && !IS_SET(victim->comm, COMM_NOGOCIAL))
- {
- chprintlnf(victim, "%s %s %s{x", type,
- smash_colour(PERS(ch, victim)), argument);
- update_last_data(ch, victim, last_type, type, argument,
- CHANNEL_EMOTE);
- }
- else
- {
- chprintlnf(victim, "%s %s says '%s'{x", type,
- smash_colour(PERS(ch, victim)), arg_left);
- update_last_data(ch, victim, last_type, type, arg_left,
- CHANNEL_NORMAL);
- }
- }
- else
- {
- if (victim->invis_level < LEVEL_IMMORTAL
- && victim->incog_level < LEVEL_IMMORTAL)
- chprintlnf(ch, "{W%s{x", PERS(victim, ch));
- }
- }
- }
-}
-
CH_CMD(do_nogocial)
{
set_on_off(ch, &ch->comm, COMM_NOGOCIAL,
@@ -418,80 +109,6 @@
"You now see socials/emotes over channels.");
}
-/* RT code to display channel status */
-
-CH_CMD(do_channels)
-{
- /* lists all channels and their status */
- chprintlnf(ch, " %-9s %-6s{w %s", "Command", "Status", "Description");
- chprintln(ch, draw_line(ch, NULL, 0));
-
- print_on_off(ch, !IS_SET(ch->comm, COMM_NOGOSSIP), "gossip",
- "Channel used in roleplay discussions.");
- print_on_off(ch, !IS_SET(ch->comm, COMM_NOOOC), "ooc",
- "A global channel for Out Of Character discussions.");
- print_on_off(ch, !IS_SET(ch->comm, COMM_NOAUCTION), "auction",
- "Channel for bartering goods.");
- print_on_off(ch, !IS_SET(ch->comm, COMM_NOMUSIC), "music",
- "Global channel used for singing and jukebox songs.");
- print_on_off(ch, !IS_SET(ch->comm, COMM_NOQUESTION), "Q/A",
- "Channel for asking and answering questions.");
- print_on_off(ch, !IS_SET(ch->comm, COMM_NOQUOTE), "quote",
- "A global channel for \"quoting\" someone or something.");
- print_on_off(ch, !IS_SET(ch->comm, COMM_NOGRATS), "grats",
- "A global channel for congratulating someone or something.");
- print_on_off(ch, !IS_SET(ch->comm, COMM_NOBUDDY), "btalk",
- "A private channel that only transmits within buddies.");
-
- if (IS_IMMORTAL(ch))
- {
- print_on_off(ch, !IS_SET(ch->comm, COMM_NOWIZ), "immtalk",
- "A global channel only for Immortals to use.");
- }
-
- print_on_off(ch, IS_SET(ch->comm, COMM_SHOUTSOFF), "shouts",
- "A global channel that transmits with a delay as if there is an echo.");
- print_on_off(ch, IS_SET(ch->comm, COMM_DEAF), "deaf",
- "Prevents you from hearing any tells.");
- print_on_off(ch, IS_SET(ch->comm, COMM_QUIET), "quiet",
- "Toggles whether you receive any channels at all.");
- print_on_off(ch, IS_SET(ch->comm, COMM_AFK), "afk",
- "Sets you Away From Keyboard.");
- print_on_off(ch, IS_SET(ch->comm, COMM_NOGOCIAL), "nogocial",
- "Toggles socials/emotes over public channels.");
- chprintln(ch, draw_line(ch, NULL, 0));
-
- if (IS_SET(ch->comm, COMM_SNOOP_PROOF))
- chprintln(ch, "You are immune to snooping.");
-
- if (ch->lines != PAGELEN)
- {
- if (ch->lines)
- {
- chprintlnf(ch, "You display %d lines of scroll.", ch->lines + 2);
- }
- else
- chprintln(ch, "Scroll buffering is off.");
- }
-
- if (ch->prompt != NULL)
- {
- chprintlnf(ch, "Your current prompt is: %s", ch->prompt);
- }
-
- if (IS_SET(ch->comm, COMM_NOSHOUT))
- chprintln(ch, "You cannot shout.");
-
- if (IS_SET(ch->comm, COMM_NOTELL))
- chprintln(ch, "You cannot use tell.");
-
- if (IS_SET(ch->comm, COMM_NOCHANNELS))
- chprintln(ch, "You cannot use channels.");
-
- if (IS_SET(ch->comm, COMM_NOEMOTE))
- chprintln(ch, "You cannot show emotions.");
-}
-
/* RT deaf blocks out all shouts */
CH_CMD(do_deaf)
@@ -521,8 +138,20 @@
}
else
{
- chprintln(ch, "You are now in AFK mode.");
+ chprint(ch, "You are now in AFK mode. ");
SET_BIT(ch->comm, COMM_AFK);
+ if (!IS_NPC(ch))
+ {
+ char buf[MSL];
+
+ sprintf(buf, "[%s] %s", str_time(-1, GET_TZONE(ch), "%I:%M:%S %p"),
+ IS_NULLSTR(argument) ? "Please leave a message!" :
+ argument);
+ replace_string(ch->pcdata->afk_msg, buf);
+ chprintln(ch, ch->pcdata->afk_msg);
+ }
+ else
+ chprintln(ch, "");
}
}
@@ -540,83 +169,25 @@
return;
}
- page_to_char(buf_string(ch->pcdata->buffer), ch);
+ sendpage(ch, buf_string(ch->pcdata->buffer));
clear_buf(ch->pcdata->buffer);
}
-/* RT chat replaced with ROM gossip */
-CH_CMD(do_gossip)
-{
- public_ch(ch, argument, CTAG(_GOSSIP1) "[Gossip]" CTAG(_GOSSIP2),
- COMM_NOGOSSIP, spec_public_flag, LAST_GOSSIP);
-}
-
-CH_CMD(do_ooc)
-{
- public_ch(ch, argument, "{C({WOOC{C){w", COMM_NOOOC, spec_public_flag,
- LAST_OOC);
-}
-
-CH_CMD(do_grats)
-{
- public_ch(ch, argument, CTAG(_GRATS1) "[Grats]" CTAG(_GRATS2), COMM_NOGRATS,
- spec_public_flag, LAST_GRATS);
-}
-
-CH_CMD(do_quote)
-{
- public_ch(ch, argument, CTAG(_QUOTE1) "[Quote]" CTAG(_QUOTE2), COMM_NOQUOTE,
- spec_public_flag, LAST_QUOTE);
-}
-
-/* RT question channel */
-CH_CMD(do_question)
-{
- public_ch(ch, argument, CTAG(_QA1) "[Question]" CTAG(_QA2), COMM_NOQUESTION,
- spec_public_flag, LAST_QA);
-}
-
-/* RT answer channel - uses same line as questions */
-CH_CMD(do_answer)
-{
- public_ch(ch, argument, CTAG(_QA1) "[Answer]" CTAG(_QA2), COMM_NOQUESTION,
- spec_public_flag, LAST_QA);
-}
-
-/* RT music channel */
-CH_CMD(do_music)
-{
- public_ch(ch, argument,
- CTAG(_MUSIC1) "[" CTAG(_MUSIC2) "MUSIC" CTAG(_MUSIC1) "]"
- CTAG(_MUSIC3), COMM_NOMUSIC, spec_public_flag, LAST_MUSIC);
-}
-
/* clan channels */
CH_CMD(do_clantalk)
{
- char buf[MSL];
-
if (!is_clan(ch) || ch->clan->independent)
{
chprintln(ch, "You aren't in a clan.");
return;
}
- sprintf(buf, "%s{W (%s)", ch->clan->who_name,
- ch->clan->rank[ch->rank].rankname);
- public_ch(ch, argument, buf, COMM_NOCLAN, spec_clan_flag, LAST_CLANTALK);
-}
-
-CH_CMD(do_immtalk)
-{
- public_ch(ch, argument,
- CTAG(_IMMTALK1) "[" CTAG(_IMMTALK2) "ImmTalk" CTAG(_IMMTALK1) "]"
- CTAG(_IMMTALK3), COMM_NOWIZ, spec_imm_flag, LAST_IMMTALK);
+ public_ch(ch, argument, gcn_clan);
}
CH_CMD(do_say)
{
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintln(ch, "Say what?");
return;
@@ -667,7 +238,7 @@
{
DESCRIPTOR_DATA *d;
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
set_on_off(ch, &ch->comm, COMM_SHOUTSOFF, "You can hear shouts again.",
"You will no longer hear shouts.");
@@ -694,6 +265,7 @@
if (d->connected == CON_PLAYING && d->character != ch &&
!IS_SET(victim->comm, COMM_SHOUTSOFF) &&
+ !is_ignoring(victim, ch->name, IGNORE_CHANNELS) &&
!IS_SET(victim->comm, COMM_QUIET))
{
act("" CTAG(_SHOUT1) "$n shouts '" CTAG(_SHOUT2) "$t"
@@ -706,8 +278,9 @@
CH_CMD(do_tell)
{
- char arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH];
+ char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
+ char buf[MSL];
if (IS_SET(ch->comm, COMM_NOTELL) || IS_SET(ch->comm, COMM_DEAF))
{
@@ -729,7 +302,7 @@
argument = one_argument(argument, arg);
- if (arg[0] == '\0' || argument[0] == '\0')
+ if (IS_NULLSTR(arg) || IS_NULLSTR(argument))
{
chprintln(ch, "Tell whom what?");
return;
@@ -746,13 +319,19 @@
return;
}
+ if (is_ignoring(victim, ch->name, IGNORE_TELLS))
+ {
+ act_new("$N doesn't seem to be listening to you.", ch, NULL, victim,
+ TO_CHAR, POS_DEAD);
+ 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);
+ bprintlnf(victim->pcdata->buffer, "%s tells you '%s'\n\r",
+ PERS(ch, victim), argument);
return;
}
@@ -778,18 +357,18 @@
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);
+ act("$E is AFK ($t), but your tell will go through when $E returns.",
+ ch, victim->pcdata->afk_msg, victim, TO_CHAR);
+ bprintlnf(victim->pcdata->buffer, "%s tells you '%s'\n\r",
+ PERS(ch, victim), argument);
return;
}
- act("" CTAG(_TELLS1) "You tell $N '" CTAG(_TELLS2) "$t"
- CTAG(_TELLS1) "'{x", ch, argument, victim, TO_CHAR);
- act_new("" CTAG(_TELLS1) "$n tells you '" CTAG(_TELLS2) "$t"
- CTAG(_TELLS1) "'{x", ch, argument, victim, TO_VICT, POS_DEAD);
+ act_new(CTAG(_TELLS1) "You tell $N '" CTAG(_TELLS2) "$t"
+ CTAG(_TELLS1) "'{x", ch, argument, victim, TO_CHAR, POS_DEAD);
+ sprintf(buf, CTAG(_TELLS1) MXPTAG("Tell '%s'") "$n" MXPTAG("/Tell")
+ " tells you '" CTAG(_TELLS2) "$t" CTAG(_TELLS1) "'{x", ch->name);
+ act_new(buf, ch, argument, victim, TO_VICT, POS_DEAD);
victim->reply = ch;
if (!IS_NPC(ch) && IS_NPC(victim) && HAS_TRIGGER_MOB(victim, TRIG_SPEECH))
@@ -802,7 +381,7 @@
CH_CMD(do_reply)
{
CHAR_DATA *victim;
- char buf[MAX_STRING_LENGTH];
+ char buf[MSL];
if (IS_SET(ch->comm, COMM_NOTELL))
{
@@ -816,13 +395,19 @@
return;
}
+ if (is_ignoring(victim, ch->name, IGNORE_TELLS))
+ {
+ act_new("$N doesn't seem to be listening to you.", ch, NULL, victim,
+ TO_CHAR, POS_DEAD);
+ 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);
+ bprintlnf(victim->pcdata->buffer, "%s tells you '%s'\n\r",
+ PERS(ch, victim), argument);
return;
}
@@ -856,16 +441,18 @@
}
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);
+ ("$E is AFK ($t), but your tell will go through when $E returns.",
+ ch, victim->pcdata->afk_msg, victim, TO_CHAR, POS_DEAD);
+ bprintlnf(victim->pcdata->buffer, "%s tells you '%s'", PERS(ch, victim),
+ argument);
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);
+ act_new(CTAG(_TELLS1) "You tell $N '" CTAG(_TELLS2) "$t"
+ CTAG(_TELLS1) "'{x", ch, argument, victim, TO_CHAR, POS_DEAD);
+ sprintf(buf, CTAG(_TELLS1) MXPTAG("Tell '%s'") "$n" MXPTAG("/Tell")
+ " tells you '" CTAG(_TELLS2) "$t" CTAG(_TELLS1) "'{x", ch->name);
+ act_new(buf, ch, argument, victim, TO_VICT, POS_DEAD);
victim->reply = ch;
return;
@@ -881,7 +468,7 @@
return;
}
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintln(ch, "Yell what?");
return;
@@ -893,6 +480,7 @@
if (d->connected == CON_PLAYING && d->character != ch &&
d->character->in_room != NULL &&
d->character->in_room->area == ch->in_room->area &&
+ !is_ignoring(d->character, ch->name, IGNORE_CHANNELS) &&
!IS_SET(d->character->comm, COMM_QUIET))
{
act("$n yells '$t'", ch, argument, d->character, TO_VICT);
@@ -910,7 +498,7 @@
return;
}
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintln(ch, "Emote what?");
return;
@@ -936,7 +524,7 @@
return;
}
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintln(ch, "Emote what?");
return;
@@ -1126,7 +714,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Follow whom?");
return;
@@ -1176,7 +764,7 @@
{
if (ch->master != NULL)
{
- bug("Add_follower: non-null master.", 0);
+ bug("Add_follower: non-null master.");
return;
}
@@ -1195,7 +783,7 @@
{
if (ch->master == NULL)
{
- bug("Stop_follower: null master.", 0);
+ bug("Stop_follower: null master.");
return;
}
@@ -1278,7 +866,7 @@
return;
}
- if (arg[0] == '\0' || argument[0] == '\0')
+ if (IS_NULLSTR(arg) || IS_NULLSTR(argument))
{
chprintln(ch, "Order whom to do what?");
return;
@@ -1350,7 +938,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
CHAR_DATA *gch;
CHAR_DATA *leader;
@@ -1441,7 +1029,7 @@
argument = one_argument(argument, arg1);
one_argument(argument, arg2);
- if (arg1[0] == '\0')
+ if (IS_NULLSTR(arg1))
{
chprintln(ch, "Split how much?");
return;
@@ -1449,7 +1037,7 @@
amount_silver = atoi(arg1);
- if (arg2[0] != '\0')
+ if (!IS_NULLSTR(arg2))
amount_gold = atoi(arg2);
if (amount_gold < 0 || amount_silver < 0)
@@ -1549,7 +1137,7 @@
{
CHAR_DATA *gch;
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintln(ch, "Tell your group what?");
return;
@@ -1617,34 +1205,32 @@
return;
}
-int attribute_lookup(const char *arg)
+const struct colour_type *get_col_table(int type)
{
- int i;
-
- for (i = 0; colour_attributes[i].name != NULL; i++)
- if (!str_prefix(arg, colour_attributes[i].name))
- return i;
-
- return -1;
+ switch (type)
+ {
+ case CT_ATTR:
+ return colour_attributes;
+ case CT_FORE:
+ return colour_foregrounds;
+ case CT_BACK:
+ return colour_backgrounds;
+ default:
+ bug("bad type");
+ return NULL;
+ }
}
-int foreground_lookup(const char *arg)
+int ctype_lookup(const char *arg, int type)
{
int i;
+ const struct colour_type *table = get_col_table(type);
- for (i = 0; colour_foregrounds[i].name != NULL; i++)
- if (!str_prefix(arg, colour_foregrounds[i].name))
- return i;
+ if (!table)
+ return -1;
- return -1;
-}
-
-int background_lookup(const char *arg)
-{
- int i;
-
- for (i = 0; colour_backgrounds[i].name != NULL; i++)
- if (!str_prefix(arg, colour_backgrounds[i].name))
+ for (i = 0; table[i].name != NULL; i++)
+ if (!str_prefix(arg, table[i].name))
return i;
return -1;
@@ -1661,11 +1247,11 @@
{
for (i = 0; i < MAX_CUSTOM_COLOUR; i++)
{
- ch->pcdata->colour[cslot_table[i].slot][0] =
+ ch->pcdata->colour[cslot_table[i].slot][CT_ATTR] =
cslot_table[i].col_attr;
- ch->pcdata->colour[cslot_table[i].slot][1] =
+ ch->pcdata->colour[cslot_table[i].slot][CT_FORE] =
cslot_table[i].col_fore;
- ch->pcdata->colour[cslot_table[i].slot][2] =
+ ch->pcdata->colour[cslot_table[i].slot][CT_BACK] =
cslot_table[i].col_back;
}
}
@@ -1675,9 +1261,9 @@
{
if (cslot_table[i].slot == slot)
{
- ch->pcdata->colour[slot][0] = cslot_table[i].col_attr;
- ch->pcdata->colour[slot][1] = cslot_table[i].col_fore;
- ch->pcdata->colour[slot][2] = cslot_table[i].col_back;
+ ch->pcdata->colour[slot][CT_ATTR] = cslot_table[i].col_attr;
+ ch->pcdata->colour[slot][CT_FORE] = cslot_table[i].col_fore;
+ ch->pcdata->colour[slot][CT_BACK] = cslot_table[i].col_back;
break;
}
}
@@ -1688,7 +1274,7 @@
const char *char_colour(CHAR_DATA * ch, int slot)
{
- extern int col_attr, col_fore, col_back;
+ EXTERN int col_attr, col_fore, col_back;
if (!ch || !ch->desc || IS_NPC(ch) || slot < 0 || slot >= MAX_CUSTOM_COLOUR)
{
@@ -1698,9 +1284,9 @@
return CL_DEFAULT;
}
- col_attr = ch->pcdata->colour[slot][0];
- col_fore = ch->pcdata->colour[slot][1];
- col_back = ch->pcdata->colour[slot][2];
+ col_attr = ch->pcdata->colour[slot][CT_ATTR];
+ col_fore = ch->pcdata->colour[slot][CT_FORE];
+ col_back = ch->pcdata->colour[slot][CT_BACK];
return make_colour();
}
@@ -1832,27 +1418,27 @@
return;
}
- if ((c_attr = attribute_lookup(attr)) == -1)
+ if ((c_attr = ctype_lookup(attr, CT_ATTR)) == -1)
{
chprintln(ch, "Invalid Colour Attribute.");
return;
}
- if ((c_fore = foreground_lookup(fore)) == -1)
+ if ((c_fore = ctype_lookup(fore, CT_FORE)) == -1)
{
chprintln(ch, "Invalid Foreground Colour.");
return;
}
- if ((c_back = background_lookup(back)) == -1)
+ if ((c_back = ctype_lookup(back, CT_BACK)) == -1)
{
chprintln(ch, "Invalid background Colour.");
return;
}
- ch->pcdata->colour[slot][0] = colour_attributes[c_attr].col_type;
- ch->pcdata->colour[slot][1] = colour_foregrounds[c_fore].col_type;
- ch->pcdata->colour[slot][2] = colour_backgrounds[c_back].col_type;
+ ch->pcdata->colour[slot][CT_ATTR] = colour_attributes[c_attr].col_type;
+ ch->pcdata->colour[slot][CT_FORE] = colour_foregrounds[c_fore].col_type;
+ ch->pcdata->colour[slot][CT_BACK] = colour_backgrounds[c_back].col_type;
chprintlnf(ch, "%s set to %s%s %s, with %s background{x.",
cslot_table[slot].name, char_colour(ch, slot),
colour_attributes[c_attr].name,
@@ -1862,6 +1448,17 @@
}
}
+flag_t ignore_bit(flag_t info)
+{
+ switch (info)
+ {
+ case INFO_LEVEL:
+ return IGNORE_LEVELS;
+ default:
+ return IGNORE_ANNOUNCE;
+ }
+}
+
void announce(CHAR_DATA * ch, flag_t bit, const char *message, ...)
{
DESCRIPTOR_DATA *d;
@@ -1870,6 +1467,9 @@
bool Private = FALSE;
va_list args;
+ if (IS_NULLSTR(message))
+ return;
+
va_start(args, message);
vsnprintf(buf2, sizeof(buf2), message, args);
va_end(args);
@@ -1915,7 +1515,7 @@
if (ch == NULL)
chprintln(och, buf);
- else
+ else if (!is_ignoring(och, ch->name, ignore_bit(bit)))
act_new(buf, ch, NULL, och, TO_VICT, POS_DEAD);
}
}
@@ -1923,7 +1523,7 @@
{
if (!ch)
{
- bug("NULL ch in private announce", 0);
+ bug("NULL ch in private announce");
return;
}
chprintln(ch, buf);
diff -ur -x config -x o -x rom src/act_enter.c new/act_enter.c
--- src/act_enter.c Tue May 27 02:46:35 2003
+++ new/act_enter.c Sun Aug 31 19:23:20 2003
@@ -22,17 +22,10 @@
* By using this code, you have agreed to follow the terms of the *
* ROM license, in the file Rom24/doc/rom.license *
***************************************************************************
-* 1stMUD ROM Derivative (c) 2001-2002 by Ryan Jennings *
+* 1stMUD ROM Derivative (c) 2001-2003 by Ryan Jennings *
* http://1stmud.dlmud.com/ <r-jenn@shaw.ca> *
***************************************************************************/
-#include <sys/types.h>
-#if !defined(WIN32)
-#include <sys/time.h>
-#endif
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
#include "merc.h"
#include "interp.h"
#include "lookup.h"
@@ -74,7 +67,7 @@
return;
/* nifty portal stuff */
- if (argument[0] != '\0')
+ if (!IS_NULLSTR(argument))
{
ROOM_INDEX_DATA *old_room;
OBJ_DATA *portal;
diff -ur -x config -x o -x rom src/act_info.c new/act_info.c
--- src/act_info.c Tue May 27 02:46:35 2003
+++ new/act_info.c Sun Aug 31 19:23:20 2003
@@ -22,19 +22,10 @@
* By using this code, you have agreed to follow the terms of the *
* ROM license, in the file Rom24/doc/rom.license *
***************************************************************************
-* 1stMUD ROM Derivative (c) 2001-2002 by Ryan Jennings *
+* 1stMUD ROM Derivative (c) 2001-2003 by Ryan Jennings *
* http://1stmud.dlmud.com/ <r-jenn@shaw.ca> *
***************************************************************************/
-#include <sys/types.h>
-#if !defined(WIN32)
-#include <sys/time.h>
-#endif
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <time.h>
#include "merc.h"
#include "interp.h"
#include "magic.h"
@@ -43,41 +34,37 @@
#include "lookup.h"
char *const where_name[] = {
- "<used as light> ",
- "<worn on finger> ",
- "<worn on finger> ",
- "<worn around neck> ",
- "<worn around neck> ",
- "<worn on torso> ",
- "<worn on head> ",
- "<worn on legs> ",
- "<worn on feet> ",
- "<worn on hands> ",
- "<worn on arms> ",
- "<worn as shield> ",
- "<worn about body> ",
- "<worn about waist> ",
- "<worn around wrist> ",
- "<worn around wrist> ",
- "<wielded> ",
- "<held> ",
- "<floating nearby> ",
- "<secondary weapon> "
+ "{g<{Wused as light{g>{x ",
+ "{g<{Wworn on finger{g>{x ",
+ "{g<{Wworn on finger{g>{x ",
+ "{g<{Wworn around neck{g>{x ",
+ "{g<{Wworn around neck{g>{x ",
+ "{g<{Wworn on torso{g>{x ",
+ "{g<{Wworn on head{g>{x ",
+ "{g<{Wworn on legs{g>{x ",
+ "{g<{Wworn on feet{g>{x ",
+ "{g<{Wworn on hands{g>{x ",
+ "{g<{Wworn on arms{g>{x ",
+ "{g<{Wworn as shield{g>{x ",
+ "{g<{Wworn about body{g>{x ",
+ "{g<{Wworn about waist{g>{x ",
+ "{g<{Wworn around wrist{g>{x ",
+ "{g<{Wworn around wrist{g>{x ",
+ "{g<{Wwielded{g>{x ",
+ "{g<{Wheld{g>{x ",
+ "{g<{Wfloating nearby{g>{x ",
+ "{g<{Wsecondary weapon{g>{x "
};
-/* 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));
+PROTOTYPE(char *format_obj_to_char, (OBJ_DATA *, CHAR_DATA *, bool));
+PROTOTYPE(void show_list_to_char, (OBJ_DATA *, CHAR_DATA *, bool, bool));
+PROTOTYPE(void show_char_to_char_0, (CHAR_DATA *, CHAR_DATA *));
+PROTOTYPE(void show_char_to_char_1, (CHAR_DATA *, CHAR_DATA *));
+PROTOTYPE(void show_char_to_char, (CHAR_DATA *, CHAR_DATA *));
+PROTOTYPE(bool check_blind, (CHAR_DATA *));
char *format_obj_to_char(OBJ_DATA * obj, CHAR_DATA * ch, bool fShort)
{
@@ -86,8 +73,7 @@
buf[0] = '\0';
if ((fShort &&
- (obj->short_descr == NULL || obj->short_descr[0] == '\0')) ||
- (obj->description == NULL || obj->description[0] == '\0'))
+ IS_NULLSTR(obj->short_descr)) || IS_NULLSTR(obj->description))
return buf;
if (IS_OBJ_STAT(obj, ITEM_INVIS))
@@ -127,7 +113,6 @@
void show_list_to_char(OBJ_DATA * list, CHAR_DATA * ch, bool fShort,
bool fShowNothing)
{
- char buf[MAX_STRING_LENGTH];
BUFFER *output;
const char **prgpstrShow;
int *prgnShow;
@@ -208,16 +193,14 @@
{
if (prgnShow[iShow] != 1)
{
- sprintf(buf, "(%2d) ", prgnShow[iShow]);
- add_buf(output, buf);
+ bprintf(output, "(%2d) ", prgnShow[iShow]);
}
else
{
- add_buf(output, " ");
+ bprint(output, " ");
}
}
- add_buf(output, prgpstrShow[iShow]);
- add_buf(output, "\n\r");
+ bprintln(output, prgpstrShow[iShow]);
free_string(prgpstrShow[iShow]);
}
@@ -227,7 +210,7 @@
chprint(ch, " ");
chprintln(ch, "Nothing.");
}
- page_to_char(buf_string(output), ch);
+ sendpage(ch, buf_string(output));
/*
* Clean up.
@@ -281,7 +264,8 @@
strcat(buf, "{Y({RGquest{Y){x ");
}
- if (victim->position == victim->start_pos && victim->long_descr[0] != '\0')
+ if (victim->position == victim->start_pos
+ && !IS_NULLSTR(victim->long_descr))
{
strcat(buf, victim->long_descr);
chprint(ch, buf);
@@ -415,6 +399,8 @@
else
strcat(buf, "someone who left??");
break;
+ default:
+ break;
}
buf[0] = UPPER(buf[0]);
@@ -441,7 +427,7 @@
}
}
- if (victim->description[0] != '\0')
+ if (!IS_NULLSTR(victim->description))
{
chprint(ch, victim->description);
}
@@ -480,7 +466,8 @@
found = FALSE;
for (iWear = 0; iWear < MAX_WEAR; iWear++)
{
- if ((obj = get_eq_char(victim, iWear)) != NULL && can_see_obj(ch, obj))
+ if ((obj = get_eq_char(victim, (wloc_t) iWear)) != NULL
+ && can_see_obj(ch, obj))
{
if (!found)
{
@@ -544,50 +531,114 @@
return TRUE;
}
-/* changes your scroll */
-CH_CMD(do_scroll)
+int get_scr_cols(CHAR_DATA * ch)
{
- char arg[MAX_INPUT_LENGTH];
- int lines;
+ unsigned int len;
- one_argument(argument, arg);
+ if (!ch)
+ len = DEFAULT_SCR_WIDTH;
+ else if (ch->columns <= 10)
+ len = SCR_WIDTH(ch->desc);
+ else
+ len = ch->columns;
+
+ return len - 2;
+}
+
+int get_scr_lines(CHAR_DATA * ch)
+{
+ unsigned int len;
- if (arg[0] == '\0')
+ if (!ch)
+ len = DEFAULT_SCR_HEIGHT;
+ else if (!ch->lines)
+ len = SCR_HEIGHT(ch->desc);
+ else
+ len = ch->lines;
+
+ return len - 2;
+}
+
+CH_CMD(do_screen)
+{
+ char arg1[MIL], arg2[MIL];
+ unsigned int lines;
+ int *plines;
+ char *func;
+ unsigned int def_lines;
+
+ argument = one_argument(argument, arg1);
+ one_argument(argument, arg2);
+
+ if (IS_NULLSTR(arg1) || IS_NULLSTR(arg2))
{
- if (ch->lines == 0)
+ if (get_scr_lines(ch) < 0)
chprintln(ch, "You do not page long messages.");
else
{
- chprintlnf(ch,
- "You currently display %d lines per page.",
- ch->lines + 2);
+ chprintlnf(ch, "You currently display %d lines per page.",
+ get_scr_lines(ch));
+ }
+ chprintlnf(ch, "\n\rYou currently display %d columns per line.",
+ get_scr_cols(ch));
+ chprintln(ch, "\n\rSyntax: screen lines|columns <#val|default>");
+ chprintlnf(ch,
+ " (type 'screen lines none' to disable scrolling)");
+ return;
+ }
+ if (!str_prefix(arg1, "lines"))
+ {
+ if (!str_cmp(arg2, "none") || atoi(arg2) < 0)
+ {
+ ch->lines = -1;
+ chprintln
+ (ch,
+ "Scrolling disabled. This may cause you to disconnect on long outputs.");
+ return;
}
+ plines = &ch->lines;
+ func = "lines";
+ def_lines = SCR_HEIGHT(ch->desc);
+ }
+ else if (!str_prefix(arg1, "columns"))
+ {
+ plines = &ch->columns;
+ func = "columns";
+ def_lines = SCR_WIDTH(ch->desc);
+ }
+ else
+ {
+ do_screen(ch, "");
return;
}
- if (!is_number(arg))
+ if (!str_cmp(arg2, "default"))
{
- chprintln(ch, "You must provide a number.");
+ *plines = def_lines;
+ chprintlnf(ch, "You're screen now displays %d %s.", def_lines, func);
return;
}
-
- lines = atoi(arg);
-
- if (lines == 0)
+ else if (!is_number(arg2))
{
- chprintln(ch, "Paging disabled.");
- ch->lines = 0;
+ chprintln(ch, "You must provide a number.");
return;
}
- if (lines < 10 || lines > 100)
+ lines = atoi(arg2);
+
+ if (lines < 10 || lines > 250)
{
chprintln(ch, "You must provide a reasonable number.");
return;
}
- chprintlnf(ch, "Scroll set to %d lines.", lines);
- ch->lines = lines - 2;
+ chprintlnf(ch, "Your screen now displays %d %s.", lines, func);
+ if (ch->desc && IS_SET(ch->desc->d_flags, DESC_TELOPT_NAWS)
+ && lines != def_lines)
+ chprintlnf
+ (ch, "The MUD has detected that you have %d screen %s.",
+ def_lines, func);
+ *plines = lines;
}
/* RT does socials */
@@ -774,14 +825,21 @@
{
char buf[MAX_STRING_LENGTH];
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
set_on_off(ch, &ch->comm, COMM_PROMPT, "You will now see prompts.",
"You will no longer see prompts.");
return;
}
- if (!str_cmp(argument, "all"))
+ else if (!str_prefix(argument, "autoprompt"))
+ {
+ set_on_off(ch, &ch->act, PLR_AUTOPROMPT,
+ "Prompts will now always show.",
+ "Prompts are now selectivly shown.");
+ return;
+ }
+ else if (!str_cmp(argument, "all"))
strcpy(buf, "<%hhp %mm %vmv> ");
else
{
@@ -794,8 +852,7 @@
}
- free_string(ch->prompt);
- ch->prompt = str_dup(buf);
+ replace_string(ch->prompt, buf);
chprintlnf(ch, "Prompt set to %s", ch->prompt);
return;
}
@@ -868,52 +925,6 @@
return FALSE;
}
-unsigned int get_line args((char *desc, unsigned int max_len));
-void reformat_desc args((char *desc));
-
-void show_desc(CHAR_DATA * ch, const char *desc)
-{
- static char buf[MSL * 2];
- static char out[MSL * 2];
- int width;
- unsigned int pos;
- char *p;
- bool alldesc = FALSE;
-
- width = 78;
-
- if (ch->desc != NULL && ch->desc->scr_width > 0)
- width = ch->desc->scr_width - 2;
-
- sprintf(buf, "%s", desc);
- reformat_desc(buf);
-
- p = &buf[0];
- pos = 0;
-
- out[0] = '\0';
-
- do
- {
- pos = get_line(p, width);
- if (pos > 0)
- {
- strncat(out, p, pos);
- p += pos;
- }
- else
- {
- strcat(out, p);
- alldesc = TRUE;
- }
- strcat(out, "\n\r");
- }
- while (!alldesc);
-
- chprint(ch, out);
- return;
-}
-
CH_CMD(do_look)
{
char buf[MAX_STRING_LENGTH];
@@ -958,10 +969,12 @@
number = number_argument(arg1, arg3);
count = 0;
- if (arg1[0] == '\0' || !str_cmp(arg1, "auto"))
+ if (IS_NULLSTR(arg1) || !str_cmp(arg1, "auto"))
{
/* 'look' or 'look auto' */
+ chprint(ch, MXPTAG("RName"));
chprintf(ch, "" CTAG(_RTITLE) "%s", ch->in_room->name);
+ chprint(ch, MXPTAG("/RName"));
if ((IS_IMMORTAL(ch) &&
(IS_NPC(ch) || IS_SET(ch->act, PLR_HOLYLIGHT))) ||
@@ -972,10 +985,11 @@
chprintln(ch, "{x");
- if (arg1[0] == '\0' || (!IS_NPC(ch) && !IS_SET(ch->comm, COMM_BRIEF)))
+ if (IS_NULLSTR(arg1) || (!IS_NPC(ch) && !IS_SET(ch->comm, COMM_BRIEF)))
{
if (is_last_run(ch))
{
+ chprint(ch, MXPTAG("RDesc"));
if (!IS_SET(ch->in_room->room_flags, ROOM_NOAUTOMAP)
&& !IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOMAP))
{
@@ -987,12 +1001,12 @@
}
else
{
- sprintf(buf, "%s%s{x",
- get_sector_color(ch->in_room->sector_type),
- IS_NULLSTR(ch->in_room->description) ?
- "No room description!" : ch->in_room->description);
- show_desc(ch, buf);
+ dwraplnf(ch->desc, "%s%s{x",
+ get_sector_color(ch->in_room->sector_type),
+ IS_NULLSTR(ch->in_room->description) ?
+ "No room description!" : ch->in_room->description);
}
+ chprint(ch, MXPTAG("/RDesc"));
}
}
@@ -1010,7 +1024,7 @@
if (!str_cmp(arg1, "i") || !str_cmp(arg1, "in") || !str_cmp(arg1, "on"))
{
/* 'look in' */
- if (arg2[0] == '\0')
+ if (IS_NULLSTR(arg2))
{
chprintln(ch, "Look in what?");
return;
@@ -1179,13 +1193,12 @@
return;
}
- if (pexit->description != NULL && pexit->description[0] != '\0')
+ if (!IS_NULLSTR(pexit->description))
chprint(ch, pexit->description);
else
chprintln(ch, "Nothing special there.");
- if (pexit->keyword != NULL && pexit->keyword[0] != '\0' &&
- pexit->keyword[0] != ' ')
+ if (!IS_NULLSTR(pexit->keyword) && pexit->keyword[0] != ' ')
{
if (IS_SET(pexit->exit_info, EX_CLOSED))
{
@@ -1214,7 +1227,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Examine what?");
return;
@@ -1289,7 +1302,7 @@
return;
if (fAuto)
- sprintf(buf, "[Exits:");
+ sprintf(buf, "[Exits:" MXPTAG("RExits"));
else if (IS_IMMORTAL(ch))
sprintf(buf, "Obvious exits from room %ld:\n\r", ch->in_room->vnum);
else
@@ -1306,8 +1319,9 @@
found = TRUE;
if (fAuto)
{
- strcat(buf, " ");
+ strcat(buf, " " MXPTAG("Ex"));
strcat(buf, dir_name[door]);
+ strcat(buf, MXPTAG("/Ex"));
}
else
{
@@ -1328,7 +1342,7 @@
strcat(buf, fAuto ? " none" : "None.\n\r");
if (fAuto)
- strcat(buf, "]");
+ strcat(buf, MXPTAG("/RExits") "]");
chprintln(ch, buf);
return;
@@ -1506,8 +1520,17 @@
case POS_FIGHTING:
chprintln(ch, "" CTAG(_SCORE1) "You are " CTAG(_SCORE3) "fighting.{x");
break;
+ default:
+ break;
}
+ if (IS_VALID_STANCE(GET_STANCE(ch, STANCE_AUTODROP)))
+ chprintlnf(ch,
+ CTAG(_SCORE1) "You auto-drop into the " CTAG(_SCORE3) "%s"
+ CTAG(_SCORE1) " stance. (" CTAG(_SCORE3) "%d%%" CTAG(_SCORE1)
+ "){x", get_stance_name(GET_STANCE(ch, STANCE_AUTODROP)),
+ GET_STANCE(ch, GET_STANCE(ch, STANCE_AUTODROP)));
+
/* print AC values */
if (ch->level >= 25)
{
@@ -1639,39 +1662,149 @@
CH_CMD(do_affects)
{
AFFECT_DATA *paf, *paf_last = NULL;
- char buf[MAX_STRING_LENGTH];
+ const char *buf4;
+ char buf3[MSL];
+ char buf2[MSL];
+ bool found = FALSE;
+ flag_t filter;
+ flag_t printme;
+ BUFFER *buffer;
+ OBJ_DATA *obj;
+ int iWear;
+
+ buffer = new_buf();
if (ch->first_affect != NULL)
{
- chprintln(ch, "You are affected by the following spells:");
+ bprintln(buffer, "You are affected by the following spells:{x");
+
for (paf = ch->first_affect; paf != NULL; paf = paf->next)
{
if (paf_last != NULL && paf->type == paf_last->type)
- if (ch->level >= 20)
- chprint(ch, " ");
+ {
+ if (get_trust(ch) >= 20)
+ bprint(buffer, " ");
else
continue;
+ }
else
- chprintf(ch, "Spell: %-15s", skill_table[paf->type].name);
+ bprintf(buffer, "{xSpell: {c%-19s{x",
+ (paf->type != -1
+ && !IS_NULLSTR(skill_table[paf->type].name))
+ ? skill_table[paf->type].name : "unknown");
- if (ch->level >= 20)
+ if (get_trust(ch) >= 20)
{
- sprintf(buf, ": modifies %s by %d ",
+ bprintf(buffer, ": {xmodifies %s by %d{x ",
flag_string(apply_flags, paf->location), paf->modifier);
- chprint(ch, buf);
if (paf->duration == -1)
- chprint(ch, "permanently");
+ bprint(buffer, "{xpermanently{x");
else
- chprintf(ch, "for %d hours", paf->duration);
+ bprintf(buffer, "{xfor %d hours{x", paf->duration);
}
- chprintln(ch, "");
+ bprintln(buffer, "");
paf_last = paf;
}
+ found = TRUE;
+ bprintln(buffer, "");
}
- else
- chprintln(ch, "You are not affected by any spells.");
+ if (ch->race->aff != 0 && IS_AFFECTED(ch, ch->race->aff))
+ {
+ bprintln(buffer,
+ "You are affected by the following racial abilities:{x");
+
+ strcpy(buf3, flag_string(affect_flags, ch->race->aff));
+ buf4 = buf3;
+ buf4 = one_argument(buf4, buf2);
+ while (buf2[0])
+ {
+ bprintlnf(buffer, "{xSpell: {c%-19s{x", buf2);
+ buf4 = one_argument(buf4, buf2);
+ }
+ found = TRUE;
+ bprintln(buffer, "");
+ }
+ if (ch->affected_by != 0 && (ch->affected_by != ch->race->aff))
+ {
+ bool print = FALSE;
+
+ for (iWear = 0; iWear < MAX_WEAR; iWear++)
+ {
+ if ((obj = get_eq_char(ch, (wloc_t) iWear)) != NULL)
+ {
+ for (paf = obj->first_affect; paf != NULL; paf = paf->next)
+ {
+ if (!IS_SET(ch->affected_by, paf->bitvector))
+ continue;
+
+ if (paf->where != TO_AFFECTS)
+ continue;
+
+ filter = paf->bitvector;
+ filter &= ch->affected_by;
+ printme = filter;
+ if (!print)
+ {
+ bprintln(buffer,
+ "You are affected by the following equipment spells:{x");
+ print = TRUE;
+ }
+
+ strcpy(buf3, flag_string(affect_flags, printme));
+ buf4 = buf3;
+ buf4 = one_argument(buf4, buf2);
+ while (buf2[0])
+ {
+ bprintlnf(buffer, "{xSpell: {c%-19s:{x %s", buf2,
+ obj->short_descr);
+ buf4 = one_argument(buf4, buf2);
+ }
+ }
+ if (!obj->enchanted)
+ {
+ for (paf = obj->pIndexData->first_affect; paf != NULL;
+ paf = paf->next)
+ {
+ if (!IS_SET(ch->affected_by, paf->bitvector))
+ continue;
+ if (paf->where != TO_AFFECTS)
+ continue;
+ filter = paf->bitvector;
+ filter &= ch->affected_by;
+ printme = filter;
+ if (!print)
+ {
+ bprintln(buffer,
+ "You are affected by the following equipment spells:{x");
+ print = TRUE;
+ }
+
+ strcpy(buf3, flag_string(affect_flags, printme));
+ buf4 = buf3;
+ buf4 = one_argument(buf4, buf2);
+ while (buf2[0])
+ {
+ bprintlnf(buffer, "{xSpell: {c%-19s:{x %s", buf2,
+ obj->short_descr);
+ buf4 = one_argument(buf4, buf2);
+ }
+ }
+ }
+ }
+ }
+ found = TRUE;
+ if (print)
+ bprintln(buffer, "");
+ }
+ if (!found)
+ {
+ bprintln(buffer, "You are not affected by any spells.{x");
+ }
+
+ sendpage(ch, buf_string(buffer));
+ free_buf(buffer);
return;
}
@@ -1680,7 +1813,7 @@
"the Great Gods", "the Sun"
};
-char *const month_name[] = {
+char *const month_name[NUM_MONTHS] = {
"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",
@@ -1689,7 +1822,6 @@
CH_CMD(do_time)
{
- extern char str_boot_time[];
char *suf;
int day;
@@ -1729,16 +1861,47 @@
(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]);
- chprintlnf(ch, "ROM started up at %s\n\rThe system time is %s.",
- str_boot_time, str_time(current_time, -1, NULL));
+ chprintlnf(ch,
+ MUD_NAME
+ " started up at %s\n\rWhich was %s ago.\n\rThe system time is %s.",
+ str_time(boot_time, -1, NULL), timestr(current_time - boot_time,
+ FALSE), str_time(-1, -1,
+ NULL));
- if (GET_TZONE(ch) != -1)
- chprintlnf(ch, "Your local time is %s",
- str_time(current_time, GET_TZONE(ch), NULL));
- else
- chprintln
- (ch,
- "Your local time is not set! Use the 'timezone' command to set your time zone.");
+ if (!IS_NPC(ch))
+ {
+ if (GET_TZONE(ch) != -1)
+ chprintlnf(ch, "Your local time is %s",
+ str_time(-1, GET_TZONE(ch), NULL));
+ else
+ chprintln
+ (ch,
+ "Your local time is not set! Use the 'timezone' command to set your time zone.");
+
+ // online time
+ chprintlnf(ch, "You connected at %s\n\rWhich was %s ago.",
+ str_time(ch->logon, GET_TZONE(ch), NULL),
+ timestr(current_time - ch->logon, FALSE));
+ // creation time
+ chprintlnf(ch, "You first created at %s\n\r"
+ "Which was %s ago.",
+ str_time(ch->id, GET_TZONE(ch), NULL),
+ timestr(current_time - ch->id, FALSE));
+
+ chprintlnf(ch, "You have played approximately %d.%02d hours.",
+ (ch->played + (int) (current_time - ch->logon)) / HOUR,
+ ((ch->played + (int) (current_time - ch->logon)) / 36) %
+ 100);
+
+ chprintlnf
+ (ch, "Which is %0.03f%% of the time since you created.",
+ ((double) (ch->played + (int) (current_time - ch->logon)) /
+ (double) (current_time - ch->id)) * 100.0);
+ }
+ if (crs_info.timer > -1 && crs_info.status != CRS_NONE)
+ {
+ chprintln(ch, crs_sprintf(TRUE, FALSE));
+ }
return;
}
@@ -1780,24 +1943,34 @@
CH_CMD(do_weather)
{
-
- static char *const sky_look[4] = {
- "cloudless",
- "cloudy",
- "rainy",
- "lit by flashes of lightning"
- };
+ char *combo = "", *single = "";
+ int temp, precip, wind;
if (!IS_OUTSIDE(ch))
{
- chprintln(ch, "You can't see the weather indoors.");
+ chprintln(ch, "You can't see the sky from here.");
return;
}
- chprintlnf(ch, "The sky is %s and %s.", sky_look[weather_info.sky],
- weather_info.change >=
- 0 ? "a warm southerly breeze blows" :
- "a cold northern gust blows");
+ temp = (ch->in_room->area->weather.temp + 3 * mud_info.weath_unit - 1) /
+ mud_info.weath_unit;
+ precip = (ch->in_room->area->weather.precip + 3 * mud_info.weath_unit - 1) /
+ mud_info.weath_unit;
+ wind = (ch->in_room->area->weather.wind + 3 * mud_info.weath_unit - 1) /
+ mud_info.weath_unit;
+
+ if (precip >= 3)
+ {
+ combo = preciptemp_msg[precip][temp];
+ single = wind_msg[wind];
+ }
+ else
+ {
+ combo = windtemp_msg[wind][temp];
+ single = precip_msg[precip];
+ }
+
+ chprintlnf(ch, "{B%s and %s.{x", combo, single);
return;
}
@@ -1818,7 +1991,6 @@
BUFFER *buffer;
BUFFER *related;
int counter = 0, number, count = 0;
- char buf[MSL];
if (IS_NULLSTR(argument))
argument = "summary";
@@ -1827,7 +1999,7 @@
while (!IS_NULLSTR(argument))
{
argument = one_argument(argument, argone);
- if (argall[0] != '\0')
+ if (!IS_NULLSTR(argall))
strcat(argall, " ");
strcat(argall, argone);
}
@@ -1850,76 +2022,65 @@
{
counter++;
- sprintf(buf, "%3d) %s\n\r", counter, pHelp->keyword);
- add_buf(buffer, buf);
+ bprintlnf(buffer, "%3d) "
+ MXPTAG("Help '%s'") "%s" MXPTAG("/Help"), counter,
+ pHelp->keyword, pHelp->keyword);
list = TRUE;
found = TRUE;
continue;
}
if (found)
{
- sprintf(buf, "%s, ", pHelp->keyword);
- add_buf(related, buf);
+ bprintf(buffer, "%s, ", pHelp->keyword);
continue;
}
if (++count == number)
{
- add_buf(buffer, draw_line(ch, "{m-{M-", 0));
- sprintf(buf, "\n\rHelp Keywords : %s\n\r", pHelp->keyword);
- add_buf(buffer, buf);
- add_buf(buffer, draw_line(ch, "{m-{M-", 0));
- add_buf(buffer, "\n\r");
+ bprintln(buffer, draw_line(ch, "{m-{M-", 0));
+ bprintlnf(buffer, "Help Keywords : %s", pHelp->keyword);
+ bprintln(buffer, draw_line(ch, "{m-{M-", 0));
if (pHelp->text[0] == '.')
- add_buf(buffer, pHelp->text + 1);
+ bprint(buffer, pHelp->text + 1);
else
- add_buf(buffer, pHelp->text);
- add_buf(buffer, draw_line(ch, "{m-{M-", 0));
- add_buf(buffer, "\n\r");
+ bprint(buffer, pHelp->text);
+ bprintln(buffer, draw_line(ch, "{m-{M-", 0));
found = TRUE;
}
else
{
- sprintf(buf, "%s, ", pHelp->keyword);
- add_buf(related, buf);
+ bprintf(related, MXPTAG("Help '%s'") "%s" MXPTAG("/Help") ", ",
+ pHelp->keyword, pHelp->keyword);
}
}
if (list)
{
- const char *text;
- char buf[MIL];
-
- text = str_dup(buf_string(buffer));
+ const char *text = str_dup(buf_string(buffer));
clear_buf(buffer);
- sprintf(buf, "Help files that start with the letter '%s'.\n\r",
- argall2);
- add_buf(buffer, buf);
- add_buf(buffer, draw_line(ch, "{m-{M-", 0));
- add_buf(buffer, "\n\r");
- add_buf(buffer, text);
- add_buf(buffer, draw_line(ch, "{m-{M-", 0));
- sprintf(buf, "\n\r%d total help files.\n\r", counter);
- add_buf(buffer, buf);
+ bprintlnf(buffer, "Help files that start with the letter '%s'.",
+ argall2);
+ bprintln(buffer, draw_line(ch, "{m-{M-", 0));
+ bprint(buffer, text);
+ bprintln(buffer, draw_line(ch, "{m-{M-", 0));
+ bprintlnf(buffer, "%d total help files.", counter);
free_string(text);
}
else if (!found)
{
- sprintf(buf,
- "No help found for %s. Try using just the first letter.\n\r",
- nohelp);
- add_buf(buffer, buf);
+ bprintlnf(buffer,
+ "No help found for %s. Try using just the first letter.\n\r",
+ nohelp);
sprintf(log_buf, "Missing Help: %s", nohelp);
wiznet(log_buf, ch, NULL, 0, 0, 0);
}
- else if (related->string != NULL && related->string[0] != '\0')
+ else if (!IS_NULLSTR(related->string))
{
related->string[strlen(related->string) - 2] = '.';
related->string[strlen(related->string) - 1] = '\0';
- sprintf(buf, "See Also : %s\n\r%s\n\r", buf_string(related),
- draw_line(ch, "{m-{M-", 0));
- add_buf(buffer, buf);
+ bprintlnf(buffer, "See Also : %s\n\r%s", buf_string(related),
+ draw_line(ch, "{m-{M-", 0));
}
- page_to_char(buf_string(buffer), ch);
+ sendpage(ch, buf_string(buffer));
free_buf(buffer);
free_buf(related);
}
@@ -1934,15 +2095,15 @@
output = new_buf();
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
argument = "summary";
/* this parts handles help a b so that it returns help 'a b' */
argall[0] = '\0';
- while (argument[0] != '\0')
+ while (!IS_NULLSTR(argument))
{
argument = one_argument(argument, argone);
- if (argall[0] != '\0')
+ if (!IS_NULLSTR(argall))
strcat(argall, " ");
strcat(argall, argone);
}
@@ -1958,21 +2119,20 @@
{
/* add seperator if found */
if (found)
- add_buf(output,
- "\n\r============================================================\n\r\n\r");
+ bprintln(output,
+ "\n\r============================================================\n\r");
if (pHelp->level >= 0 && str_cmp(argall, "imotd"))
{
- add_buf(output, pHelp->keyword);
- add_buf(output, "\n\r");
+ bprintln(output, pHelp->keyword);
}
/*
* Strip leading '.' to allow initial blanks.
*/
if (pHelp->text[0] == '.')
- add_buf(output, pHelp->text + 1);
+ bprint(output, pHelp->text + 1);
else
- add_buf(output, pHelp->text);
+ bprint(output, pHelp->text);
found = TRUE;
/* small hack :) */
if (ch->desc != NULL && ch->desc->connected != CON_PLAYING
@@ -1984,7 +2144,7 @@
if (!found)
chprintln(ch, "No help on that word.");
else
- page_to_char(buf_string(output), ch);
+ sendpage(ch, buf_string(output));
free_buf(output);
}
@@ -2010,23 +2170,24 @@
/*
* Format it up.
*/
- if (wch->pcdata->who_descr[0] != '\0' && wch->pcdata->who_descr != NULL)
+ if (!IS_NULLSTR(wch->pcdata->who_descr))
sprintf(block, "[%s] ",
- stringf(ch, 14, ALIGN_CENTER, NULL, wch->pcdata->who_descr));
+ stringf(ch, 12, ALIGN_CENTER, NULL, wch->pcdata->who_descr));
else
sprintf(block,
"[" CTAG(_WLEVEL) "%3.3s " CTAG(_WRACE) "%4.4s " CTAG(_WCLASS)
"%3.3s{x] ", high_level_name(wch->level, FALSE),
wch->race->name, class_who(wch));
- sprintf(buf, "%s%s%s%s%s%s%s%s%s%s%s%s\n\r", block,
+ sprintf(buf, "%s%s%s%s%s%s%s%s%s"
+ MXPTAG("Fwho '%s'") "%s" MXPTAG("/Fwho") "%s%s\n\r", block,
wch->incog_level >= LEVEL_HERO ? "(Incog) " : "",
wch->invis_level >= LEVEL_HERO ? "(Wizi) " : "",
IS_SET(wch->comm, COMM_AFK) ? "[AFK] " : "",
IS_QUESTOR(wch) ? "[Q] " : "",
ON_GQUEST(wch) ? "(GQuest) " : "", wch->war ? "(WAR) " :
"", IS_SET(wch->act, PLR_KILLER) ? "(KILLER) " : "",
- IS_SET(wch->act, PLR_THIEF) ? "(THIEF) " : "", wch->name,
+ IS_SET(wch->act, PLR_THIEF) ? "(THIEF) " : "", wch->name, wch->name,
IS_NPC(wch) ? "" : wch->pcdata->title, format_clan(wch));
return (buf);
}
@@ -2041,7 +2202,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "You must provide a name.");
return;
@@ -2065,7 +2226,7 @@
{
found = TRUE;
- add_buf(output, format_who(ch, wch));
+ bprint(output, format_who(ch, wch));
}
}
@@ -2075,17 +2236,16 @@
return;
}
- page_to_char(buf_string(output), ch);
+ sendpage(ch, buf_string(output));
free_buf(output);
}
CH_CMD(do_whowas)
{
char arg[MIL];
- char buf[MSL];
CHAR_DATA *victim;
bool fOld;
- FILE *fp;
+ READ_DATA *fp;
one_argument(argument, arg);
if (IS_NULLSTR(arg))
@@ -2107,8 +2267,7 @@
victim->pcdata = new_pcdata();
pload_default(victim);
fOld = FALSE;
- sprintf(buf, "%s%s", PLAYER_DIR, capitalize(arg));
- if ((fp = file_open(buf, "r")) != NULL)
+ if ((fp = open_read("%s%s", PLAYER_DIR, capitalize(arg))) != NULL)
{
fOld = TRUE;
@@ -2117,22 +2276,22 @@
char letter;
char *word;
- letter = fread_letter(fp);
+ letter = read_letter(fp);
if (letter == '*')
{
- fread_to_eol(fp);
+ read_to_eol(fp);
continue;
}
if (letter != '#')
{
- bug("do_whowas: # not found.", 0);
+ bug("do_whowas: # not found.");
break;
}
- word = fread_word(fp);
+ word = read_word(fp);
if (!str_cmp(word, "PLAYER"))
- fread_char(victim, fp);
+ read_char(victim, fp);
else if (!str_cmp(word, "PET"))
break;
else if (!str_cmp(word, "O"))
@@ -2142,10 +2301,9 @@
else
break;
}
+ close_read(fp);
}
- file_close(fp);
-
if (!fOld)
{
chprintln(ch, "No player by that name exists.");
@@ -2177,12 +2335,11 @@
CH_CMD(do_who)
{
char buf[MAX_STRING_LENGTH];
- char buf2[MAX_STRING_LENGTH];
BUFFER *output;
DESCRIPTOR_DATA *d;
int iClass;
- RACE_DATA *iRace;
- CLAN_DATA *iClan;
+ RACE_DATA *iRace = NULL;
+ CLAN_DATA *iClan = NULL;
int iLevelLower;
int iLevelUpper;
int nNumber;
@@ -2217,7 +2374,7 @@
char arg[MAX_STRING_LENGTH];
argument = one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
break;
else
searched = TRUE;
@@ -2296,8 +2453,8 @@
alloc_mem(charitems, struct s_charitem, ndesc);
- if (ndesc > max_on)
- max_on = ndesc;
+ if (ndesc > mud_info.max_online)
+ mud_info.max_online = ndesc;
/*
* Now show matching chars.
@@ -2305,8 +2462,7 @@
nMatch = 0;
buf[0] = '\0';
output = new_buf();
- add_buf(output, draw_line(ch, "{r-{R-", 0));
- add_buf(output, "\n\r");
+ bprintln(output, draw_line(ch, "{r-{R-", 0));
for (d = descriptor_first; d != NULL; d = d->next)
{
/*
@@ -2362,43 +2518,44 @@
for (j1 = 0; j1 < nMatch; j1++)
{
wch = charitems[j1].pch;
- add_buf(output, format_who(ch, wch));
+ bprint(output, format_who(ch, wch));
if (j1 == (immcount - imminvis - 1) && j1 != (nMatch - 1)
&& IS_IMMORTAL(wch))
{
- add_buf(output, draw_line(ch, "{r-{R-", 0));
- add_buf(output, "\n\r");
+ bprintln(output, draw_line(ch, "{r-{R-", 0));
}
}
free_mem(charitems);
- add_buf(output, draw_line(ch, "{r-{R-", 0));
- add_buf(output, "\n\r");
+ bprintln(output, draw_line(ch, "{r-{R-", 0));
if (searched)
{
- sprintf(buf2, "{WMatches found: {R%d{x\n\r", nMatch);
- add_buf(output, buf2);
+ bprintlnf(output, "{WMatches found: {R%d{x", nMatch);
}
else if (nMatch < (totalcount - imminvis))
{
- sprintf(buf2,
- "{WPlayers found: {R%d{W Most since boot: {R%d{W Invisible: {R%d{x\n\r",
- nMatch, max_on, (totalcount - nMatch - imminvis));
- add_buf(output, buf2);
+ bprintlnf(output,
+ "{WPlayers found: {R%d{W Most on ever: {R%d{W Invisible: {R%d{x",
+ nMatch, mud_info.max_online,
+ (totalcount - nMatch - imminvis));
}
else
{
- sprintf(buf2, "{WPlayers found: {R%d{W Most since boot: {R%d{x\n\r",
- totalcount - imminvis, max_on);
- add_buf(output, buf2);
+ bprintlnf(output, "{WPlayers found: {R%d{W Most on ever: {R%d{x",
+ totalcount - imminvis, mud_info.max_online);
}
if (!ON_GQUEST(ch) && gquest_info.minlevel < ch->level &&
gquest_info.maxlevel > ch->level)
- add_buf(output, "There is a Global Quest running you can join.\n\r");
- page_to_char(buf_string(output), ch);
+ bprintln(output, "{WThere is a Global Quest running you can join.{x");
+ if (crs_info.timer > -1 && crs_info.status != CRS_NONE)
+ {
+ bprintlnf(output, "{W%s{x", crs_sprintf(TRUE, FALSE));
+ }
+
+ sendpage(ch, buf_string(output));
free_buf(output);
free_mem(rgfClass);
return;
@@ -2415,20 +2572,22 @@
if (d->connected == CON_PLAYING && can_see(ch, d->character))
count++;
- max_on = UMAX(count, max_on);
+ mud_info.max_online = UMAX(count, mud_info.max_online);
- if (max_on == count)
- chprintlnf(ch,
- "There are %d characters on, the most so far today.", count);
+ if (mud_info.max_online == count)
+ chprintlnf(ch, "There are %d characters on, the most ever.", count);
else
chprintlnf(ch,
- "There are %d characters on, the most on today was %d.",
- count, max_on);
+ "There are %d characters on, the most on ever was %d.",
+ count, mud_info.max_online);
}
CH_CMD(do_inventory)
{
- chprintln(ch, "You are carrying:");
+ chprintlnf(ch,
+ "{YYou are carrying {W%d/%d{Y items with {W%ld/%d{Y weight:{x",
+ ch->carry_number, can_carry_n(ch), get_carry_weight(ch) / 10,
+ can_carry_w(ch) / 10);
show_list_to_char(ch->first_carrying, ch, TRUE, TRUE);
return;
}
@@ -2442,10 +2601,9 @@
for (iWear = 0; iWear < MAX_WEAR; iWear++)
{
chprint(ch, where_name[iWear]);
- if ((obj = get_eq_char(ch, iWear)) == NULL)
+ if ((obj = get_eq_char(ch, (wloc_t) iWear)) == NULL)
{
chprintln(ch, "nothing.");
- continue;
}
else if (can_see_obj(ch, obj))
{
@@ -2471,7 +2629,7 @@
argument = one_argument(argument, arg1);
argument = one_argument(argument, arg2);
- if (arg1[0] == '\0')
+ if (IS_NULLSTR(arg1))
{
chprintln(ch, "Compare what to what?");
return;
@@ -2483,7 +2641,7 @@
return;
}
- if (arg2[0] == '\0')
+ if (IS_NULLSTR(arg2))
{
for (obj2 = ch->first_carrying; obj2 != NULL; obj2 = obj2->next_content)
{
@@ -2562,6 +2720,8 @@
CH_CMD(do_credits)
{
do_function(ch, &do_oldhelp, "diku");
+ do_function(ch, &do_oldhelp, "ROM");
+ do_function(ch, &do_oldhelp, "1stMUD");
return;
}
@@ -2574,8 +2734,24 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
+ chprintlnf(ch, "You are in zone : %s", ch->in_room->area->name);
+ if (!IS_NULLSTR(ch->in_room->area->lvl_comment))
+ chprintlnf(ch, "Recomended Levels: [%-7s]",
+ ch->in_room->area->lvl_comment);
+ else
+ chprintlnf(ch, "Recomended Levels: [%03d %03d]",
+ ch->in_room->area->min_level,
+ ch->in_room->area->max_level);
+
+ chprintlnf(ch, "Author : [%-7s]", ch->in_room->area->credits);
+ if (IS_IMMORTAL(ch))
+ {
+ chprintlnf(ch, "Vnum Range : %ld to %ld",
+ ch->in_room->area->min_vnum,
+ ch->in_room->area->max_vnum);
+ }
chprintln(ch, "Players near you:");
found = FALSE;
for (d = descriptor_first; d; d = d->next)
@@ -2629,7 +2805,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Consider killing whom?");
return;
@@ -2674,7 +2850,7 @@
if (IS_NPC(ch))
{
- bug("Set_title: NPC.", 0);
+ bug("Set_title: NPC.");
return;
}
@@ -2689,8 +2865,7 @@
strcpy(buf, title);
}
- free_string(ch->pcdata->title);
- ch->pcdata->title = str_dup(buf);
+ replace_string(ch->pcdata->title, buf);
return;
}
@@ -2701,7 +2876,7 @@
if (IS_NPC(ch))
return;
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintln(ch, "Change your title to what?");
return;
@@ -2721,7 +2896,7 @@
{
char buf[MAX_STRING_LENGTH];
- if (argument[0] != '\0')
+ if (!IS_NULLSTR(argument))
{
buf[0] = '\0';
smash_tilde(argument);
@@ -2731,7 +2906,7 @@
int len;
bool found = FALSE;
- if (ch->description == NULL || ch->description[0] == '\0')
+ if (IS_NULLSTR(ch->description))
{
chprintln(ch, "No lines left to remove.");
return;
@@ -2752,8 +2927,7 @@
else /* found the second one */
{
buf[len + 1] = '\0';
- free_string(ch->description);
- ch->description = str_dup(buf);
+ replace_string(ch->description, buf);
chprintln(ch, "Your description is:");
chprint(ch, ch->description ?
ch->description : "(None).\n\r");
@@ -2762,8 +2936,7 @@
}
}
buf[0] = '\0';
- free_string(ch->description);
- ch->description = str_dup(buf);
+ replace_string(ch->description, buf);
chprintln(ch, "Description cleared.");
return;
}
@@ -2784,8 +2957,7 @@
strcat(buf, argument);
strcat(buf, "\n\r");
- free_string(ch->description);
- ch->description = str_dup(buf);
+ replace_string(ch->description, buf);
}
chprintln(ch, "Your description is:");
@@ -2819,7 +2991,7 @@
if (IS_NPC(ch))
return;
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
int col;
@@ -2925,7 +3097,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
wimpy = ch->max_hit / 5;
else
wimpy = atoi(arg);
@@ -3001,7 +3173,7 @@
}
*pArg = '\0';
- if (arg1[0] == '\0' || arg2[0] == '\0')
+ if (IS_NULLSTR(arg1) || IS_NULLSTR(arg2))
{
chprintln(ch, "Syntax: password <old> <new>.");
return;
@@ -3033,8 +3205,7 @@
}
}
- free_string(ch->pcdata->pwd);
- ch->pcdata->pwd = str_dup(pwdnew);
+ replace_string(ch->pcdata->pwd, pwdnew);
save_char_obj(ch);
chprintln(ch, "Ok.");
return;
diff -ur -x config -x o -x rom src/act_move.c new/act_move.c
--- src/act_move.c Tue May 27 02:46:35 2003
+++ new/act_move.c Sun Aug 31 19:23:20 2003
@@ -22,17 +22,10 @@
* By using this code, you have agreed to follow the terms of the *
* ROM license, in the file Rom24/doc/rom.license *
***************************************************************************
-* 1stMUD ROM Derivative (c) 2001-2002 by Ryan Jennings *
+* 1stMUD ROM Derivative (c) 2001-2003 by Ryan Jennings *
* http://1stmud.dlmud.com/ <r-jenn@shaw.ca> *
***************************************************************************/
-#include <sys/types.h>
-#if !defined(WIN32)
-#include <sys/time.h>
-#endif
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
#include "merc.h"
#include "interp.h"
@@ -51,8 +44,8 @@
/*
* Local functions.
*/
-int find_door args((CHAR_DATA * ch, char *arg));
-bool has_key args((CHAR_DATA * ch, vnum_t key));
+PROTOTYPE(int find_door, (CHAR_DATA *, char *));
+PROTOTYPE(bool has_key, (CHAR_DATA *, vnum_t));
void move_char(CHAR_DATA * ch, int door, bool follow)
{
@@ -64,7 +57,7 @@
if (door < 0 || door > 5)
{
- bug("Do_move: bad door %d.", door);
+ bugf("Do_move: bad door %d.", door);
return;
}
@@ -193,6 +186,9 @@
ch->move -= move;
}
+ if (IS_VALID_STANCE(GET_STANCE(ch, STANCE_CURRENT)))
+ do_function(ch, &do_stance, "");
+
if (!IS_AFFECTED(ch, AFF_SNEAK) && ch->invis_level < LEVEL_HERO)
act("$n leaves $T.", ch, NULL, dir_name[door], TO_ROOM);
@@ -368,7 +364,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Open what?");
return;
@@ -479,7 +475,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Close what?");
return;
@@ -589,7 +585,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Lock what?");
return;
@@ -722,7 +718,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Unlock what?");
return;
@@ -856,7 +852,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Pick what?");
return;
@@ -1002,7 +998,7 @@
{
OBJ_DATA *obj = NULL;
- if (argument[0] != '\0')
+ if (!IS_NULLSTR(argument))
{
if (ch->position == POS_FIGHTING)
{
@@ -1104,6 +1100,8 @@
case POS_FIGHTING:
chprintln(ch, "You are already fighting!");
break;
+ default:
+ break;
}
return;
@@ -1120,7 +1118,7 @@
}
/* okay, now that we know we can rest, find an object to rest on */
- if (argument[0] != '\0')
+ if (!IS_NULLSTR(argument))
{
obj = get_obj_list(ch, argument, ch->in_room->first_content);
if (obj == NULL)
@@ -1242,6 +1240,8 @@
}
ch->position = POS_RESTING;
break;
+ default:
+ break;
}
return;
@@ -1258,7 +1258,7 @@
}
/* okay, now that we know we can sit, find an object to sit on */
- if (argument[0] != '\0')
+ if (!IS_NULLSTR(argument))
{
obj = get_obj_list(ch, argument, ch->in_room->first_content);
if (obj == NULL)
@@ -1368,6 +1368,8 @@
}
ch->position = POS_SITTING;
break;
+ default:
+ break;
}
return;
}
@@ -1385,7 +1387,7 @@
case POS_RESTING:
case POS_SITTING:
case POS_STANDING:
- if (argument[0] == '\0' && ch->on == NULL)
+ if (IS_NULLSTR(argument) && ch->on == NULL)
{
chprintln(ch, "You go to sleep.");
act("$n goes to sleep.", ch, NULL, NULL, TO_ROOM);
@@ -1393,7 +1395,7 @@
}
else /* find an object and sleep on it */
{
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
obj = ch->on;
else
obj = get_obj_list(ch, argument, ch->in_room->first_content);
@@ -1445,6 +1447,8 @@
case POS_FIGHTING:
chprintln(ch, "You are already fighting!");
break;
+ default:
+ break;
}
return;
@@ -1456,7 +1460,7 @@
CHAR_DATA *victim;
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
do_function(ch, &do_stand, "");
return;
@@ -1647,7 +1651,7 @@
return;
}
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintlnf(ch, "You have %d training sessions.", ch->train);
argument = "foo";
diff -ur -x config -x o -x rom src/act_obj.c new/act_obj.c
--- src/act_obj.c Tue May 27 02:46:35 2003
+++ new/act_obj.c Sun Aug 31 19:23:20 2003
@@ -22,17 +22,10 @@
* By using this code, you have agreed to follow the terms of the *
* ROM license, in the file Rom24/doc/rom.license *
***************************************************************************
-* 1stMUD ROM Derivative (c) 2001-2002 by Ryan Jennings *
+* 1stMUD ROM Derivative (c) 2001-2003 by Ryan Jennings *
* http://1stmud.dlmud.com/ <r-jenn@shaw.ca> *
***************************************************************************/
-#include <sys/types.h>
-#if !defined(WIN32)
-#include <sys/time.h>
-#endif
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
#include "merc.h"
#include "interp.h"
@@ -41,10 +34,10 @@
*/
#define CD CHAR_DATA
#define OD OBJ_DATA
-bool remove_obj args((CHAR_DATA * ch, int iWear, bool fReplace));
-CD *find_keeper args((CHAR_DATA * ch));
-int get_cost args((CHAR_DATA * keeper, OBJ_DATA * obj, bool fBuy));
-OD *get_obj_keeper args((CHAR_DATA * ch, CHAR_DATA * keeper, char *argument));
+PROTOTYPE(bool remove_obj, (CHAR_DATA *, int, bool));
+PROTOTYPE(CD * find_keeper, (CHAR_DATA *));
+PROTOTYPE(int get_cost, (CHAR_DATA *, OBJ_DATA *, bool));
+PROTOTYPE(OD * get_obj_keeper, (CHAR_DATA *, CHAR_DATA *, char *));
#undef OD
#undef CD
@@ -211,13 +204,13 @@
argument = one_argument(argument, arg2);
/* Get type. */
- if (arg1[0] == '\0')
+ if (IS_NULLSTR(arg1))
{
chprintln(ch, "Get what?");
return;
}
- if (arg2[0] == '\0')
+ if (IS_NULLSTR(arg2))
{
if (str_cmp(arg1, "all") && str_prefix("all.", arg1))
{
@@ -358,7 +351,7 @@
if (!str_cmp(arg2, "in") || !str_cmp(arg2, "on"))
argument = one_argument(argument, arg2);
- if (arg1[0] == '\0' || arg2[0] == '\0')
+ if (IS_NULLSTR(arg1) || IS_NULLSTR(arg2))
{
chprintln(ch, "Put what in what?");
return;
@@ -506,7 +499,7 @@
argument = one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Drop what?");
return;
@@ -677,7 +670,7 @@
argument = one_argument(argument, arg1);
argument = one_argument(argument, arg2);
- if (arg1[0] == '\0' || arg2[0] == '\0')
+ if (IS_NULLSTR(arg1) || IS_NULLSTR(arg2))
{
chprintln(ch, "Give what to whom?");
return;
@@ -701,7 +694,7 @@
silver = str_cmp(arg2, "gold");
argument = one_argument(argument, arg2);
- if (arg2[0] == '\0')
+ if (IS_NULLSTR(arg2))
{
chprintln(ch, "Give what to whom?");
return;
@@ -868,7 +861,7 @@
int percent, skill;
/* find out what */
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintln(ch, "Envenom what item?");
return;
@@ -950,7 +943,7 @@
af.type = gsn_poison;
af.level = ch->level * percent / 100;
af.duration = ch->level / 2 * percent / 100;
- af.location = 0;
+ af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = WEAPON_POISON;
affect_to_obj(obj, &af);
@@ -984,7 +977,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Fill what?");
return;
@@ -1051,7 +1044,7 @@
argument = one_argument(argument, arg);
- if (arg[0] == '\0' || argument[0] == '\0')
+ if (IS_NULLSTR(arg) || IS_NULLSTR(argument))
{
chprintln(ch, "Pour what into what?");
return;
@@ -1177,7 +1170,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
for (obj = ch->in_room->first_content; obj; obj = obj->next_content)
{
@@ -1215,7 +1208,7 @@
case ITEM_FOUNTAIN:
if ((liquid = obj->value[2]) < 0)
{
- bug("Do_drink: bad liquid number %d.", liquid);
+ bugf("Do_drink: bad liquid number %d.", liquid);
liquid = obj->value[2] = 0;
}
amount = liq_table[liquid].liq_affect[4] * 3;
@@ -1230,7 +1223,7 @@
if ((liquid = obj->value[2]) < 0)
{
- bug("Do_drink: bad liquid number %d.", liquid);
+ bugf("Do_drink: bad liquid number %d.", liquid);
liquid = obj->value[2] = 0;
}
@@ -1293,7 +1286,7 @@
OBJ_DATA *obj;
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Eat what?");
return;
@@ -1373,7 +1366,7 @@
/*
* Remove an object.
*/
-bool remove_obj(CHAR_DATA * ch, int iWear, bool fReplace)
+bool remove_obj(CHAR_DATA * ch, wloc_t iWear, bool fReplace)
{
OBJ_DATA *obj;
@@ -1445,7 +1438,7 @@
return;
}
- bug("Wear_obj: no free finger.", 0);
+ bug("Wear_obj: no free finger.");
chprintln(ch, "You already wear two rings.");
return;
}
@@ -1474,7 +1467,7 @@
return;
}
- bug("Wear_obj: no free neck.", 0);
+ bug("Wear_obj: no free neck.");
chprintln(ch, "You already wear two neck items.");
return;
}
@@ -1583,7 +1576,7 @@
return;
}
- bug("Wear_obj: no free wrist.", 0);
+ bug("Wear_obj: no free wrist.");
chprintln(ch, "You already wear two wrist items.");
return;
}
@@ -1710,7 +1703,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Wear, wield, or hold what?");
return;
@@ -1749,7 +1742,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Remove what?");
return;
@@ -1792,7 +1785,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0' || !str_cmp(arg, ch->name))
+ if (IS_NULLSTR(arg) || !str_cmp(arg, ch->name))
{
act("$n offers $mself to $g, who graciously declines.", ch,
NULL, NULL, TO_ROOM);
@@ -1801,6 +1794,17 @@
return;
}
+ if (!str_cmp(arg, "all"))
+ {
+ OBJ_DATA *next;
+
+ for (obj = ch->in_room->first_content; obj; obj = next)
+ {
+ next = obj->next_content;
+ do_sacrifice(ch, obj->name);
+ }
+ return;
+ }
obj = get_obj_list(ch, arg, ch->in_room->first_content);
if (obj == NULL)
{
@@ -1881,7 +1885,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Quaff what?");
return;
@@ -1954,7 +1958,7 @@
}
obj = NULL;
- if (arg2[0] == '\0')
+ if (IS_NULLSTR(arg2))
{
victim = ch;
}
@@ -2011,7 +2015,7 @@
if ((sn = staff->value[3]) < 0 || sn >= maxSkill ||
skill_table[sn].spell_fun == 0)
{
- bug("Do_brandish: bad sn %d.", sn);
+ bugf("Do_brandish: bad sn %d.", sn);
return;
}
@@ -2037,7 +2041,7 @@
switch (skill_table[sn].target)
{
default:
- bug("Do_brandish: bad target for sn %d.", sn);
+ bugf("Do_brandish: bad target for sn %d.", sn);
return;
case TAR_IGNORE:
@@ -2084,7 +2088,7 @@
OBJ_DATA *obj;
one_argument(argument, arg);
- if (arg[0] == '\0' && ch->fighting == NULL)
+ if (IS_NULLSTR(arg) && ch->fighting == NULL)
{
chprintln(ch, "Zap whom or what?");
return;
@@ -2103,7 +2107,7 @@
}
obj = NULL;
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
if (ch->fighting != NULL)
{
@@ -2179,7 +2183,7 @@
argument = one_argument(argument, arg1);
argument = one_argument(argument, arg2);
- if (arg1[0] == '\0' || arg2[0] == '\0')
+ if (IS_NULLSTR(arg1) || IS_NULLSTR(arg2))
{
chprintln(ch, "Steal what from whom?");
return;
@@ -2503,7 +2507,7 @@
char buf[MAX_STRING_LENGTH];
int cost, roll;
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintln(ch, "Buy what?");
return;
@@ -2530,7 +2534,7 @@
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);
+ bugf("Do_buy: bad pet shop at vnum %ld.", ch->in_room->vnum);
chprintln(ch, "Sorry, you can't buy that here.");
return;
}
@@ -2583,17 +2587,15 @@
pet->comm = COMM_NOTELL | COMM_NOSHOUT | COMM_NOCHANNELS;
argument = one_argument(argument, arg);
- if (arg[0] != '\0')
+ if (!IS_NULLSTR(arg))
{
sprintf(buf, "%s %s", pet->name, arg);
- free_string(pet->name);
- pet->name = str_dup(buf);
+ replace_string(pet->name, 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);
+ replace_string(pet->description, buf);
char_to_room(pet, ch->in_room);
add_follower(pet, ch);
@@ -2750,7 +2752,7 @@
if (pRoomIndexNext == NULL)
{
- bug("Do_list: bad pet shop at vnum %d.", ch->in_room->vnum);
+ bugf("Do_list: bad pet shop at vnum %ld.", ch->in_room->vnum);
chprintln(ch, "You can't do that here.");
return;
}
@@ -2788,9 +2790,14 @@
found = FALSE;
for (obj = keeper->first_carrying; obj; obj = obj->next_content)
{
+ int i = 0;
+ const char *p = obj->name;
+
+ for (; *p && !isspace(*p); p++, i++)
+ ;
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)))
+ (IS_NULLSTR(arg) || is_name(arg, obj->name)))
{
if (!found)
{
@@ -2799,8 +2806,10 @@
}
if (IS_OBJ_STAT(obj, ITEM_INVENTORY))
- chprintlnf(ch, "[%2d %5d -- ] %s",
- obj->level, cost, obj->short_descr);
+ chprintlnf(ch, "[%2d %5d -- ] "
+ MXPTAG("List '%.*s' '%s'") "%s" MXPTAG("/List"),
+ obj->level, cost, i, obj->name, obj->short_descr,
+ obj->short_descr);
else
{
count = 1;
@@ -2814,8 +2823,10 @@
obj = obj->next_content;
count++;
}
- chprintlnf(ch, "[%2d %5d %2d ] %s",
- obj->level, cost, count, obj->short_descr);
+ chprintlnf(ch, "[%2d %5d %2d ] "
+ MXPTAG("List '%.*s' '%s'") "%s" MXPTAG("/List"),
+ obj->level, cost, count, i, obj->name,
+ obj->short_descr, obj->short_descr);
}
}
}
@@ -2836,7 +2847,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Sell what?");
return;
@@ -2933,7 +2944,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Value what?");
return;
@@ -2982,7 +2993,7 @@
{
OBJ_DATA *obj;
- if (argument[0] == '\0') /* empty */
+ if (IS_NULLSTR(argument)) /* empty */
{
chprintln(ch, "Wear which weapon in your off-hand?");
return;
@@ -3072,7 +3083,7 @@
if (obj == NULL)
{
- bug("donate_object: NULL obj", 0);
+ bug("donate_object: NULL obj");
return;
}
@@ -3087,7 +3098,7 @@
if (!(container = get_donation_pit()))
{
- bug("donate_object: no donation pit!", 0);
+ bug("donate_object: no donation pit!");
extract_obj(obj);
}
else
@@ -3191,7 +3202,7 @@
void save_donation_pit(void)
{
OBJ_DATA *pit;
- FILE_DATA *fp;
+ WRITE_DATA *fp;
for (pit = object_first; pit; pit = pit->next)
{
@@ -3202,24 +3213,24 @@
if (!pit)
return;
- if ((fp = fopen_temp(PIT_FILE)) != NULL)
+ if ((fp = open_write(PIT_FILE)) != NULL)
{
if (pit->first_content)
- fwrite_obj(NULL, pit->first_content, fp->file, 0, "P");
- fprintf(fp->file, "#END\n");
- fflush(fp->file);
- fclose_temp(fp);
+ fwrite_obj(NULL, pit->first_content, fp->stream, 0, "P");
+ fprintf(fp->stream, "#END\n");
+ fflush(fp->stream);
+ close_write(fp);
}
}
void load_donation_pit(void)
{
- FILE *fp;
+ READ_DATA *fp;
int count;
- if ((fp = file_open(PIT_FILE, "r")) == NULL)
+ if ((fp = open_read(PIT_FILE)) == NULL)
{
- bug("load_donation_pit: " PIT_FILE " not found", 0);
+ bug("load_donation_pit: " PIT_FILE " not found");
}
else
{
@@ -3230,23 +3241,23 @@
char letter;
char *word;
- letter = fread_letter(fp);
+ letter = read_letter(fp);
if (letter == '*')
{
- fread_to_eol(fp);
+ read_to_eol(fp);
continue;
}
if (letter != '#')
{
- bug("load_donation_pit: # not found.", 0);
+ bug("load_donation_pit: # not found.");
break;
}
- word = fread_word(fp);
+ word = read_word(fp);
if ((!str_cmp(word, "P")))
{
- fread_obj(NULL, fp, TRUE);
+ read_obj(NULL, fp, TRUE);
count++;
if (count >= 100)
break;
@@ -3255,13 +3266,12 @@
break;
else
{
- bug("load_donation_pit: bad section.", 0);
+ bug("load_donation_pit: bad section.");
break;
}
}
+ close_read(fp);
}
-
- file_close(fp);
return;
}
diff -ur -x config -x o -x rom src/act_wiz.c new/act_wiz.c
--- src/act_wiz.c Tue May 27 02:46:35 2003
+++ new/act_wiz.c Sun Aug 31 19:23:20 2003
@@ -22,37 +22,24 @@
* By using this code, you have agreed to follow the terms of the *
* ROM license, in the file Rom24/doc/rom.license *
***************************************************************************
-* 1stMUD ROM Derivative (c) 2001-2002 by Ryan Jennings *
+* 1stMUD ROM Derivative (c) 2001-2003 by Ryan Jennings *
* http://1stmud.dlmud.com/ <r-jenn@shaw.ca> *
***************************************************************************/
-
-#include <sys/types.h>
-#if !defined(WIN32)
-#include <sys/time.h>
-#include <unistd.h>
-#else
-#include <io.h>
-#include <process.h>
-#endif
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
#include "merc.h"
#include "interp.h"
#include "recycle.h"
#include "tables.h"
#include "lookup.h"
#include "telnet.h"
-#if defined(WIN32)
-#include "../win32/winstuff.h"
-#endif
#include "webserver.h"
#include "magic.h"
+#include "tablesave.h"
+#include "signals.h"
/*
* Local functions.
*/
-ROOM_INDEX_DATA *find_location args((CHAR_DATA * ch, const char *arg));
+PROTOTYPE(ROOM_INDEX_DATA * find_location, (CHAR_DATA *, const char *));
CH_CMD(do_wiznet)
{
@@ -63,7 +50,7 @@
argument = one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, stringf
(ch, 0, ALIGN_CENTER, "-",
@@ -135,7 +122,7 @@
}
flag = wiznet_lookup(arg);
- if (flag == 0 || get_trust(ch) < wiznet_table[flag].level)
+ if (flag == -1 || get_trust(ch) < wiznet_table[flag].level)
{
chprintln(ch, "No such option.");
return;
@@ -148,10 +135,27 @@
CTAG(_WIZNET) " on wiznet.{x", wiznet_table[flag].name));
}
-void wiznet(char *string, CHAR_DATA * ch, OBJ_DATA * obj, flag_t flag,
- flag_t flag_skip, int min_level)
+void new_wiznet(CHAR_DATA * ch, OBJ_DATA * obj, flag_t flag,
+ flag_t flag_skip, int min_level, const char *format, ...)
{
DESCRIPTOR_DATA *d;
+ va_list args;
+ char string[MSL * 2];
+ int i;
+ const char *chan;
+
+ if (IS_NULLSTR(format))
+ return;
+
+ va_start(args, format);
+ vsnprintf(string, sizeof(string), format, args);
+ va_end(args);
+
+ for (i = 0; wiznet_table[i].name != NULL; i++)
+ if (wiznet_table[i].flag == flag)
+ break;
+
+ chan = wiznet_table[i].name == NULL ? "all" : wiznet_table[i].name;
for (d = descriptor_first; d != NULL; d = d->next)
{
@@ -164,7 +168,13 @@
&& get_trust(d->character) >= min_level && d->character != ch)
{
if (IS_SET(d->character->wiznet, WIZ_PREFIX))
- chprint(d->character, CTAG(_WIZNET) "--> ");
+ d_printf(d, CTAG(_WIZNET) "-%s-%s-> ", str_time(-1,
+ GET_TZONE
+ (d->character),
+ "%I:%M:%S"),
+ chan);
+ else
+ d_print(d, CTAG(_WIZNET), 0);
act_new(string, d->character, obj, ch, TO_CHAR, POS_DEAD);
}
}
@@ -181,7 +191,7 @@
argument = one_argument(argument, arg1);
argument = one_argument(argument, arg2);
- if (arg1[0] == '\0' || arg2[0] == '\0')
+ if (IS_NULLSTR(arg1) || IS_NULLSTR(arg2))
{
chprintln(ch, "Syntax: guild <char> <cln name>");
return;
@@ -302,7 +312,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Nochannel whom?");
return;
@@ -353,7 +363,7 @@
return;
}
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintln(ch, "Emote what?");
return;
@@ -437,7 +447,7 @@
{
smash_tilde(argument);
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintlnf(ch, "Your poofin is %s", ch->pcdata->bamfin);
return;
@@ -449,8 +459,7 @@
return;
}
- free_string(ch->pcdata->bamfin);
- ch->pcdata->bamfin = str_dup(argument);
+ replace_string(ch->pcdata->bamfin, argument);
chprintlnf(ch, "Your poofin is now %s", ch->pcdata->bamfin);
}
@@ -464,7 +473,7 @@
{
smash_tilde(argument);
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintlnf(ch, "Your poofout is %s", ch->pcdata->bamfout);
return;
@@ -476,8 +485,7 @@
return;
}
- free_string(ch->pcdata->bamfout);
- ch->pcdata->bamfout = str_dup(argument);
+ replace_string(ch->pcdata->bamfout, argument);
chprintlnf(ch, "Your poofout is now %s", ch->pcdata->bamfout);
}
@@ -490,7 +498,7 @@
CHAR_DATA *victim;
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Deny whom?");
return;
@@ -533,7 +541,7 @@
CHAR_DATA *victim;
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Disconnect whom?");
return;
@@ -577,7 +585,7 @@
}
}
- bug("Do_disconnect: desc not found.", 0);
+ bug("Do_disconnect: desc not found.");
chprintln(ch, "Descriptor not found!");
return;
}
@@ -591,7 +599,7 @@
argument = one_argument(argument, arg1);
argument = one_argument(argument, arg2);
- if (arg1[0] == '\0' || arg2[0] == '\0')
+ if (IS_NULLSTR(arg1) || IS_NULLSTR(arg2))
{
chprintln(ch, "Syntax: pardon <character> <killer|thief>.");
return;
@@ -639,7 +647,7 @@
{
DESCRIPTOR_DATA *d;
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintln(ch, "Global echo what?");
return;
@@ -662,7 +670,7 @@
{
DESCRIPTOR_DATA *d;
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintln(ch, "Local echo what?");
@@ -686,7 +694,7 @@
{
DESCRIPTOR_DATA *d;
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintln(ch, "Zone echo what?");
return;
@@ -712,7 +720,7 @@
argument = one_argument(argument, arg);
- if (argument[0] == '\0' || arg[0] == '\0')
+ if (IS_NULLSTR(argument) || IS_NULLSTR(arg))
{
chprintln(ch, "Personal echo what?");
return;
@@ -760,7 +768,7 @@
argument = one_argument(argument, arg1);
argument = one_argument(argument, arg2);
- if (arg1[0] == '\0')
+ if (IS_NULLSTR(arg1))
{
chprintln(ch, "Transfer whom (and where)?");
return;
@@ -784,7 +792,7 @@
/*
* Thanks to Grodyn for the optional location parameter.
*/
- if (arg2[0] == '\0')
+ if (IS_NULLSTR(arg2))
{
location = ch->in_room;
}
@@ -838,7 +846,7 @@
argument = one_argument(argument, arg);
- if (arg[0] == '\0' || argument[0] == '\0')
+ if (IS_NULLSTR(arg) || IS_NULLSTR(argument))
{
chprintln(ch, "At where what?");
return;
@@ -887,7 +895,7 @@
CHAR_DATA *rch;
int count = 0;
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintln(ch, "Goto where?");
return;
@@ -917,7 +925,7 @@
{
if (get_trust(rch) >= ch->invis_level)
{
- if (ch->pcdata != NULL && ch->pcdata->bamfout[0] != '\0')
+ if (ch->pcdata != NULL && !IS_NULLSTR(ch->pcdata->bamfout))
act("$t", ch, ch->pcdata->bamfout, rch, TO_VICT);
else
act("$n leaves in a swirling mist.", ch, NULL, rch, TO_VICT);
@@ -931,7 +939,7 @@
{
if (get_trust(rch) >= ch->invis_level)
{
- if (ch->pcdata != NULL && ch->pcdata->bamfin[0] != '\0')
+ if (ch->pcdata != NULL && !IS_NULLSTR(ch->pcdata->bamfin))
act("$t", ch, ch->pcdata->bamfin, rch, TO_VICT);
else
act("$n appears in a swirling mist.", ch, NULL, rch, TO_VICT);
@@ -947,7 +955,7 @@
ROOM_INDEX_DATA *location;
CHAR_DATA *rch;
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintln(ch, "Goto where?");
return;
@@ -972,7 +980,7 @@
{
if (get_trust(rch) >= ch->invis_level)
{
- if (ch->pcdata != NULL && ch->pcdata->bamfout[0] != '\0')
+ if (ch->pcdata != NULL && !IS_NULLSTR(ch->pcdata->bamfout))
act("$t", ch, ch->pcdata->bamfout, rch, TO_VICT);
else
act("$n leaves in a swirling mist.", ch, NULL, rch, TO_VICT);
@@ -986,7 +994,7 @@
{
if (get_trust(rch) >= ch->invis_level)
{
- if (ch->pcdata != NULL && ch->pcdata->bamfin[0] != '\0')
+ if (ch->pcdata != NULL && !IS_NULLSTR(ch->pcdata->bamfin))
act("$t", ch, ch->pcdata->bamfin, rch, TO_VICT);
else
act("$n appears in a swirling mist.", ch, NULL, rch, TO_VICT);
@@ -999,7 +1007,7 @@
/* RT to replace the 3 stat commands */
-CH_CMD(do_stat)
+CH_CMD(do_old_stat)
{
char arg[MAX_INPUT_LENGTH];
const char *string;
@@ -1008,7 +1016,7 @@
CHAR_DATA *victim;
string = one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Syntax:");
chprintln(ch, " stat <name>");
@@ -1072,7 +1080,7 @@
int door;
one_argument(argument, arg);
- location = (arg[0] == '\0') ? ch->in_room : find_location(ch, arg);
+ location = (IS_NULLSTR(arg)) ? ch->in_room : find_location(ch, arg);
if (location == NULL)
{
chprintln(ch, "No such location.");
@@ -1162,7 +1170,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Stat what?");
return;
@@ -1461,7 +1469,7 @@
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Stat whom?");
return;
@@ -1478,10 +1486,9 @@
chprintlnf(ch,
"Vnum: %ld Format: %s Race: %s Group: %d Sex: %s Room: %ld",
IS_NPC(victim) ? victim->pIndexData->vnum : 0,
- IS_NPC(victim) ? victim->
- pIndexData->new_format ? "new" : "old" : "pc",
- victim->race->name, IS_NPC(victim) ? victim->group : 0,
- sex_table[victim->sex].name,
+ IS_NPC(victim) ? victim->pIndexData->
+ new_format ? "new" : "old" : "pc", victim->race->name,
+ IS_NPC(victim) ? victim->group : 0, sex_table[victim->sex].name,
victim->in_room == NULL ? 0 : victim->in_room->vnum);
if (IS_NPC(victim))
@@ -1605,17 +1612,30 @@
chprintf(ch, "Short description: %s\n\rLong description: %s",
victim->short_descr,
- victim->long_descr[0] != '\0' ? victim->long_descr : "(none)\n\r");
+ !IS_NULLSTR(victim->long_descr) ? victim->
+ long_descr : "(none)\n\r");
if (IS_NPC(victim) && victim->spec_fun != 0)
{
chprintlnf(ch, "Mobile has special procedure %s.",
spec_name(victim->spec_fun));
}
- if (victim->desc != NULL && victim->desc->d_flags != 0)
+ if (victim->desc != NULL)
{
- chprintlnf(ch, "Descriptor Flags: %s",
- flag_string(desc_flags, victim->desc->d_flags));
+ if (victim->desc->d_flags != 0)
+ chprintlnf(ch, "Descriptor Flags: %s",
+ flag_string(desc_flags, victim->desc->d_flags));
+ if (!IS_NULLSTR(victim->desc->ttype))
+ chprintlnf(ch, "Terminal: %s", victim->desc->ttype);
+ if (victim->desc->bytes_normal != 0)
+ chprintlnf(ch, "Bytes Normal: %ld", victim->desc->bytes_normal);
+#if !defined(NO_MCCP)
+ if (victim->desc->out_compress && victim->desc->bytes_compressed != 0)
+ chprintlnf(ch, "Bytes Compressed: %ld",
+ victim->desc->bytes_compressed);
+ if (victim->desc->mccp_version != 0)
+ chprintlnf(ch, "MCCP version: %d", victim->desc->mccp_version);
+#endif
}
if (!IS_NPC(victim) && IS_SET(victim->act, PLR_QUESTOR))
{
@@ -1684,7 +1704,7 @@
string = one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Syntax:");
chprintln(ch, " vnum obj <name>");
@@ -1725,7 +1745,7 @@
bool found;
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Find whom?");
return;
@@ -1771,7 +1791,7 @@
bool found;
one_argument(argument, arg);
- if (arg[0] == '\0')
+ if (IS_NULLSTR(arg))
{
chprintln(ch, "Find what?");
return;
@@ -1809,7 +1829,6 @@
CH_CMD(do_owhere)
{
- char buf[MAX_INPUT_LENGTH];
BUFFER *buffer;
OBJ_DATA *obj;
OBJ_DATA *in_obj;
@@ -1822,7 +1841,7 @@
buffer = new_buf();
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
chprintln(ch, "Find what?");
return;
@@ -1842,19 +1861,16 @@
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 %ld]\n\r",
- number, obj->short_descr, PERS(in_obj->carried_by,
- ch),
- in_obj->carried_by->in_room->vnum);
+ bprintlnf(buffer, "%3d) %s is carried by %s [Room %ld]",
+ 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 %ld]\n\r", number,
- obj->short_descr, in_obj->in_room->name,
- in_obj->in_room->vnum);
+ bprintlnf(buffer, "%3d) %s is in %s [Room %ld]", 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);
+ bprintlnf(buffer, "%3d) %s is somewhere", number, obj->short_descr);
if (number >= max_found)
break;
@@ -1863,20 +1879,19 @@
if (!found)
chprintln(ch, "Nothing like that in heaven or earth.");
else
- page_to_char(buf_string(buffer), ch);
+ sendpage(ch, buf_string(buffer));
free_buf(buffer);
}
CH_CMD(do_mwhere)
{
- char buf[MAX_STRING_LENGTH];
BUFFER *buffer;
CHAR_DATA *victim;
bool found;
int count = 0;
- if (argument[0] == '\0')
+ if (IS_NULLSTR(argument))
{
DESCRIPTOR_DATA *d;
@@ -1893,20 +1908,19 @@
victim = d->character;
count++;
if (d->original != NULL)
- sprintf(buf,
- "%3d) %s (in the body of %s) is in %s [%ld]\n\r",
- count, d->original->name,
- victim->short_descr,
- victim->in_room->name, victim->in_room->vnum);
+ bprintlnf(buffer,
+ "%3d) %s (in the body of %s) is in %s [%ld]",
+ count, d->original->name,
+ victim->short_descr,
+ victim->in_room->name, victim->in_room->vnum);
else
- sprintf(buf, "%3d) %s is in %s [%ld]\n\r",
- count, victim->name,
- victim->in_room->name, victim->in_room->vnum);
- add_buf(buffer, buf);
+ bprintlnf(buffer, "%3d) %s is in %s [%ld]",
+ count, victim->name,
+ victim->in_room->name, victim->in_room->vnum);
}
}
- page_to_char(buf_string(buffer), ch);
+ sendpage(ch, buf_string(buffer));
free_buf(buffer);
return;
}
@@ -1919,39 +1933,237 @@
{
found = TRUE;
count++;
- sprintf(buf, "%3d) [%5ld] %-28s [%5ld] %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);
+ bprintlnf(buffer, "%3d) [%5ld] %-28s [%5ld] %s", count,
+ IS_NPC(victim) ? victim->pIndexData->vnum : 0,
+ IS_NPC(victim) ? victim->short_descr : victim->name,
+ victim->in_room->vnum, victim->in_room->name);
}
}
if (!found)
act("You didn't find any $T.", ch, NULL, argument, TO_CHAR);
else
- page_to_char(buf_string(buffer), ch);
+ sendpage(ch, buf_string(buffer));
free_buf(buffer);
return;
}
-void set_shutdown(bool down)
+long get_seconds(long value, const char *arg)
{
- extern bool merc_down;
+ if (is_number(arg))
+ return value * atol(arg);
+ else if (!str_prefix(arg, "seconds"))
+ return value * SECOND;
+ else if (!str_prefix(arg, "minutes"))
+ return value * MINUTE;
+ else if (!str_prefix(arg, "hours"))
+ return value * HOUR;
+ else if (!str_prefix(arg, "days"))
+ return value * DAY;
+ else
+ return value;
+}
- while (auction_first != NULL)
- reset_auc(auction_first, TRUE);
- save_donation_pit();
- save_gquest_data();
- save_war_data();
- do_asave(NULL, "changed");
-#if !defined(NO_WEB)
- if (WebUP)
- shutdown_web_server();
-#endif
- merc_down = down;
+const char *crs_type_name(crs_t type)
+{
+ switch (type)
+ {
+ case CRS_COPYOVER:
+ return "Copyover";
+ case CRS_REBOOT:
+ return "Reboot";
+ case CRS_SHUTDOWN:
+ return "Shutdown";
+ default:
+ return "Unknown";
+ }
+}
+
+PROTOTYPE(void copyover, (void));
+PROTOTYPE(void reboot_mud, (void));
+PROTOTYPE(void shutdown_mud, (void));
+
+void crs_fun(crs_t type)
+{ // Weeeeeeee
+ switch (type)
+ {
+ case CRS_COPYOVER:
+ copyover();
+ break;
+ case CRS_REBOOT:
+ reboot_mud();
+ break;
+ case CRS_SHUTDOWN:
+ shutdown_mud();
+ break;
+ default:
+ bug("crs_fun: bad type");
+ break;
+ }
+}
+
+void crs_update(void)
+{
+ if (crs_info.status == CRS_NONE || crs_info.timer <= 0)
+ return;
+
+ --crs_info.timer;
+
+ if (crs_info.timer % PULSE_PER_SECOND != 0)
+ return;
+
+ switch (crs_info.timer / PULSE_PER_SECOND)
+ {
+ case 0:
+ crs_fun(crs_info.status);
+ break;
+ case 1:
+ case 2:
+ case 3:
+ case 30:
+ case MINUTE:
+ case MINUTE * 3:
+ case MINUTE * 5:
+ case MINUTE * 10:
+ case MINUTE * 15:
+ case MINUTE * 20:
+ case MINUTE * 30:
+ announce(NULL, INFO_ALL, crs_sprintf(TRUE, FALSE));
+ break;
+ }
+}
+
+const char *format_pulse(int time)
+{
+ static char buf[5][100];
+ static int i;
+ char temp[100];
+ double timer = time / PULSE_PER_SECOND;
+
+ ++i;
+ i %= 5;
+
+ sprintf(temp, "%%.%sf %s%%s",
+ (timer < MINUTE
+ || (int) timer % MINUTE == 0) ? "" : "2",
+ timer >= MINUTE ? "minute" : "second");
+ sprintf(buf[i], temp, timer >= MINUTE ? timer / MINUTE : timer,
+ (timer == MINUTE || timer == 1) ? "" : "s");
+ return buf[i];
+}
+
+const char *crs_sprintf(bool pTime, bool reason)
+{
+ char buf[MSL];
+ const char *prstr;
+
+ if (crs_info.status == CRS_NONE || (pTime && crs_info.timer < 0))
+ return "";
+
+ if (reason)
+ prstr = crs_info.reason;
+ else
+ prstr = "";
+
+ if (pTime)
+ {
+ sprintf(buf, "%s by %s in %s.%s",
+ crs_type_name(crs_info.status),
+ !IS_NULLSTR(crs_info.who) ? crs_info.who : "System",
+ format_pulse(crs_info.timer), prstr);
+ }
+ else
+ {
+ sprintf(buf, "%s by %s.%s%s",
+ crs_type_name(crs_info.status),
+ !IS_NULLSTR(crs_info.who) ? crs_info.who : "System",
+ prstr,
+ crs_info.status == CRS_COPYOVER ? " Please wait....." : "");
+ }
+ return smash_colour(buf);
+}
+
+void do_crs(CHAR_DATA * ch, const char *argument, crs_t type)
+{
+ char arg[MIL], arg2[MIL];
+ int value = -1;
+ const char *cmd_name = crs_type_name(type);
+
+ argument = one_argument(argument, arg);
+
+ if (IS_NULLSTR(arg))
+ {
+ chprintlnf(ch, "Usage: %s now [reason]", cmd_name);
+ chprintlnf(ch, "Usage: %s <#value> <#mod> [reason]", cmd_name);
+ chprintlnf(ch, "Usage: %s cancel [why]", cmd_name);
+ chprintlnf(ch, "Usage: %s status", cmd_name);
+ return;
+ }
+
+ if (!str_cmp(arg, "cancel"))
+ {
+ crs_info.timer = -1;
+ replace_string(crs_info.who, "");
+ replace_string(crs_info.reason, "");
+ crs_info.status = CRS_NONE;
+ announce(ch, INFO_ALL, "$n has cancelled the %s.", cmd_name);
+ announce(ch, INFO_ALL | INFO_PRIVATE,
+ "You have cancelled the %s.", cmd_name);
+ return;
+ }
+
+ if (!str_cmp(arg, "status"))
+ {
+ if (crs_info.timer == -1 || crs_info.status != type)
+ chprintlnf(ch, "Automatic %s is inactive.", cmd_name);
+ else
+ chprintln(ch, crs_sprintf(TRUE, TRUE));
+ return;
+ }
+
+ if (!str_cmp(arg, "now"))
+ {
+ crs_info.status = type;
+ replace_string(crs_info.who,
+ (ch->invis_level > 0 ? "an Immortal" : ch->name));
+ if (!IS_NULLSTR(argument))
+ replace_string(crs_info.reason, FORMATF(" (%s)", argument));
+ crs_fun(crs_info.status);
+ return;
+ }
+
+ if (!str_cmp(arg, "random"))
+ value = number_range(60, 360);
+ else if (is_number(arg))
+ value = atoi(arg);
+ else
+ {
+ chprintln(ch, "Thats not a valid value.");
+ return;
+ }
+
+ argument = one_argument(argument, arg2);
+
+ if (IS_NULLSTR(arg2) || !is_name(arg2, "seconds minutes hours days"))
+ {
+ chprintlnf(ch, "Syntax: %s %d seconds/minutes/hours/days.", cmd_name,
+ value);
+ return;
+ }
+
+ value = get_seconds(value, arg2);
+ value *= PULSE_PER_SECOND;
+ crs_info.timer = value;
+
+ if (!IS_NULLSTR(argument))
+ replace_string(crs_info.reason, FORMATF(" (%s)", argument));
+
+ replace_string(crs_info.who,
+ (ch->invis_level > 0 ? "an Immortal" : ch->name));
+ crs_info.status = type;
+ announce(NULL, INFO_ALL, crs_sprintf(TRUE, FALSE));
}
CH_CMD(do_reboo)
@@ -1962,25 +2174,31 @@
CH_CMD(do_reboot)
{
- char buf[MAX_STRING_LENGTH];
+ do_crs(ch, argument, CRS_REBOOT);
+ return;
+}
+
+void reboot_mud(void)
+{
DESCRIPTOR_DATA *d, *d_next;
CHAR_DATA *vch;
- if (ch && ch->invis_level < LEVEL_HERO)
- {
- sprintf(buf, "Reboot by %s.", ch->name);
- do_function(ch, &do_echo, buf);
- }
- set_shutdown(TRUE);
+ logf(crs_sprintf(FALSE, TRUE));
+
for (d = descriptor_first; d != NULL; d = d_next)
{
d_next = d->next;
- vch = d->original ? d->original : d->character;
+ d_write(d, "\n\r", 2);
+ d_writShowing the first 100 KB of 1005.7 KB. Download the archive for the full file.