Added the ability to change a player's name (using the set command) --Jamdog

This commit is contained in:
JamDog 2009-02-05 18:11:27 +00:00
parent cebf6cc9f9
commit 4afedefb30
5 changed files with 264 additions and 156 deletions

View file

@ -35,6 +35,8 @@ export (QQ's a zone into a tarball)t
Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist) Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist)
(lots of major bugfixes too) (lots of major bugfixes too)
tbaMUD 3.59 tbaMUD 3.59
[Feb 05 2009] - Jamdog
Added "set <player> name <newname>", which renames a character, including pfile and index entry
[Feb 01 2009] - Jamdog [Feb 01 2009] - Jamdog
Changed documentation /doc unixshelladminguide to PDF format. Changed documentation /doc unixshelladminguide to PDF format.
[Jan 31 2009] - Jamdog [Jan 31 2009] - Jamdog

View file

@ -1,18 +1,18 @@
/** /**
* @file act.h * @file act.h
* Header file for the core act* c files. * Header file for the core act* c files.
* *
* Part of the core tbaMUD source code distribution, which is a derivative * Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD. * of, and continuation of, CircleMUD.
* *
* All rights reserved. See license for complete information. * All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
* *
* @todo Utility functions that could easily be moved elsewhere have been * @todo Utility functions that could easily be moved elsewhere have been
* marked. Suggest a review of all utility functions (aka. non ACMDs) and * marked. Suggest a review of all utility functions (aka. non ACMDs) and
* determine if the utility functions should be placed into a lower level * determine if the utility functions should be placed into a lower level
* (non-ACMD focused) shared module. * (non-ACMD focused) shared module.
* *
*/ */
#ifndef _ACT_H_ #ifndef _ACT_H_
@ -21,7 +21,7 @@
#include "utils.h" /* for the ACMD macro */ #include "utils.h" /* for the ACMD macro */
/***************************************************************************** /*****************************************************************************
* Begin Functions and defines for act.comm.c * Begin Functions and defines for act.comm.c
****************************************************************************/ ****************************************************************************/
/* functions with subcommands */ /* functions with subcommands */
/* do_gen_comm */ /* do_gen_comm */
@ -48,7 +48,7 @@ ACMD(do_reply);
ACMD(do_tell); ACMD(do_tell);
ACMD(do_write); ACMD(do_write);
/***************************************************************************** /*****************************************************************************
* Begin Functions and defines for act.informative.c * Begin Functions and defines for act.informative.c
****************************************************************************/ ****************************************************************************/
/* Utility Functions */ /* Utility Functions */
/** @todo Move to a utility library */ /** @todo Move to a utility library */
@ -101,7 +101,7 @@ ACMD(do_where);
ACMD(do_who); ACMD(do_who);
/***************************************************************************** /*****************************************************************************
* Begin Functions and defines for act.item.c * Begin Functions and defines for act.item.c
****************************************************************************/ ****************************************************************************/
/* Utility Functions */ /* Utility Functions */
/** @todo Compare with needs of find_eq_pos_script. */ /** @todo Compare with needs of find_eq_pos_script. */
@ -138,7 +138,7 @@ ACMD(do_wield);
/***************************************************************************** /*****************************************************************************
* Begin Functions and defines for act.movement.c * Begin Functions and defines for act.movement.c
****************************************************************************/ ****************************************************************************/
/* Functions with subcommands */ /* Functions with subcommands */
/* do_gen_door */ /* do_gen_door */
@ -165,7 +165,7 @@ extern const char *cmd_door[];
/***************************************************************************** /*****************************************************************************
* Begin Functions and defines for act.offensive.c * Begin Functions and defines for act.offensive.c
****************************************************************************/ ****************************************************************************/
/* Functions with subcommands */ /* Functions with subcommands */
/* do_hit */ /* do_hit */
@ -183,7 +183,7 @@ ACMD(do_rescue);
/***************************************************************************** /*****************************************************************************
* Begin Functions and defines for act.other.c * Begin Functions and defines for act.other.c
****************************************************************************/ ****************************************************************************/
/* Functions with subcommands */ /* Functions with subcommands */
/* do_gen_tog */ /* do_gen_tog */
@ -251,7 +251,7 @@ ACMD(do_visible);
/***************************************************************************** /*****************************************************************************
* Begin Functions and defines for act.social.c * Begin Functions and defines for act.social.c
****************************************************************************/ ****************************************************************************/
/* Utility Functions */ /* Utility Functions */
void free_social_messages(void); void free_social_messages(void);
@ -268,7 +268,7 @@ ACMD(do_gmote);
/***************************************************************************** /*****************************************************************************
* Begin Functions and defines for act.wizard.c * Begin Functions and defines for act.wizard.c
****************************************************************************/ ****************************************************************************/
/* Utility Functions */ /* Utility Functions */
/** @todo should probably be moved to a more general file handler module */ /** @todo should probably be moved to a more general file handler module */
@ -278,6 +278,7 @@ int script_command_interpreter(struct char_data *ch, char *arg);
room_rnum find_target_room(struct char_data *ch, char *rawroomstr); room_rnum find_target_room(struct char_data *ch, char *rawroomstr);
void perform_immort_vis(struct char_data *ch); void perform_immort_vis(struct char_data *ch);
void snoop_check(struct char_data *ch); void snoop_check(struct char_data *ch);
bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_name);
/* Functions with subcommands */ /* Functions with subcommands */
/* do_date */ /* do_date */
ACMD(do_date); ACMD(do_date);

View file

