- Fixed oat and wat (thanks Rhade).

- Numerous social fixes (thanks Rhade, Fizban, and Amber).
- Removed do_insult.
- Cleaned up hedit formatting and fixed possible bug from editing a help file
  you can't view (thanks Rhade).
- Fixed cast ' ' so it won't cast armor (thanks Rhade).
--Rumble
This commit is contained in:
Rumble 2007-02-26 04:06:19 +00:00
parent 787c392e0a
commit f2bb44ceb1
13 changed files with 170 additions and 268 deletions

View file

@ -40,7 +40,6 @@ extern char *class_abbrevs[];
/* extern functions */
ACMD(do_action);
ACMD(do_insult);
bitvector_t find_class_bitvector(const char *arg);
int level_exp(int chclass, int level);
char *title_male(int chclass, int level);
@ -994,7 +993,7 @@ int search_help(char *argument, int level)
else
top = mid - 1;
}
return -1;
return NOWHERE;
}
ACMD(do_help)
@ -1020,9 +1019,8 @@ ACMD(do_help)
}
space_to_minus(argument);
mid = search_help(argument, GET_LEVEL(ch));
if (mid < 0) {
if ((mid = search_help(argument, GET_LEVEL(ch))) == NOWHERE) {
send_to_char(ch, "There is no help on that word.\r\n");
mudlog(NRM, MAX(LVL_IMPL, GET_INVIS_LEV(ch)), TRUE,
"%s tried to get help on %s", GET_NAME(ch), argument);
@ -1968,7 +1966,7 @@ ACMD(do_toggle)
if ((result = PRF_TOG_CHK(ch, PRF_AFK)))
act("$n is now away from $s keyboard.", TRUE, ch, 0, 0, TO_ROOM);
else {
act("$n has return to $s keyboard.", TRUE, ch, 0, 0, TO_ROOM);
act("$n has returned to $s keyboard.", TRUE, ch, 0, 0, TO_ROOM);
if (has_mail(GET_IDNUM(ch)))
send_to_char(ch, "You have mail waiting.\r\n");
}
@ -2092,7 +2090,7 @@ ACMD(do_commands)
if ((complete_cmd_info[i].minimum_level >= LVL_IMMORT) != wizhelp)
continue;
if (!wizhelp && socials != (complete_cmd_info[i].command_pointer == do_action || complete_cmd_info[i].command_pointer == do_insult))
if (!wizhelp && socials != (complete_cmd_info[i].command_pointer == do_action))
continue;
if (wizhelp && complete_cmd_info[i].command_pointer == do_action)

View file

@ -23,7 +23,6 @@
/* local functions */
int find_action(int cmd);
ACMD(do_action);
ACMD(do_insult);
void free_social_messages(void);
void free_action(struct social_messg *mess);
void free_command_list(void);
@ -108,55 +107,6 @@ ACMD(do_action)
}
}
ACMD(do_insult)
{
char arg[MAX_INPUT_LENGTH];
struct char_data *victim;
one_argument(argument, arg);
if (*arg) {
if (!(victim = get_char_vis(ch, arg, NULL, FIND_CHAR_ROOM)))
send_to_char(ch, "Can't hear you!\r\n");
else {
if (victim != ch) {
send_to_char(ch, "You insult %s.\r\n", GET_NAME(victim));
switch (rand_number(0, 2)) {
case 0:
if (GET_SEX(ch) == SEX_MALE) {
if (GET_SEX(victim) == SEX_MALE)
act("$n accuses you of fighting like a woman!", FALSE, ch, 0, victim, TO_VICT);
else
act("$n says that women can't fight.", FALSE, ch, 0, victim, TO_VICT);
} else { /* Ch == Woman */
if (GET_SEX(victim) == SEX_MALE)
act("$n accuses you of having the smallest... (brain?)",
FALSE, ch, 0, victim, TO_VICT);
else
act("$n tells you that you'd lose a beauty contest against a troll.",
FALSE, ch, 0, victim, TO_VICT);
}
break;
case 1:
act("$n calls your mother a bitch!", FALSE, ch, 0, victim, TO_VICT);
break;
default:
act("$n tells you to get lost!", FALSE, ch, 0, victim, TO_VICT);
break;
} /* end switch */
act("$n insults $N.", TRUE, ch, 0, victim, TO_NOTVICT);
} else { /* ch == victim */
send_to_char(ch, "You feel insulted.\r\n");
}
}
} else
send_to_char(ch, "I'm sure you don't want to insult *everybody*...\r\n");
}
/* this function adds in the loaded socials and assigns them a command # */
void create_command_list(void)
{
@ -237,7 +187,6 @@ void free_social_messages(void)
free_action(mess);
}
free(soc_mess_list);
}
void free_action(struct social_messg *mess) {

View file

@ -14,7 +14,7 @@
#include "interpreter.h" /* alias_data */
cpp_extern const char *circlemud_version =
"tbaMUD, version 3.51";
"tbaMUD, version 3.52";
cpp_extern const char *oasisolc_version =
"OasisOLC 2.0.6";

View file

@ -726,33 +726,40 @@ OCMD(do_osetval)
/* submitted by PurpleOnyx - tkhasi@shadowglen.com*/
OCMD(do_oat)
{
char location[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
int vnum = 0, rnum = 0;
obj_data *object;
room_rnum loc = NOWHERE;
struct char_data *ch;
struct obj_data *object;
char arg[MAX_INPUT_LENGTH], *command;
half_chop(argument, location, arg2);
command = any_one_arg(argument, arg);
if (!*location || !*arg2 || !isdigit(*location)) {
obj_log(obj, "oat: bad syntax : %s", argument);
return;
if (!*arg) {
obj_log(obj, "oat called with no args");
return;
}
vnum = atoi(location);
rnum = real_room(vnum);
skip_spaces(&command);
if (rnum == NOWHERE) {
obj_log(obj, "oat: location not found");
return;
if (!*command) {
obj_log(obj, "oat called without a command");
return;
}
object = read_object(GET_OBJ_VNUM(obj), VIRTUAL);
if (!object)
if (isdigit(*arg)) loc = real_room(atoi(arg));
else if ((ch = get_char_by_obj(obj, arg))) loc = IN_ROOM(ch);
if (loc == NOWHERE) {
obj_log(obj, "oat: location not found (%s)", arg);
return;
}
if (!(object = read_object(GET_OBJ_VNUM(obj), VIRTUAL)))
return;
obj_to_room(object, rnum);
obj_command_interpreter(object, arg2);
obj_to_room(object, loc);
obj_command_interpreter(object, command);
if (object->in_room == rnum)
if (object->in_room == loc)
extract_obj(object);
}

View file

@ -560,26 +560,34 @@ WCMD(do_wdamage) {
script_damage(ch, dam);
}
WCMD(do_wat)
{
room_rnum loc = NOWHERE;
struct char_data *ch;
char arg[MAX_INPUT_LENGTH], *command;
WCMD(do_wat) {
char location[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
int vnum = 0;
room_data *r2;
command = any_one_arg(argument, arg);
half_chop(argument, location, arg2);
if (!*arg) {
wld_log(room, "wat called with no args");
return;
}
if (!*location || !*arg2 || !isdigit(*location)) {
wld_log(room, "wat: bad syntax");
return;
}
vnum = atoi(location);
if (NOWHERE == real_room(vnum)) {
wld_log(room, "wat: location not found");
return;
}
skip_spaces(&command);
r2 = &world[real_room(vnum)];
wld_command_interpreter(r2, arg2);
if (!*command) {
wld_log(room, "wat called without a command");
return;
}
if (isdigit(*arg)) loc = real_room(atoi(arg));
else if ((ch = get_char_by_room(room, arg))) loc = IN_ROOM(ch);
if (loc == NOWHERE) {
wld_log(room, "wat: location not found (%s)", arg);
return;
}
wld_command_interpreter(&world[loc], command);
}
const struct wld_command_info wld_cmd_info[] = {

View file

@ -6,7 +6,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "comm.h"
#include "interpreter.h"
@ -75,9 +74,9 @@ void load_help(FILE *fl, char *name)
/* If we ran out of buffer space, eat the rest of the entry. */
while (*line != '#')
get_one_line(fl, line);
}
if (*line == '#'){
if (*line == '#') {
if (sscanf(line, "#%d", &el.min_level) != 1){
log("SYSERR: Help entry does not have a min level. %s", key);
el.min_level = 0;
@ -113,7 +112,7 @@ ACMD(do_oasis_hedit)
int i;
if (!can_edit_zone(ch, HEDIT_PERMISSION)) {
send_to_char(ch, "You don't have access to editing Help files.\r\n");
send_to_char(ch, "You don't have access to editing help files.\r\n");
return;
}
@ -140,25 +139,21 @@ ACMD(do_oasis_hedit)
return;
}
/*
* Give descriptor an OLC structure.
*/
/* Give descriptor an OLC structure. */
if (d->olc) {
mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_oasis: Player already had olc structure.");
free(d->olc);
}
CREATE(d->olc, struct oasis_olc_data, 1);
CREATE(d->olc, struct oasis_olc_data, 1);
OLC_NUM(d) = 0;
OLC_STORAGE(d) = strdup(argument);
OLC_ZNUM(d) = search_help(OLC_STORAGE(d), GET_LEVEL(ch));
OLC_ZNUM(d) = search_help(OLC_STORAGE(d), LVL_IMPL);
for(i = 0; i < (int)strlen(argument); i++)
argument[i] = toupper(argument[i]);
if (OLC_ZNUM(d) <= 0)
if (OLC_ZNUM(d) == NOWHERE)
hedit_setup_new(d, OLC_STORAGE(d));
else
hedit_setup_existing(d, OLC_ZNUM(d));
@ -170,11 +165,7 @@ ACMD(do_oasis_hedit)
mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s starts editing help files.", GET_NAME(d->character));
}
/*------------------------------------------------------------------------*\
Utils and exported functions.
\*------------------------------------------------------------------------*/
/* Utils and exported functions. */
void hedit_setup_new(struct descriptor_data *d, char *new_key)
{
CREATE(OLC_HELP(d), struct help_index_element, 1);
@ -186,32 +177,22 @@ void hedit_setup_new(struct descriptor_data *d, char *new_key)
OLC_VAL(d) = 0;
}
/*------------------------------------------------------------------------*/
void hedit_setup_existing(struct descriptor_data *d, int rnum)
{
/*
* Build a copy of the help entry for editing.
*/
/* Build a copy of the help entry for editing.*/
CREATE(OLC_HELP(d), struct help_index_element, 1);
/*
* Allocate space for all strings.
*/
/* Allocate space for all strings. */
OLC_HELP(d)->keywords = strdup(help_table[rnum].keywords ?
help_table[rnum].keywords : "UNDEFINED\r\n");
OLC_HELP(d)->entry = strdup(help_table[rnum].entry ?
help_table[rnum].entry : "undefined\r\n");
OLC_HELP(d)->min_level = help_table[rnum].min_level;
/*
* Attach copy of help entry to player's descriptor.
*/
/* Attach copy of help entry to player's descriptor. */
OLC_VAL(d) = 0;
hedit_disp_menu(d);
}
/*------------------------------------------------------------------------*/
void hedit_save_internally(struct descriptor_data *d)
{
struct help_index_element *new_help_table = NULL;
@ -230,7 +211,6 @@ void hedit_save_internally(struct descriptor_data *d)
hedit_save_to_disk(d);
}
/*------------------------------------------------------------------------*/
void hedit_save_to_disk(struct descriptor_data *d)
{
FILE *fp;
@ -249,37 +229,26 @@ void hedit_save_to_disk(struct descriptor_data *d)
strncpy(buf1, help_table[i].entry ? help_table[i].entry : "Empty\n\r", sizeof(buf1) - 1);
strip_cr(buf1);
/*
* Forget making a buffer, lets just write the thing now.
*/
/* Forget making a buffer, lets just write the thing now. */
fprintf(fp, "%s" "#%d\n", buf1, help_table[i].min_level);
}
/*
* Write final line and close.
*/
/* Write final line and close. */
fprintf(fp, "$~\n");
fclose(fp);
do_reboot(d->character, strcpy(buf, "xhelp"), 0, 0);
}
/**************************************************************************
Menu functions
**************************************************************************/
/*
* The main menu.
*/
/* Menu functions */
/* The main menu. */
void hedit_disp_menu(struct descriptor_data *d)
{
clear_screen(d);
write_to_output(d,
"\r\n@c-------------------------------------------------------------------------@n\r\n"
" @CHelpfile Editor@n \r\n"
"@c-------------------------------------------------------------------------@n\r\n"
"@g1@n) Keyword [@G%-12s@g]@n\r\n"
"@g2@n) Entry : \n@y%s\r\n"
"@g3@n) Min Level : @c%d@n\r\n"
"-- Help file editor\r\n"
"1) Keywords : %s\r\n"
"2) Entry :\r\n%s"
"@g3@n) Min Level : @c%d@n\r\n"
"@gQ@n) Quit\r\n"
"Enter choice : ",
@ -290,17 +259,13 @@ void hedit_disp_menu(struct descriptor_data *d)
OLC_MODE(d) = HEDIT_MAIN_MENU;
}
/**************************************************************************
The main loop
**************************************************************************/
/* The main loop */
void hedit_parse(struct descriptor_data *d, char *arg)
{
char buf[MAX_STRING_LENGTH];
char *oldtext = '\0';
int number;
switch (OLC_MODE(d)) {
case HEDIT_CONFIRM_SAVESTRING:
switch (*arg) {
@ -310,16 +275,12 @@ void hedit_parse(struct descriptor_data *d, char *arg)
mudlog(TRUE, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), CMP, buf);
write_to_output(d, "Help files saved to disk.\r\n");
hedit_save_internally(d);
/*
* Do NOT free strings! Just the help structure.
*/
/* Do NOT free strings! Just the help structure. */
cleanup_olc(d, CLEANUP_STRUCTS);
break;
case 'n':
case 'N':
/*
* Free everything up, including strings, etc.
*/
/* Free everything up, including strings, etc. */
cleanup_olc(d, CLEANUP_ALL);
break;
default:
@ -378,9 +339,7 @@ void hedit_parse(struct descriptor_data *d, char *arg)
break;
case HEDIT_ENTRY:
/*
* We will NEVER get here, we hope.
*/
/* We will NEVER get here, we hope. */
mudlog(TRUE, LVL_BUILDER, BRF, "SYSERR: Reached HEDIT_ENTRY case in parse_hedit");
break;
@ -395,15 +354,11 @@ void hedit_parse(struct descriptor_data *d, char *arg)
return;
default:
/*
* We should never get here.
*/
/* We should never get here. */
mudlog(TRUE, LVL_BUILDER, BRF, "SYSERR: Reached default case in parse_hedit");
break;
}
/*
* If we get this far, something has been changed.
*/
/* If we get this far, something has been changed. */
OLC_VAL(d) = 1;
hedit_disp_menu(d);
}
@ -415,7 +370,7 @@ void hedit_string_cleanup(struct descriptor_data *d, int terminator)
default:
hedit_disp_menu(d);
break;
}
}
}
ACMD(do_helpcheck)
@ -431,7 +386,7 @@ ACMD(do_helpcheck)
for (i = 1; *(complete_cmd_info[i].command) != '\n'; i++) {
if (complete_cmd_info[i].command_pointer != do_action) {
if (search_help((char *) complete_cmd_info[i].command, GET_LEVEL(ch)) < 0) {
if (search_help((char *) complete_cmd_info[i].command, LVL_IMPL) == NOWHERE) {
nlen = snprintf(buf + len, sizeof(buf) - len, " %-20.20s%s",
complete_cmd_info[i].command, (++count % 3 ? "|":"\r\n"));
if (len + nlen >= sizeof(buf) || nlen < 0)
@ -449,7 +404,6 @@ ACMD(do_helpcheck)
*buf = '\0';
}
ACMD(do_hindex)
{
int len, count = 0, i;
@ -488,19 +442,18 @@ void free_help(struct help_index_element *help)
free(help);
}
void free_help_table(void)
{
int i;
int i;
if (help_table) {
for (i = 0; i <= top_of_h_table; i++) {
if (help_table[i].keywords)
free(help_table[i].keywords);
if (help_table[i].entry && !help_table[i].duplicate)
free(help_table[i].entry);
}
free(help_table);
if (help_table) {
for (i = 0; i <= top_of_h_table; i++) {
if (help_table[i].keywords)
free(help_table[i].keywords);
if (help_table[i].entry && !help_table[i].duplicate)
free(help_table[i].entry);
}
top_of_h_table = 0;
free(help_table);
}
top_of_h_table = 0;
}

View file

@ -118,7 +118,6 @@ ACMD(do_helpcheck);
ACMD(do_hide);
ACMD(do_hit);
ACMD(do_house);
ACMD(do_insult);
ACMD(do_inventory);
ACMD(do_invis);
ACMD(do_kick);
@ -351,7 +350,6 @@ cpp_extern const struct command_info cmd_info[] = {
{ "imotd" , "imo" , POS_DEAD , do_gen_ps , LVL_IMMORT, SCMD_IMOTD },
{ "immlist" , "imm" , POS_DEAD , do_gen_ps , 0, SCMD_IMMLIST },
{ "info" , "info" , POS_SLEEPING, do_gen_ps , 0, SCMD_INFO },
{ "insult" , "insult" , POS_RESTING , do_insult , 0, 0 },
{ "invis" , "invi" , POS_DEAD , do_invis , LVL_IMMORT, 0 },
{ "junk" , "j" , POS_RESTING , do_drop , 0, SCMD_JUNK },

View file

@ -49,7 +49,7 @@
#define PFDEF_HUNGER 0
#define PFDEF_THIRST 0
#define PFDEF_DRUNK 0
#define PFDEF_OLC 65535
#define PFDEF_OLC NOWHERE
#define PFDEF_PAGELENGTH 22
#endif

View file

@ -542,10 +542,12 @@ ACMD(do_cast)
}
t = strtok(NULL, "\0");
skip_spaces(&s);
/* spellnum = search_block(s, spells, 0); */
spellnum = find_skill_num(s);
if ((spellnum < 1) || (spellnum > MAX_SPELLS)) {
if ((spellnum < 1) || (spellnum > MAX_SPELLS) || !*s) {
send_to_char(ch, "Cast what?!?\r\n");
return;
}

View file

@ -17,7 +17,7 @@
* You are supposed to compare this with the macro CIRCLEMUD_VERSION()
* in utils.h. See there for usage.
*/
#define _CIRCLEMUD 0x030510 /* Major/Minor/Patchlevel - MMmmPP */
#define _CIRCLEMUD 0x030520 /* Major/Minor/Patchlevel - MMmmPP */
/*
* If you want equipment to be automatically equipped to the same place