@ -31,6 +31,8 @@
#include "house.h" #include "house.h"
#include "modify.h" #include "modify.h"
#include "quest.h" #include "quest.h"
#include "ban.h"
#include "screen.h"
/* local utility functions with file scope */ /* local utility functions with file scope */
static int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *val_arg); static int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *val_arg);
@ -497,7 +499,7 @@ static void do_stat_room(struct char_data *ch, struct room_data *rm)
CCNRM(ch, C_NRM), IN_ROOM(ch), (long) rm->number + ROOM_ID_BASE, buf2); CCNRM(ch, C_NRM), IN_ROOM(ch), (long) rm->number + ROOM_ID_BASE, buf2);
sprintbitarray(rm->room_flags, room_bits, RF_ARRAY_MAX, buf2); sprintbitarray(rm->room_flags, room_bits, RF_ARRAY_MAX, buf2);
send_to_char(ch, "SpecProc: %s, Flags: %s\r\n", rm->func == NULL ? "None" : get_spec_func_name(rm->func), buf2); send_to_char(ch, "SpecProc: %s, Flags: %s\r\n", rm->func == NULL ? "None" : get_spec_func_name(rm->func), buf2);
send_to_char(ch, "Description:\r\n%s", rm->description ? rm->description : " None.\r\n"); send_to_char(ch, "Description:\r\n%s", rm->description ? rm->description : " None.\r\n");
@ -765,8 +767,8 @@ static void do_stat_character(struct char_data *ch, struct char_data *k)
send_to_char(ch, ", OLC[%sAedit%s]", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM)); send_to_char(ch, ", OLC[%sAedit%s]", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM));
else if (GET_OLC_ZONE(k)==HEDIT_PERMISSION) else if (GET_OLC_ZONE(k)==HEDIT_PERMISSION)
send_to_char(ch, ", OLC[%sHedit%s]", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM)); send_to_char(ch, ", OLC[%sHedit%s]", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM));
else if (GET_OLC_ZONE(k) == ALL_PERMISSION) else if (GET_OLC_ZONE(k) == ALL_PERMISSION)
send_to_char(ch, ", OLC[%sAll%s]", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM)); send_to_char(ch, ", OLC[%sAll%s]", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM));
else if (GET_OLC_ZONE(k)==NOWHERE) else if (GET_OLC_ZONE(k)==NOWHERE)
send_to_char(ch, ", OLC[%sOFF%s]", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM)); send_to_char(ch, ", OLC[%sOFF%s]", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM));
else else
@ -795,7 +797,7 @@ static void do_stat_character(struct char_data *ch, struct char_data *k)
send_to_char(ch, "Screen %s[%s%d%sx%s%d%s]%s\r\n", send_to_char(ch, "Screen %s[%s%d%sx%s%d%s]%s\r\n",
CCCYN(ch, C_NRM), CCYEL(ch, C_NRM), GET_SCREEN_WIDTH(k), CCNRM(ch, C_NRM), CCCYN(ch, C_NRM), CCYEL(ch, C_NRM), GET_SCREEN_WIDTH(k), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), GET_PAGE_LENGTH(k), CCCYN(ch, C_NRM), CCNRM(ch, C_NRM)); CCYEL(ch, C_NRM), GET_PAGE_LENGTH(k), CCCYN(ch, C_NRM), CCNRM(ch, C_NRM));
send_to_char(ch, "AC: [%d%+d/10], Hitroll: [%2d], Damroll: [%2d], Saving throws: [%d/%d/%d/%d/%d]\r\n", send_to_char(ch, "AC: [%d%+d/10], Hitroll: [%2d], Damroll: [%2d], Saving throws: [%d/%d/%d/%d/%d]\r\n",
GET_AC(k), dex_app[GET_DEX(k)].defensive, k->points.hitroll, GET_AC(k), dex_app[GET_DEX(k)].defensive, k->points.hitroll,
k->points.damroll, GET_SAVE(k, 0), GET_SAVE(k, 1), GET_SAVE(k, 2), k->points.damroll, GET_SAVE(k, 0), GET_SAVE(k, 1), GET_SAVE(k, 2),
@ -926,7 +928,7 @@ static void do_stat_character(struct char_data *ch, struct char_data *k)
send_to_char(ch, "Global Variables:\r\n"); send_to_char(ch, "Global Variables:\r\n");
/* currently, variable context for players is always 0, so it is not /* currently, variable context for players is always 0, so it is not
* displayed here. in the future, this might change */ * displayed here. in the future, this might change */
for (tv = k->script->global_vars; tv; tv = tv->next) { for (tv = k->script->global_vars; tv; tv = tv->next) {
if (*(tv->value) == UID_CHAR) { if (*(tv->value) == UID_CHAR) {
@ -1238,7 +1240,7 @@ ACMD(do_return)
send_to_char(ch, "You return to your original body.\r\n"); send_to_char(ch, "You return to your original body.\r\n");
/* If someone switched into your original body, disconnect them. - JE /* If someone switched into your original body, disconnect them. - JE
* Zmey: here we put someone switched in our body to disconnect state but * Zmey: here we put someone switched in our body to disconnect state but
* we must also NULL his pointer to our character, otherwise close_socket() * we must also NULL his pointer to our character, otherwise close_socket()
* will damage our character's pointer to our descriptor (which is assigned * will damage our character's pointer to our descriptor (which is assigned
* below in this function). */ * below in this function). */
@ -1475,11 +1477,11 @@ ACMD(do_advance)
} else { } else {
act("$n makes some strange gestures. A strange feeling comes upon you,\r\n" act("$n makes some strange gestures. A strange feeling comes upon you,\r\n"
"Like a giant hand, light comes down from above, grabbing your body,\r\n" "Like a giant hand, light comes down from above, grabbing your body,\r\n"
"that begins to pulse with colored lights from inside.\r\n\r\n" "that begins to pulse with colored lights from inside.\r\n\r\n"
"Your head seems to be filled with demons from another plane as\r\n" "Your head seems to be filled with demons from another plane as\r\n"
"your body dissolves to the elements of time and space itself.\r\n" "your body dissolves to the elements of time and space itself.\r\n"
"Suddenly a silent explosion of light snaps you back to reality.\r\n\r\n" "Suddenly a silent explosion of light snaps you back to reality.\r\n\r\n"
"You feel slightly different.", FALSE, ch, 0, victim, TO_VICT); "You feel slightly different.", FALSE, ch, 0, victim, TO_VICT);
} }
send_to_char(ch, "%s", CONFIG_OK); send_to_char(ch, "%s", CONFIG_OK);
@ -1524,23 +1526,23 @@ ACMD(do_restore)
one_argument(argument, buf); one_argument(argument, buf);
if (!*buf) if (!*buf)
send_to_char(ch, "Whom do you wish to restore?\r\n"); send_to_char(ch, "Whom do you wish to restore?\r\n");
else if (is_abbrev(buf, "all")) else if (is_abbrev(buf, "all"))
{ {
mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s restored all",GET_NAME(ch)); mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s restored all",GET_NAME(ch));
for (j = descriptor_list; j; j = j->next) for (j = descriptor_list; j; j = j->next)
{ {
if (!IS_PLAYING(j) || !(vict = j->character) || GET_LEVEL(vict) >= LVL_IMMORT) if (!IS_PLAYING(j) || !(vict = j->character) || GET_LEVEL(vict) >= LVL_IMMORT)
continue; continue;
GET_HIT(vict) = GET_MAX_HIT(vict); GET_HIT(vict) = GET_MAX_HIT(vict);
GET_MANA(vict) = GET_MAX_MANA(vict); GET_MANA(vict) = GET_MAX_MANA(vict);
GET_MOVE(vict) = GET_MAX_MOVE(vict); GET_MOVE(vict) = GET_MAX_MOVE(vict);
update_pos(vict); update_pos(vict);
send_to_char(ch, "%s has been fully healed.\r\n", GET_NAME(vict)); send_to_char(ch, "%s has been fully healed.\r\n", GET_NAME(vict));
act("You have been fully healed by $N!", FALSE, vict, 0, ch, TO_CHAR); act("You have been fully healed by $N!", FALSE, vict, 0, ch, TO_CHAR);
} }
} }
else if (!(vict = get_char_vis(ch, buf, NULL, FIND_CHAR_WORLD))) else if (!(vict = get_char_vis(ch, buf, NULL, FIND_CHAR_WORLD)))
send_to_char(ch, "%s", CONFIG_NOPERSON); send_to_char(ch, "%s", CONFIG_NOPERSON);
@ -1679,20 +1681,20 @@ ACMD(do_dc)
return; return;
} }
/* We used to just close the socket here using close_socket(), but various /* We used to just close the socket here using close_socket(), but various
* people pointed out this could cause a crash if you're closing the person * people pointed out this could cause a crash if you're closing the person
* below you on the descriptor list. Just setting to CON_CLOSE leaves things * below you on the descriptor list. Just setting to CON_CLOSE leaves things
* in a massively inconsistent state so I had to add this new flag to the * in a massively inconsistent state so I had to add this new flag to the
* descriptor. -je It is a much more logical extension for a CON_DISCONNECT * descriptor. -je It is a much more logical extension for a CON_DISCONNECT
* to be used for in-game socket closes and CON_CLOSE for out of game * to be used for in-game socket closes and CON_CLOSE for out of game
* closings. This will retain the stability of the close_me hack while being * closings. This will retain the stability of the close_me hack while being
* neater in appearance. -gg For those unlucky souls who actually manage to * neater in appearance. -gg For those unlucky souls who actually manage to
* get disconnected by two different immortals in the same 1/10th of a * get disconnected by two different immortals in the same 1/10th of a
* second, we have the below 'if' check. -gg */ * second, we have the below 'if' check. -gg */
if (STATE(d) == CON_DISCONNECT || STATE(d) == CON_CLOSE) if (STATE(d) == CON_DISCONNECT || STATE(d) == CON_CLOSE)
send_to_char(ch, "They're already being disconnected.\r\n"); send_to_char(ch, "They're already being disconnected.\r\n");
else { else {
/* Remember that we can disconnect people not in the game and that rather /* Remember that we can disconnect people not in the game and that rather
* confuses the code when it expected there to be a character context. */ * confuses the code when it expected there to be a character context. */
if (STATE(d) == CON_PLAYING) if (STATE(d) == CON_PLAYING)
STATE(d) = CON_DISCONNECT; STATE(d) = CON_DISCONNECT;
@ -1795,7 +1797,7 @@ struct last_entry *find_llog_entry(int punique, long idnum) {
/* recs = number of records in the last file */ /* recs = number of records in the last file */
recs = size/sizeof(struct last_entry); recs = size/sizeof(struct last_entry);
/* we'll search last to first, since it's faster than any thing else we can /* we'll search last to first, since it's faster than any thing else we can
* do (like searching for the last shutdown/etc..) */ * do (like searching for the last shutdown/etc..) */
for(tmp=recs-1; tmp > 0; tmp--) { for(tmp=recs-1; tmp > 0; tmp--) {
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR); fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
@ -1833,7 +1835,7 @@ static void mod_llog_entry(struct last_entry *llast,int type) {
/* recs = number of records in the last file */ /* recs = number of records in the last file */
recs = size/sizeof(struct last_entry); recs = size/sizeof(struct last_entry);
/* We'll search last to first, since it's faster than any thing else we can /* We'll search last to first, since it's faster than any thing else we can
* do (like searching for the last shutdown/etc..) */ * do (like searching for the last shutdown/etc..) */
for(tmp=recs; tmp > 0; tmp--) { for(tmp=recs; tmp > 0; tmp--) {
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR); fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
@ -1842,7 +1844,7 @@ static void mod_llog_entry(struct last_entry *llast,int type) {
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR); fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
if(mlast.idnum == llast->idnum && mlast.punique == llast->punique) { if(mlast.idnum == llast->idnum && mlast.punique == llast->punique) {
/* Then we've found a match, lets assume quit is inviolate, mainly /* Then we've found a match, lets assume quit is inviolate, mainly
* because disconnect is called after each of these */ * because disconnect is called after each of these */
if(mlast.close_type != LAST_QUIT && if(mlast.close_type != LAST_QUIT &&
mlast.close_type != LAST_IDLEOUT && mlast.close_type != LAST_IDLEOUT &&
@ -2186,7 +2188,7 @@ ACMD(do_wiznet)
} }
for (d = descriptor_list; d; d = d->next) { for (d = descriptor_list; d; d = d->next) {
if (IS_PLAYING(d) && (GET_LEVEL(d->character) >= level) && if (IS_PLAYING(d) && (GET_LEVEL(d->character) >= level) &&
(!PRF_FLAGGED(d->character, PRF_NOWIZ)) (!PRF_FLAGGED(d->character, PRF_NOWIZ))
&& (d != ch->desc || !(PRF_FLAGGED(d->character, PRF_NOREPEAT)))) { && (d != ch->desc || !(PRF_FLAGGED(d->character, PRF_NOREPEAT)))) {
if (CAN_SEE(d->character, ch)) { if (CAN_SEE(d->character, ch)) {
@ -2195,7 +2197,7 @@ ACMD(do_wiznet)
} else { } else {
msg = strdup(buf2); msg = strdup(buf2);
send_to_char(d->character, "%s", buf2); send_to_char(d->character, "%s", buf2);
} }
add_history(d->character, msg, HIST_WIZNET); add_history(d->character, msg, HIST_WIZNET);
} }
} }
@ -2336,7 +2338,7 @@ ACMD(do_wizutil)
break; break;
default: default:
log("SYSERR: Unknown subcmd %d passed to do_wizutil (%s)", subcmd, __FILE__); log("SYSERR: Unknown subcmd %d passed to do_wizutil (%s)", subcmd, __FILE__);
/* SYSERR_DESC: This is the same as the unhandled case in do_gen_ps(), /* SYSERR_DESC: This is the same as the unhandled case in do_gen_ps(),
* but this function handles 'reroll', 'pardon', 'freeze', etc. */ * but this function handles 'reroll', 'pardon', 'freeze', etc. */
break; break;
} }
@ -2709,30 +2711,31 @@ ACMD(do_show)
{ "maxmana", LVL_BUILDER, BOTH, NUMBER }, { "maxmana", LVL_BUILDER, BOTH, NUMBER },
{ "maxmove", LVL_BUILDER, BOTH, NUMBER }, /* 30 */ { "maxmove", LVL_BUILDER, BOTH, NUMBER }, /* 30 */
{ "move", LVL_BUILDER, BOTH, NUMBER }, { "move", LVL_BUILDER, BOTH, NUMBER },
{ "name", LVL_IMMORT, PC, MISC },
{ "nodelete", LVL_GOD, PC, BINARY }, { "nodelete", LVL_GOD, PC, BINARY },
{ "nohassle", LVL_GOD, PC, BINARY }, { "nohassle", LVL_GOD, PC, BINARY },
{ "nosummon", LVL_BUILDER, PC, BINARY }, { "nosummon", LVL_BUILDER, PC, BINARY }, /* 35 */
{ "nowizlist", LVL_GRGOD, PC, BINARY }, /* 35 */ { "nowizlist", LVL_GRGOD, PC, BINARY },
{ "olc", LVL_GRGOD, PC, MISC }, { "olc", LVL_GRGOD, PC, MISC },
{ "password", LVL_IMPL, PC, MISC }, { "password", LVL_IMPL, PC, MISC },
{ "poofin", LVL_IMMORT, PC, MISC }, { "poofin", LVL_IMMORT, PC, MISC },
{ "poofout", LVL_IMMORT, PC, MISC }, { "poofout", LVL_IMMORT, PC, MISC }, /* 40 */
{ "practices", LVL_GOD, PC, NUMBER }, /* 40 */ { "practices", LVL_GOD, PC, NUMBER },
{ "quest", LVL_GOD, PC, BINARY }, { "quest", LVL_GOD, PC, BINARY },
{ "room", LVL_BUILDER, BOTH, NUMBER }, { "room", LVL_BUILDER, BOTH, NUMBER },
{ "screenwidth", LVL_GOD, PC, NUMBER }, { "screenwidth", LVL_GOD, PC, NUMBER },
{ "sex", LVL_GOD, BOTH, MISC }, { "sex", LVL_GOD, BOTH, MISC }, /* 45 */
{ "showvnums", LVL_BUILDER, PC, BINARY }, /* 45 */ { "showvnums", LVL_BUILDER, PC, BINARY },
{ "siteok", LVL_GOD, PC, BINARY }, { "siteok", LVL_GOD, PC, BINARY },
{ "str", LVL_BUILDER, BOTH, NUMBER }, { "str", LVL_BUILDER, BOTH, NUMBER },
{ "stradd", LVL_BUILDER, BOTH, NUMBER }, { "stradd", LVL_BUILDER, BOTH, NUMBER },
{ "thief", LVL_GOD, PC, BINARY }, { "thief", LVL_GOD, PC, BINARY }, /* 50 */
{ "thirst", LVL_BUILDER, BOTH, MISC }, /* 50 */ { "thirst", LVL_BUILDER, BOTH, MISC },
{ "title", LVL_GOD, PC, MISC }, { "title", LVL_GOD, PC, MISC },
{ "variable", LVL_GRGOD, PC, MISC }, { "variable", LVL_GRGOD, PC, MISC },
{ "weight", LVL_BUILDER, BOTH, NUMBER }, { "weight", LVL_BUILDER, BOTH, NUMBER },
{ "wis", LVL_BUILDER, BOTH, NUMBER }, { "wis", LVL_BUILDER, BOTH, NUMBER }, /* 55 */
{ "questpoints", LVL_GOD, PC, NUMBER }, /* 55 */ { "questpoints", LVL_GOD, PC, NUMBER },
{ "questhistory", LVL_GOD, PC, NUMBER }, { "questhistory", LVL_GOD, PC, NUMBER },
{ "\n", 0, BOTH, MISC } { "\n", 0, BOTH, MISC }
}; };
@ -2967,29 +2970,39 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c
vict->points.move = RANGE(0, vict->points.max_move); vict->points.move = RANGE(0, vict->points.max_move);
affect_total(vict); affect_total(vict);
break; break;
case 32: /* nodelete */ case 32: /* name */
if (ch != vict && GET_LEVEL(ch) < LVL_IMPL) {
send_to_char(ch, "Only Imps can change the name of other players.\r\n");
return (0);
}
if (!change_player_name(ch, vict, val_arg)) {
send_to_char(ch, "Name has not been changed!\r\n");
return (0);
}
break;
case 33: /* nodelete */
SET_OR_REMOVE(PLR_FLAGS(vict), PLR_NODELETE); SET_OR_REMOVE(PLR_FLAGS(vict), PLR_NODELETE);
break; break;
case 33: /* nohassle */ case 34: /* nohassle */
if (GET_LEVEL(ch) < LVL_GOD && ch != vict) { if (GET_LEVEL(ch) < LVL_GOD && ch != vict) {
send_to_char(ch, "You aren't godly enough for that!\r\n"); send_to_char(ch, "You aren't godly enough for that!\r\n");
return (0); return (0);
} }
SET_OR_REMOVE(PRF_FLAGS(vict), PRF_NOHASSLE); SET_OR_REMOVE(PRF_FLAGS(vict), PRF_NOHASSLE);
break; break;
case 34: /* nosummon */ case 35: /* nosummon */
SET_OR_REMOVE(PRF_FLAGS(vict), PRF_SUMMONABLE); SET_OR_REMOVE(PRF_FLAGS(vict), PRF_SUMMONABLE);
send_to_char(ch, "Nosummon %s for %s.\r\n", ONOFF(!on), GET_NAME(vict)); send_to_char(ch, "Nosummon %s for %s.\r\n", ONOFF(!on), GET_NAME(vict));
break; break;
case 35: /* nowiz */ case 36: /* nowiz */
SET_OR_REMOVE(PLR_FLAGS(vict), PLR_NOWIZLIST); SET_OR_REMOVE(PLR_FLAGS(vict), PLR_NOWIZLIST);
break; break;
case 36: /* olc */ case 37: /* olc */
if (is_abbrev(val_arg, "socials") || is_abbrev(val_arg, "actions") || is_abbrev(val_arg, "aedit")) if (is_abbrev(val_arg, "socials") || is_abbrev(val_arg, "actions") || is_abbrev(val_arg, "aedit"))
GET_OLC_ZONE(vict) = AEDIT_PERMISSION; GET_OLC_ZONE(vict) = AEDIT_PERMISSION;
else if (is_abbrev(val_arg, "hedit") || is_abbrev(val_arg, "help")) else if (is_abbrev(val_arg, "hedit") || is_abbrev(val_arg, "help"))
GET_OLC_ZONE(vict) = HEDIT_PERMISSION; GET_OLC_ZONE(vict) = HEDIT_PERMISSION;
else if (*val_arg == '*' || is_abbrev(val_arg, "all")) else if (*val_arg == '*' || is_abbrev(val_arg, "all"))
GET_OLC_ZONE(vict) = ALL_PERMISSION; GET_OLC_ZONE(vict) = ALL_PERMISSION;
else if (is_abbrev(val_arg, "off")) else if (is_abbrev(val_arg, "off"))
GET_OLC_ZONE(vict) = NOWHERE; GET_OLC_ZONE(vict) = NOWHERE;
@ -2999,7 +3012,7 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c
} else } else
GET_OLC_ZONE(vict) = atoi(val_arg); GET_OLC_ZONE(vict) = atoi(val_arg);
break; break;
case 37: /* password */ case 38: /* password */
if (GET_LEVEL(vict) >= LVL_GRGOD) { if (GET_LEVEL(vict) >= LVL_GRGOD) {
send_to_char(ch, "You cannot change that.\r\n"); send_to_char(ch, "You cannot change that.\r\n");
return (0); return (0);
@ -3008,12 +3021,12 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c
*(GET_PASSWD(vict) + MAX_PWD_LENGTH) = '\0'; *(GET_PASSWD(vict) + MAX_PWD_LENGTH) = '\0';
send_to_char(ch, "Password changed to '%s'.\r\n", val_arg); send_to_char(ch, "Password changed to '%s'.\r\n", val_arg);
break; break;
case 38: /* poofin */ case 39: /* poofin */
if ((vict == ch) || (GET_LEVEL(ch) == LVL_IMPL)) { if ((vict == ch) || (GET_LEVEL(ch) == LVL_IMPL)) {
skip_spaces(&val_arg); skip_spaces(&val_arg);
if (POOFIN(vict)) if (POOFIN(vict))
free(POOFIN(vict)); free(POOFIN(vict));
if (!*val_arg) if (!*val_arg)
POOFIN(vict) = NULL; POOFIN(vict) = NULL;
@ -3021,26 +3034,26 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c
POOFIN(vict) = strdup(val_arg); POOFIN(vict) = strdup(val_arg);
} }
break; break;
case 39: /* poofout */ case 40: /* poofout */
if ((vict == ch) || (GET_LEVEL(ch) == LVL_IMPL)) { if ((vict == ch) || (GET_LEVEL(ch) == LVL_IMPL)) {
skip_spaces(&val_arg); skip_spaces(&val_arg);
if (POOFOUT(vict)) if (POOFOUT(vict))
free(POOFOUT(vict)); free(POOFOUT(vict));
if (!*val_arg) if (!*val_arg)
POOFOUT(vict) = NULL; POOFOUT(vict) = NULL;
else else
POOFOUT(vict) = strdup(val_arg); POOFOUT(vict) = strdup(val_arg);
} }
break; break;
case 40: /* practices */ case 41: /* practices */
GET_PRACTICES(vict) = RANGE(0, 100); GET_PRACTICES(vict) = RANGE(0, 100);
break; break;
case 41: /* quest */ case 42: /* quest */
SET_OR_REMOVE(PRF_FLAGS(vict), PRF_QUEST); SET_OR_REMOVE(PRF_FLAGS(vict), PRF_QUEST);
break; break;
case 42: /* room */ case 43: /* room */
if ((rnum = real_room(value)) == NOWHERE) { if ((rnum = real_room(value)) == NOWHERE) {
send_to_char(ch, "No room exists with that number.\r\n"); send_to_char(ch, "No room exists with that number.\r\n");
return (0); return (0);
@ -3049,23 +3062,23 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c
char_from_room(vict); char_from_room(vict);
char_to_room(vict, rnum); char_to_room(vict, rnum);
break; break;
case 43: /* screenwidth */ case 44: /* screenwidth */
GET_SCREEN_WIDTH(vict) = RANGE(40, 200); GET_SCREEN_WIDTH(vict) = RANGE(40, 200);
break; break;
case 44: /* sex */ case 45: /* sex */
if ((i = search_block(val_arg, genders, FALSE)) < 0) { if ((i = search_block(val_arg, genders, FALSE)) < 0) {
send_to_char(ch, "Must be 'male', 'female', or 'neutral'.\r\n"); send_to_char(ch, "Must be 'male', 'female', or 'neutral'.\r\n");
return (0); return (0);
} }
GET_SEX(vict) = i; GET_SEX(vict) = i;
break; break;
case 45: /* showvnums */ case 46: /* showvnums */
SET_OR_REMOVE(PRF_FLAGS(vict), PRF_SHOWVNUMS); SET_OR_REMOVE(PRF_FLAGS(vict), PRF_SHOWVNUMS);
break; break;
case 46: /* siteok */ case 47: /* siteok */
SET_OR_REMOVE(PLR_FLAGS(vict), PLR_SITEOK); SET_OR_REMOVE(PLR_FLAGS(vict), PLR_SITEOK);
break; break;
case 47: /* str */ case 48: /* str */
if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD)
RANGE(3, 25); RANGE(3, 25);
else else
@ -3074,16 +3087,16 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c
vict->real_abils.str_add = 0; vict->real_abils.str_add = 0;
affect_total(vict); affect_total(vict);
break; break;
case 48: /* stradd */ case 49: /* stradd */
vict->real_abils.str_add = RANGE(0, 100); vict->real_abils.str_add = RANGE(0, 100);
if (value > 0) if (value > 0)
vict->real_abils.str = 18; vict->real_abils.str = 18;
affect_total(vict); affect_total(vict);
break; break;
case 49: /* thief */ case 50: /* thief */
SET_OR_REMOVE(PLR_FLAGS(vict), PLR_THIEF); SET_OR_REMOVE(PLR_FLAGS(vict), PLR_THIEF);
break; break;
case 50: /* thirst */ case 51: /* thirst */
if (!str_cmp(val_arg, "off")) { if (!str_cmp(val_arg, "off")) {
GET_COND(vict, THIRST) = -1; GET_COND(vict, THIRST) = -1;
send_to_char(ch, "%s's thirst is now off.\r\n", GET_NAME(vict)); send_to_char(ch, "%s's thirst is now off.\r\n", GET_NAME(vict));
@ -3097,18 +3110,18 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c
return (0); return (0);
} }
break; break;
case 51: /* title */ case 52: /* title */
set_title(vict, val_arg); set_title(vict, val_arg);
send_to_char(ch, "%s's title is now: %s\r\n", GET_NAME(vict), GET_TITLE(vict)); send_to_char(ch, "%s's title is now: %s\r\n", GET_NAME(vict), GET_TITLE(vict));
break; break;
case 52: /* variable */ case 53: /* variable */
return perform_set_dg_var(ch, vict, val_arg); return perform_set_dg_var(ch, vict, val_arg);
break; break;
case 53: /* weight */ case 54: /* weight */
GET_WEIGHT(vict) = value; GET_WEIGHT(vict) = value;
affect_total(vict); affect_total(vict);
break; break;
case 54: /* wis */ case 55: /* wis */
if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD) if (IS_NPC(vict) || GET_LEVEL(vict) >= LVL_GRGOD)
RANGE(3, 25); RANGE(3, 25);
else else
@ -3116,10 +3129,10 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c
vict->real_abils.wis = value; vict->real_abils.wis = value;
affect_total(vict); affect_total(vict);
break; break;
case 55: /* questpoints */ case 56: /* questpoints */
GET_QUESTPOINTS(vict) = RANGE(0, 100000000); GET_QUESTPOINTS(vict) = RANGE(0, 100000000);
break; break;
case 56: /* questhistory */ case 57: /* questhistory */
qvnum = atoi(val_arg); qvnum = atoi(val_arg);
if (real_quest(qvnum) == NOTHING) { if (real_quest(qvnum) == NOTHING) {
send_to_char(ch, "That quest doesn't exist.\r\n"); send_to_char(ch, "That quest doesn't exist.\r\n");
@ -3260,7 +3273,7 @@ ACMD(do_links)
skip_spaces(&argument); skip_spaces(&argument);
one_argument(argument, arg); one_argument(argument, arg);
if (!is_number(arg)) { if (!is_number(arg)) {
zrnum = world[IN_ROOM(ch)].zone; zrnum = world[IN_ROOM(ch)].zone;
zvnum = zone_table[zrnum].number; zvnum = zone_table[zrnum].number;
} else { } else {
@ -4094,13 +4107,13 @@ ACMD(do_zpurge)
} }
/** Used to read and gather a bit of information about external log files while /** Used to read and gather a bit of information about external log files while
* in game. * in game.
* Makes use of the '@' color codes in the file status information. * Makes use of the '@' color codes in the file status information.
* Some of the methods used are a bit wasteful (reading through the file * Some of the methods used are a bit wasteful (reading through the file
* multiple times to gather diagnostic information), but it is * multiple times to gather diagnostic information), but it is
* assumed that the files read with this function will never be very large. * assumed that the files read with this function will never be very large.
* Files to be read are assumed to exist and be readable and if they aren't, * Files to be read are assumed to exist and be readable and if they aren't,
* log the name of the missing file. * log the name of the missing file.
*/ */
ACMD(do_file) ACMD(do_file)
{ {
@ -4150,7 +4163,7 @@ ACMD(do_file)
/* Initialize buffer */ /* Initialize buffer */
buf[0] = '\0'; buf[0] = '\0';
/**/ /**/
/* End function variable set-up and initialization. */ /* End function variable set-up and initialization. */
@ -4164,29 +4177,29 @@ ACMD(do_file)
send_to_char(ch, "%-15s%s\r\n", fields[i].cmd, fields[i].file); send_to_char(ch, "%-15s%s\r\n", fields[i].cmd, fields[i].file);
return; return;
} }
/* Begin validity checks. Is the file choice valid and accessible? */ /* Begin validity checks. Is the file choice valid and accessible? */
/**/ /**/
/* There are some arguments, deal with them. */ /* There are some arguments, deal with them. */
two_arguments(argument, field, value); two_arguments(argument, field, value);
for (l = 0; *(fields[l].cmd) != '\n'; l++) for (l = 0; *(fields[l].cmd) != '\n'; l++)
{ {
if (!strncmp(field, fields[l].cmd, strlen(field))) if (!strncmp(field, fields[l].cmd, strlen(field)))
break; break;
} }
if(*(fields[l].cmd) == '\n') { if(*(fields[l].cmd) == '\n') {
send_to_char(ch, "'%s' is not a valid file.\r\n", field); send_to_char(ch, "'%s' is not a valid file.\r\n", field);
return; return;
} }
if (GET_LEVEL(ch) < fields[l].level) { if (GET_LEVEL(ch) < fields[l].level) {
send_to_char(ch, "You have not achieved a high enough level to view '%s'.\r\n", send_to_char(ch, "You have not achieved a high enough level to view '%s'.\r\n",
fields[l].cmd); fields[l].cmd);
return; return;
} }
/* Number of lines to view. Default is 15. */ /* Number of lines to view. Default is 15. */
if(!*value) if(!*value)
req_lines = def_lines_to_read; req_lines = def_lines_to_read;
@ -4203,7 +4216,7 @@ ACMD(do_file)
/* Limit the maximum number of lines */ /* Limit the maximum number of lines */
req_lines = MIN( req_lines, max_lines_to_read ); req_lines = MIN( req_lines, max_lines_to_read );
} }
/* Must be able to access the file on disk. */ /* Must be able to access the file on disk. */
if (!(req_file=fopen(fields[l].file,"r"))) { if (!(req_file=fopen(fields[l].file,"r"))) {
send_to_char(ch, "The file %s can not be opened.\r\n", fields[l].file); send_to_char(ch, "The file %s can not be opened.\r\n", fields[l].file);
@ -4214,12 +4227,12 @@ ACMD(do_file)
} }
/**/ /**/
/* End validity checks. From here on, the file should be viewable. */ /* End validity checks. From here on, the file should be viewable. */
/* Diagnostic information about the file */ /* Diagnostic information about the file */
req_file_size = file_sizeof(req_file); req_file_size = file_sizeof(req_file);
req_file_lines = file_numlines(req_file); req_file_lines = file_numlines(req_file);
snprintf( buf, sizeof(buf), snprintf( buf, sizeof(buf),
"@gFile:@n %s@g; Min. Level to read:@n %d@g; File Location:@n %s@g\r\n" "@gFile:@n %s@g; Min. Level to read:@n %d@g; File Location:@n %s@g\r\n"
"File size (bytes):@n %ld@g; Total num lines:@n %d\r\n", "File size (bytes):@n %ld@g; Total num lines:@n %d\r\n",
fields[l].cmd, fields[l].level, fields[l].file, (long) req_file_size, fields[l].cmd, fields[l].level, fields[l].file, (long) req_file_size,
@ -4240,7 +4253,7 @@ ACMD(do_file)
} }
/** Since file_head and file_tail will add the overflow message, we /** Since file_head and file_tail will add the overflow message, we
* don't check for status here. */ * don't check for status here. */
if ( lines_read == req_file_lines ) if ( lines_read == req_file_lines )
{ {
/* We're reading the entire file */ /* We're reading the entire file */
@ -4252,7 +4265,7 @@ ACMD(do_file)
{ {
snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf), snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf),
"\r\n@gMaximum number of @n%d @glines returned.@n\r\n", "\r\n@gMaximum number of @n%d @glines returned.@n\r\n",
lines_read ); lines_read );
} }
else else
{ {
@ -4269,37 +4282,37 @@ ACMD(do_file)
ACMD(do_changelog) ACMD(do_changelog)
{ {
time_t rawtime; time_t rawtime;
char tmstr[MAX_INPUT_LENGTH], line[READ_SIZE], last_buf[READ_SIZE], char tmstr[MAX_INPUT_LENGTH], line[READ_SIZE], last_buf[READ_SIZE],
buf[READ_SIZE]; buf[READ_SIZE];
FILE *fl, *new; FILE *fl, *new;
skip_spaces(&argument); skip_spaces(&argument);
if (!*argument) { if (!*argument) {
send_to_char(ch, "Usage: changelog <change>\r\n"); send_to_char(ch, "Usage: changelog <change>\r\n");
return; return;
} }
sprintf(buf, "%s.bak", CHANGE_LOG_FILE); sprintf(buf, "%s.bak", CHANGE_LOG_FILE);
if (rename(CHANGE_LOG_FILE, buf)) { if (rename(CHANGE_LOG_FILE, buf)) {
mudlog(BRF, LVL_IMPL, TRUE, mudlog(BRF, LVL_IMPL, TRUE,
"SYSERR: Error making backup changelog file (%s)", buf); "SYSERR: Error making backup changelog file (%s)", buf);
return; return;
} }
if (!(fl = fopen(buf, "r"))) { if (!(fl = fopen(buf, "r"))) {
mudlog(BRF, LVL_IMPL, TRUE, mudlog(BRF, LVL_IMPL, TRUE,
"SYSERR: Error opening backup changelog file (%s)", buf); "SYSERR: Error opening backup changelog file (%s)", buf);
return; return;
} }
if (!(new = fopen(CHANGE_LOG_FILE, "w"))) { if (!(new = fopen(CHANGE_LOG_FILE, "w"))) {
mudlog(BRF, LVL_IMPL, TRUE, mudlog(BRF, LVL_IMPL, TRUE,
"SYSERR: Error opening new changelog file (%s)", CHANGE_LOG_FILE); "SYSERR: Error opening new changelog file (%s)", CHANGE_LOG_FILE);
return; return;
} }
while (get_line(fl, line)) { while (get_line(fl, line)) {
if (*line != '[') if (*line != '[')
fprintf(new, "%s\n", line); fprintf(new, "%s\n", line);
@ -4308,21 +4321,21 @@ ACMD(do_changelog)
break; break;
} }
} }
rawtime = time(0); rawtime = time(0);
strftime(tmstr, sizeof(tmstr), "%b %d %Y", localtime(&rawtime)); strftime(tmstr, sizeof(tmstr), "%b %d %Y", localtime(&rawtime));
sprintf(buf, "[%s] - %s", tmstr, GET_NAME(ch)); sprintf(buf, "[%s] - %s", tmstr, GET_NAME(ch));
fprintf(new, "%s\n", buf); fprintf(new, "%s\n", buf);
fprintf(new, " %s\n", argument); fprintf(new, " %s\n", argument);
if (strcmp(buf, last_buf)) if (strcmp(buf, last_buf))
fprintf(new, "%s\n", line); fprintf(new, "%s\n", line);
while (get_line(fl, line)) while (get_line(fl, line))
fprintf(new, "%s\n", line); fprintf(new, "%s\n", line);
fclose(fl); fclose(fl);
fclose(new); fclose(new);
send_to_char(ch, "Change added.\r\n"); send_to_char(ch, "Change added.\r\n");
@ -4365,7 +4378,7 @@ ACMD(do_plist)
low = LVL_IMMORT; low = LVL_IMMORT;
break; break;
case 'm': case 'm':
strcpy(buf, buf1); strcpy(buf, buf1);
high = LVL_IMMORT - 1; high = LVL_IMMORT - 1;
break; break;
case 'd': case 'd':
@ -4380,7 +4393,7 @@ ACMD(do_plist)
break; break;
default: default:
send_to_char(ch, "%s\r\n", PLIST_FORMAT); send_to_char(ch, "%s\r\n", PLIST_FORMAT);
return; return;
} }
} else { } else {
send_to_char(ch, "%s\r\n", PLIST_FORMAT); send_to_char(ch, "%s\r\n", PLIST_FORMAT);
@ -4388,7 +4401,7 @@ ACMD(do_plist)
} }
} }
len = 0; len = 0;
len += snprintf(buf + len, sizeof(buf) - len, "@W[ Id] (Lv) Name Last@n\r\n" len += snprintf(buf + len, sizeof(buf) - len, "@W[ Id] (Lv) Name Last@n\r\n"
"%s-----------------------------------------------%s\r\n", CCCYN(ch, C_NRM), "%s-----------------------------------------------%s\r\n", CCCYN(ch, C_NRM),
CCNRM(ch, C_NRM)); CCNRM(ch, C_NRM));
@ -4425,3 +4438,95 @@ ACMD(do_wizupdate)
run_autowiz(); run_autowiz();
send_to_char(ch, "Wizlists updated.\n\r"); send_to_char(ch, "Wizlists updated.\n\r");
} }
/* NOTE: This is called from perform_set */
bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_name)
{
struct char_data *temp_ch=NULL;
int plr_i = 0, i, j, k;
char old_name[MAX_NAME_LENGTH], old_pfile[50], new_pfile[50], buf[MAX_STRING_LENGTH];
if (!ch)
{
log("SYSERR: No char passed to change_player_name.");
return FALSE;
}
if (!vict)
{
log("SYSERR: No victim passed to change_player_name.");
send_to_char(ch, "Invalid victim.\r\n");
return FALSE;
}
if (!new_name || !(*new_name) || strlen(new_name) < 2 ||
strlen(new_name) > MAX_NAME_LENGTH || !valid_name(new_name) ||
fill_word(new_name) || reserved_word(new_name) ) {
send_to_char(ch, "Invalid new name.\r\n");
return FALSE;
}
// Check that someone with new_name isn't already logged in
if ((temp_ch = get_player_vis(ch, new_name, NULL, FIND_CHAR_WORLD)) != NULL) {
send_to_char(ch, "Sorry, the new name already exists.\r\n");
return FALSE;
} else {
/* try to load the player off disk */
CREATE(temp_ch, struct char_data, 1);
clear_char(temp_ch);
CREATE(temp_ch->player_specials, struct player_special_data, 1);
if ((plr_i = load_char(new_name, temp_ch)) > -1) {
free_char(temp_ch);
send_to_char(ch, "Sorry, the new name already exists.\r\n");
return FALSE;
}
}
/* New playername is OK - find the entry in the index */
for (i = 0; i <= top_of_p_table; i++)
if (player_table[i].id == GET_IDNUM(vict))
break;
if (player_table[i].id != GET_IDNUM(vict))
{
send_to_char(ch, "Your target was not found in the player index.\r\n");
log("SYSERR: Player %s, with ID %ld, could not be found in the player index.", GET_NAME(vict), GET_IDNUM(vict));
return FALSE;
}
/* Set up a few variables that will be needed */
sprintf(old_name, "%s", GET_NAME(vict));
if (!get_filename(old_pfile, sizeof(old_pfile), PLR_FILE, old_name))
{
send_to_char(ch, "Unable to ascertain player's old pfile name.\r\n");
return FALSE;
}
if (!get_filename(new_pfile, sizeof(new_pfile), PLR_FILE, new_name))
{
send_to_char(ch, "Unable to ascertain player's new pfile name.\r\n");
return FALSE;
}
/* Now start changing the name over - all checks and setup have passed */
free(player_table[i].name); // Free the old name in the index
player_table[i].name = strdup(new_name); // Insert the new name into the index
for (k=0; (*(player_table[i].name+k) = LOWER(*(player_table[i].name+k))); k++);
free(GET_PC_NAME(vict));
GET_PC_NAME(vict) = strdup(CAP(new_name)); // Change the name in the victims char struct
/* Rename the player's pfile */
sprintf(buf, "mv %s %s", old_pfile, new_pfile);
j = system(buf);
/* Save the changed player index - the pfile is saved by perform_set, even though it is theorhetically un-necessary in this case */
save_player_index();
mudlog(BRF, LVL_IMMORT, TRUE, "(GC) %s changed the name of %s to %s", GET_NAME(ch), old_name, new_name);
if (vict->desc) /* Descriptor is set if the victim is logged in */
send_to_char(vict, "Your login name has changed from %s%s%s to %s%s%s.\r\n", CCYEL(vict, C_NRM), old_name, CCNRM(vict, C_NRM),
CCYEL(vict, C_NRM), new_name, CCNRM(vict, C_NRM));
return TRUE;
}

View file

@ -41,7 +41,6 @@
static int perform_dupe_check(struct descriptor_data *d); static int perform_dupe_check(struct descriptor_data *d);
static struct alias_data *find_alias(struct alias_data *alias_list, char *str); static struct alias_data *find_alias(struct alias_data *alias_list, char *str);
static void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data *a); static void perform_complex_alias(struct txt_q *input_q, char *orig, struct alias_data *a);
static int reserved_word(char *argument);
static int _parse_name(char *arg, char *name); static int _parse_name(char *arg, char *name);
/* sort_commands utility */ /* sort_commands utility */
static int sort_commands_helper(const void *a, const void *b); static int sort_commands_helper(const void *a, const void *b);
@ -819,7 +818,7 @@ int fill_word(char *argument)
return (search_block(argument, fill, TRUE) >= 0); return (search_block(argument, fill, TRUE) >= 0);
} }
static int reserved_word(char *argument) int reserved_word(char *argument)
{ {
return (search_block(argument, reserved, TRUE) >= 0); return (search_block(argument, reserved, TRUE) >= 0);
} }

View file

@ -1,13 +1,13 @@
/** /**
* @file interpreter.h * @file interpreter.h
* Public procs, macro defs, subcommand defines for the command intepreter. * Public procs, macro defs, subcommand defines for the command intepreter.
* *
* Part of the core tbaMUD source code distribution, which is a derivative * Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD. * of, and continuation of, CircleMUD.
* *
* All rights reserved. See license for complete information. * All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*/ */
#ifndef _INTERPRETER_H_ #ifndef _INTERPRETER_H_
#define _INTERPRETER_H_ #define _INTERPRETER_H_
@ -28,6 +28,7 @@ char *one_word(char *argument, char *first_arg);
char *any_one_arg(char *argument, char *first_arg); char *any_one_arg(char *argument, char *first_arg);
char *two_arguments(char *argument, char *first_arg, char *second_arg); char *two_arguments(char *argument, char *first_arg, char *second_arg);
int fill_word(char *argument); int fill_word(char *argument);
int reserved_word(char *argument);
void half_chop(char *string, char *arg1, char *arg2); void half_chop(char *string, char *arg1, char *arg2);
void nanny(struct descriptor_data *d, char *arg); void nanny(struct descriptor_data *d, char *arg);
int is_abbrev(const char *arg1, const char *arg2); int is_abbrev(const char *arg1, const char *arg2);
@ -62,12 +63,12 @@ struct command_info {
int subcmd; int subcmd;
}; };
struct mob_script_command_t { struct mob_script_command_t {
const char *command_name; const char *command_name;
void (*command_pointer) void (*command_pointer)
(struct char_data *ch, char *argument, int cmd, int subcmd); (struct char_data *ch, char *argument, int cmd, int subcmd);
int subcmd; int subcmd;
}; };
struct alias_data { struct alias_data {
char *alias; char *alias;
@ -87,16 +88,16 @@ struct alias_data {
* of the subcommands are independent from function to function.*/ * of the subcommands are independent from function to function.*/
/* directions */ /* directions */
/* do_move /* do_move
* *
* Make sure the SCMD_XX directions are mapped * Make sure the SCMD_XX directions are mapped
* to the cardinal directions. * to the cardinal directions.
*/ */
#define SCMD_NORTH NORTH #define SCMD_NORTH NORTH
#define SCMD_EAST EAST #define SCMD_EAST EAST
#define SCMD_SOUTH SOUTH #define SCMD_SOUTH SOUTH
#define SCMD_WEST WEST #define SCMD_WEST WEST
#define SCMD_UP UP #define SCMD_UP UP
#define SCMD_DOWN DOWN #define SCMD_DOWN DOWN
/** @deprecated all old do_poof stuff is deprecated and unused. */ /** @deprecated all old do_poof stuff is deprecated and unused. */
@ -121,7 +122,7 @@ struct alias_data {
extern int *cmd_sort_info; extern int *cmd_sort_info;
extern struct command_info *complete_cmd_info; extern struct command_info *complete_cmd_info;
extern const struct command_info cmd_info[]; extern const struct command_info cmd_info[];
#endif /* __INTERPRETER_C__ */ #endif /* __INTERPRETER_C__ */
#endif /* _INTERPRETER_H_ */ #endif /* _INTERPRETER_H_ */