mirror of
https://github.com/tbamud/tbamud.git
synced 2025-12-23 18:50:13 +01:00
Message Editor, Debugger Toggle, Hedit Fix, Code Cleanup, MUD Colour Adjustment
This commit is contained in:
parent
170173010b
commit
60d5836959
20 changed files with 885 additions and 165 deletions
|
|
@ -491,7 +491,7 @@ void look_at_room(struct char_data *ch, int ignore_brief)
|
||||||
|
|
||||||
sprintbitarray(ROOM_FLAGS(IN_ROOM(ch)), room_bits, RF_ARRAY_MAX, buf);
|
sprintbitarray(ROOM_FLAGS(IN_ROOM(ch)), room_bits, RF_ARRAY_MAX, buf);
|
||||||
send_to_char(ch, "[%5d] ", GET_ROOM_VNUM(IN_ROOM(ch)));
|
send_to_char(ch, "[%5d] ", GET_ROOM_VNUM(IN_ROOM(ch)));
|
||||||
send_to_char(ch, "%s [ %s] ", world[IN_ROOM(ch)].name, buf);
|
send_to_char(ch, "%s [ %s] [ %s ]", world[IN_ROOM(ch)].name, buf, sector_types[world[IN_ROOM(ch)].sector_type]);
|
||||||
|
|
||||||
if (SCRIPT(rm)) {
|
if (SCRIPT(rm)) {
|
||||||
send_to_char(ch, "[T");
|
send_to_char(ch, "[T");
|
||||||
|
|
@ -1032,12 +1032,16 @@ int search_help(const char *argument, int level)
|
||||||
|
|
||||||
while (level < help_table[mid].min_level && mid < (bot + top) / 2)
|
while (level < help_table[mid].min_level && mid < (bot + top) / 2)
|
||||||
mid++;
|
mid++;
|
||||||
|
|
||||||
// if (strn_cmp(argument, help_table[mid].keywords, minlen) || level < help_table[mid].min_level)
|
/* The following line was commented out at some point, by someone, for some reason...
|
||||||
if (strn_cmp(argument, help_table[mid].keywords, minlen))
|
* as I am unaware of that reason, and without a level check all help files, including
|
||||||
|
* the ones we may not want a player to see, are available. So I'm reversing this now.
|
||||||
|
* -Vat */
|
||||||
|
if (strn_cmp(argument, help_table[mid].keywords, minlen) || level < help_table[mid].min_level)
|
||||||
|
/*if (strn_cmp(argument, help_table[mid].keywords, minlen))*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
return mid;
|
return (mid);
|
||||||
}
|
}
|
||||||
else if (chk > 0)
|
else if (chk > 0)
|
||||||
bot = mid + 1;
|
bot = mid + 1;
|
||||||
|
|
@ -1087,7 +1091,7 @@ ACMD(do_help)
|
||||||
send_to_char(ch, "\r\nDid you mean:\r\n");
|
send_to_char(ch, "\r\nDid you mean:\r\n");
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
send_to_char(ch, " %s\r\n", help_table[i].keywords);
|
send_to_char(ch, " \t<send link=\"Help %s\">%s\t</send>\r\n", help_table[i].keywords, help_table[i].keywords);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
@ -1407,7 +1411,7 @@ ACMD(do_users)
|
||||||
}
|
}
|
||||||
} /* end while (parser) */
|
} /* end while (parser) */
|
||||||
send_to_char(ch,
|
send_to_char(ch,
|
||||||
"Num Class Name State Idl Login@@ Site\r\n"
|
"Num Class Name State Idl Login\t* Site\r\n"
|
||||||
"--- ------- ------------ -------------- ----- -------- ------------------------\r\n");
|
"--- ------- ------------ -------------- ----- -------- ------------------------\r\n");
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
@ -1419,23 +1423,23 @@ ACMD(do_users)
|
||||||
continue;
|
continue;
|
||||||
if (IS_PLAYING(d)) {
|
if (IS_PLAYING(d)) {
|
||||||
if (d->original)
|
if (d->original)
|
||||||
tch = d->original;
|
tch = d->original;
|
||||||
else if (!(tch = d->character))
|
else if (!(tch = d->character))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (*host_search && !strstr(d->host, host_search))
|
if (*host_search && !strstr(d->host, host_search))
|
||||||
continue;
|
continue;
|
||||||
if (*name_search && str_cmp(GET_NAME(tch), name_search))
|
if (*name_search && str_cmp(GET_NAME(tch), name_search))
|
||||||
continue;
|
continue;
|
||||||
if (!CAN_SEE(ch, tch) || GET_LEVEL(tch) < low || GET_LEVEL(tch) > high)
|
if (!CAN_SEE(ch, tch) || GET_LEVEL(tch) < low || GET_LEVEL(tch) > high)
|
||||||
continue;
|
continue;
|
||||||
if (outlaws && !PLR_FLAGGED(tch, PLR_KILLER) &&
|
if (outlaws && !PLR_FLAGGED(tch, PLR_KILLER) &&
|
||||||
!PLR_FLAGGED(tch, PLR_THIEF))
|
!PLR_FLAGGED(tch, PLR_THIEF))
|
||||||
continue;
|
continue;
|
||||||
if (showclass && !(showclass & (1 << GET_CLASS(tch))))
|
if (showclass && !(showclass & (1 << GET_CLASS(tch))))
|
||||||
continue;
|
continue;
|
||||||
if (GET_INVIS_LEV(tch) > GET_LEVEL(ch))
|
if (GET_INVIS_LEV(tch) > GET_LEVEL(ch))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (d->original)
|
if (d->original)
|
||||||
sprintf(classname, "[%2d %s]", GET_LEVEL(d->original),
|
sprintf(classname, "[%2d %s]", GET_LEVEL(d->original),
|
||||||
|
|
@ -2422,7 +2426,7 @@ ACMD(do_whois)
|
||||||
|
|
||||||
if (!got_from_file && victim->desc != NULL && GET_LEVEL(ch) >= LVL_GOD) {
|
if (!got_from_file && victim->desc != NULL && GET_LEVEL(ch) >= LVL_GOD) {
|
||||||
protocol_t * prot = victim->desc->pProtocol;
|
protocol_t * prot = victim->desc->pProtocol;
|
||||||
send_to_char(ch, "Client: %s\r\n", prot->pVariables[eMSDP_CLIENT_ID]->pValueString);
|
send_to_char(ch, "Client: %s [%s]\r\n", prot->pVariables[eMSDP_CLIENT_ID]->pValueString, prot->pVariables[eMSDP_CLIENT_VERSION]->pValueString ? prot->pVariables[eMSDP_CLIENT_VERSION]->pValueString : "Unknown");
|
||||||
send_to_char(ch, "Color: %s\r\n", prot->pVariables[eMSDP_XTERM_256_COLORS]->ValueInt ? "Xterm" : (prot->pVariables[eMSDP_ANSI_COLORS]->ValueInt ? "Ansi" : "None"));
|
send_to_char(ch, "Color: %s\r\n", prot->pVariables[eMSDP_XTERM_256_COLORS]->ValueInt ? "Xterm" : (prot->pVariables[eMSDP_ANSI_COLORS]->ValueInt ? "Ansi" : "None"));
|
||||||
send_to_char(ch, "MXP: %s\r\n", prot->bMXP ? "Yes" : "No");
|
send_to_char(ch, "MXP: %s\r\n", prot->bMXP ? "Yes" : "No");
|
||||||
send_to_char(ch, "Charset: %s\r\n", prot->bCHARSET ? "Yes" : "No");
|
send_to_char(ch, "Charset: %s\r\n", prot->bCHARSET ? "Yes" : "No");
|
||||||
|
|
|
||||||
45
src/cedit.c
45
src/cedit.c
|
|
@ -132,6 +132,7 @@ static void cedit_setup(struct descriptor_data *d)
|
||||||
OLC_CONFIG(d)->operation.ibt_autosave = CONFIG_IBT_AUTOSAVE;
|
OLC_CONFIG(d)->operation.ibt_autosave = CONFIG_IBT_AUTOSAVE;
|
||||||
OLC_CONFIG(d)->operation.protocol_negotiation = CONFIG_PROTOCOL_NEGOTIATION;
|
OLC_CONFIG(d)->operation.protocol_negotiation = CONFIG_PROTOCOL_NEGOTIATION;
|
||||||
OLC_CONFIG(d)->operation.special_in_comm = CONFIG_SPECIAL_IN_COMM;
|
OLC_CONFIG(d)->operation.special_in_comm = CONFIG_SPECIAL_IN_COMM;
|
||||||
|
OLC_CONFIG(d)->operation.debug_mode = CONFIG_DEBUG_MODE;
|
||||||
|
|
||||||
/* Autowiz */
|
/* Autowiz */
|
||||||
OLC_CONFIG(d)->autowiz.use_autowiz = CONFIG_USE_AUTOWIZ;
|
OLC_CONFIG(d)->autowiz.use_autowiz = CONFIG_USE_AUTOWIZ;
|
||||||
|
|
@ -234,7 +235,8 @@ static void cedit_save_internally(struct descriptor_data *d)
|
||||||
CONFIG_IBT_AUTOSAVE = OLC_CONFIG(d)->operation.ibt_autosave;
|
CONFIG_IBT_AUTOSAVE = OLC_CONFIG(d)->operation.ibt_autosave;
|
||||||
CONFIG_PROTOCOL_NEGOTIATION = OLC_CONFIG(d)->operation.protocol_negotiation;
|
CONFIG_PROTOCOL_NEGOTIATION = OLC_CONFIG(d)->operation.protocol_negotiation;
|
||||||
CONFIG_SPECIAL_IN_COMM = OLC_CONFIG(d)->operation.special_in_comm;
|
CONFIG_SPECIAL_IN_COMM = OLC_CONFIG(d)->operation.special_in_comm;
|
||||||
|
CONFIG_DEBUG_MODE = OLC_CONFIG(d)->operation.debug_mode;
|
||||||
|
|
||||||
/* Autowiz */
|
/* Autowiz */
|
||||||
CONFIG_USE_AUTOWIZ = OLC_CONFIG(d)->autowiz.use_autowiz;
|
CONFIG_USE_AUTOWIZ = OLC_CONFIG(d)->autowiz.use_autowiz;
|
||||||
CONFIG_MIN_WIZLIST_LEV = OLC_CONFIG(d)->autowiz.min_wizlist_lev;
|
CONFIG_MIN_WIZLIST_LEV = OLC_CONFIG(d)->autowiz.min_wizlist_lev;
|
||||||
|
|
@ -551,6 +553,10 @@ int save_config( IDXTYPE nowhere )
|
||||||
fprintf(fl, "* If yes, enable the special character in comm channels.\n"
|
fprintf(fl, "* If yes, enable the special character in comm channels.\n"
|
||||||
"special_in_comm = %d\n\n",
|
"special_in_comm = %d\n\n",
|
||||||
CONFIG_SPECIAL_IN_COMM);
|
CONFIG_SPECIAL_IN_COMM);
|
||||||
|
|
||||||
|
fprintf(fl, "* If 0 then off, otherwise 1: Brief, 2: Normal, 3: Complete.\n"
|
||||||
|
"debug_mode = %d\n\n",
|
||||||
|
CONFIG_DEBUG_MODE);
|
||||||
|
|
||||||
fclose(fl);
|
fclose(fl);
|
||||||
|
|
||||||
|
|
@ -738,6 +744,7 @@ static void cedit_disp_operation_options(struct descriptor_data *d)
|
||||||
"%sP%s) Autosave bugs when resolved from commandline : %s%s\r\n"
|
"%sP%s) Autosave bugs when resolved from commandline : %s%s\r\n"
|
||||||
"%sR%s) Enable Protocol Negotiation : %s%s\r\n"
|
"%sR%s) Enable Protocol Negotiation : %s%s\r\n"
|
||||||
"%sS%s) Enable Special Char in Comm : %s%s\r\n"
|
"%sS%s) Enable Special Char in Comm : %s%s\r\n"
|
||||||
|
"%sT%s) Current Debug Mode : %s%s\r\n"
|
||||||
"%sQ%s) Exit To The Main Menu\r\n"
|
"%sQ%s) Exit To The Main Menu\r\n"
|
||||||
"Enter your choice : ",
|
"Enter your choice : ",
|
||||||
grn, nrm, cyn, OLC_CONFIG(d)->operation.DFLT_PORT,
|
grn, nrm, cyn, OLC_CONFIG(d)->operation.DFLT_PORT,
|
||||||
|
|
@ -758,6 +765,7 @@ static void cedit_disp_operation_options(struct descriptor_data *d)
|
||||||
grn, nrm, cyn, OLC_CONFIG(d)->operation.ibt_autosave ? "Yes" : "No",
|
grn, nrm, cyn, OLC_CONFIG(d)->operation.ibt_autosave ? "Yes" : "No",
|
||||||
grn, nrm, cyn, OLC_CONFIG(d)->operation.protocol_negotiation ? "Yes" : "No",
|
grn, nrm, cyn, OLC_CONFIG(d)->operation.protocol_negotiation ? "Yes" : "No",
|
||||||
grn, nrm, cyn, OLC_CONFIG(d)->operation.special_in_comm ? "Yes" : "No",
|
grn, nrm, cyn, OLC_CONFIG(d)->operation.special_in_comm ? "Yes" : "No",
|
||||||
|
grn, nrm, cyn, OLC_CONFIG(d)->operation.debug_mode == 0 ? "OFF" : (OLC_CONFIG(d)->operation.debug_mode == 1 ? "BRIEF" : (OLC_CONFIG(d)->operation.debug_mode == 2 ? "NORMAL" : "COMPLETE")),
|
||||||
grn, nrm
|
grn, nrm
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1226,20 +1234,26 @@ void cedit_parse(struct descriptor_data *d, char *arg)
|
||||||
TOGGLE_VAR(OLC_CONFIG(d)->operation.medit_advanced);
|
TOGGLE_VAR(OLC_CONFIG(d)->operation.medit_advanced);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
case 'P':
|
case 'P':
|
||||||
TOGGLE_VAR(OLC_CONFIG(d)->operation.ibt_autosave);
|
TOGGLE_VAR(OLC_CONFIG(d)->operation.ibt_autosave);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
case 'R':
|
case 'R':
|
||||||
TOGGLE_VAR(OLC_CONFIG(d)->operation.protocol_negotiation);
|
TOGGLE_VAR(OLC_CONFIG(d)->operation.protocol_negotiation);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
case 'S':
|
case 'S':
|
||||||
TOGGLE_VAR(OLC_CONFIG(d)->operation.special_in_comm);
|
TOGGLE_VAR(OLC_CONFIG(d)->operation.special_in_comm);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 't':
|
||||||
|
case 'T':
|
||||||
|
write_to_output(d, "Enter the current debug level (0: Off, 1: Brief, 2: Normal, 3: Complete) : ");
|
||||||
|
OLC_MODE(d) = CEDIT_DEBUG_MODE;
|
||||||
|
return;
|
||||||
|
|
||||||
case 'q':
|
case 'q':
|
||||||
case 'Q':
|
case 'Q':
|
||||||
|
|
@ -1614,6 +1628,11 @@ void cedit_parse(struct descriptor_data *d, char *arg)
|
||||||
cedit_disp_operation_options(d);
|
cedit_disp_operation_options(d);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CEDIT_DEBUG_MODE:
|
||||||
|
OLC_CONFIG(d)->operation.debug_mode = LIMIT(atoi(arg), 0, 3);
|
||||||
|
cedit_disp_operation_options(d);
|
||||||
|
break;
|
||||||
|
|
||||||
case CEDIT_MIN_WIZLIST_LEV:
|
case CEDIT_MIN_WIZLIST_LEV:
|
||||||
if (atoi(arg) > LVL_IMPL) {
|
if (atoi(arg) > LVL_IMPL) {
|
||||||
write_to_output(d,
|
write_to_output(d,
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@
|
||||||
#include "boards.h"
|
#include "boards.h"
|
||||||
#include "act.h"
|
#include "act.h"
|
||||||
#include "ban.h"
|
#include "ban.h"
|
||||||
|
#include "msgedit.h"
|
||||||
#include "fight.h"
|
#include "fight.h"
|
||||||
#include "spells.h" /* for affect_update */
|
#include "spells.h" /* for affect_update */
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
|
|
@ -1432,7 +1433,7 @@ static int set_sendbuf(socket_t s)
|
||||||
/* Initialize a descriptor */
|
/* Initialize a descriptor */
|
||||||
static void init_descriptor (struct descriptor_data *newd, int desc)
|
static void init_descriptor (struct descriptor_data *newd, int desc)
|
||||||
{
|
{
|
||||||
static int last_desc = 0; /* last descriptor number */
|
static int last_desc = 0; /* last descriptor number */
|
||||||
|
|
||||||
newd->descriptor = desc;
|
newd->descriptor = desc;
|
||||||
newd->idle_tics = 0;
|
newd->idle_tics = 0;
|
||||||
|
|
@ -2111,6 +2112,7 @@ void close_socket(struct descriptor_data *d)
|
||||||
case CON_AEDIT:
|
case CON_AEDIT:
|
||||||
case CON_HEDIT:
|
case CON_HEDIT:
|
||||||
case CON_QEDIT:
|
case CON_QEDIT:
|
||||||
|
case CON_MSGEDIT:
|
||||||
cleanup_olc(d, CLEANUP_ALL);
|
cleanup_olc(d, CLEANUP_ALL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -314,3 +314,6 @@ int protocol_negotiation = YES;
|
||||||
|
|
||||||
/* Use the special character in communication channels */
|
/* Use the special character in communication channels */
|
||||||
int special_in_comm = YES;
|
int special_in_comm = YES;
|
||||||
|
|
||||||
|
/* Current Debug Mode */
|
||||||
|
int debug_mode = OFF;
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ extern int min_wizlist_lev;
|
||||||
extern int display_closed_doors;
|
extern int display_closed_doors;
|
||||||
extern int protocol_negotiation;
|
extern int protocol_negotiation;
|
||||||
extern int special_in_comm;
|
extern int special_in_comm;
|
||||||
|
extern int debug_mode;
|
||||||
/* Automap and map options */
|
/* Automap and map options */
|
||||||
extern int map_option;
|
extern int map_option;
|
||||||
extern int default_map_size;
|
extern int default_map_size;
|
||||||
|
|
|
||||||
|
|
@ -321,6 +321,7 @@ const char *connected_types[] = {
|
||||||
"Quest edit",
|
"Quest edit",
|
||||||
"Preference edit",
|
"Preference edit",
|
||||||
"IBT edit",
|
"IBT edit",
|
||||||
|
"Message edit",
|
||||||
"Protocol Detection",
|
"Protocol Detection",
|
||||||
"\n"
|
"\n"
|
||||||
};
|
};
|
||||||
|
|
|
||||||
6
src/db.c
6
src/db.c
|
|
@ -38,6 +38,7 @@
|
||||||
#include "quest.h"
|
#include "quest.h"
|
||||||
#include "ibt.h"
|
#include "ibt.h"
|
||||||
#include "mud_event.h"
|
#include "mud_event.h"
|
||||||
|
#include "msgedit.h"
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
/* declarations of most of the 'global' variables */
|
/* declarations of most of the 'global' variables */
|
||||||
|
|
@ -3781,6 +3782,7 @@ static void load_default_config( void )
|
||||||
CONFIG_MAP_SIZE = default_map_size;
|
CONFIG_MAP_SIZE = default_map_size;
|
||||||
CONFIG_MINIMAP_SIZE = default_minimap_size;
|
CONFIG_MINIMAP_SIZE = default_minimap_size;
|
||||||
CONFIG_SCRIPT_PLAYERS = script_players;
|
CONFIG_SCRIPT_PLAYERS = script_players;
|
||||||
|
CONFIG_DEBUG_MODE = debug_mode;
|
||||||
|
|
||||||
/* Rent / crashsave options. */
|
/* Rent / crashsave options. */
|
||||||
CONFIG_FREE_RENT = free_rent;
|
CONFIG_FREE_RENT = free_rent;
|
||||||
|
|
@ -3869,7 +3871,9 @@ void load_config( void )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
if (!str_cmp(tag, "display_closed_doors"))
|
if (!str_cmp(tag, "debug_mode"))
|
||||||
|
CONFIG_DEBUG_MODE = num;
|
||||||
|
else if (!str_cmp(tag, "display_closed_doors"))
|
||||||
CONFIG_DISP_CLOSED_DOORS = num;
|
CONFIG_DISP_CLOSED_DOORS = num;
|
||||||
else if (!str_cmp(tag, "diagonal_dirs"))
|
else if (!str_cmp(tag, "diagonal_dirs"))
|
||||||
CONFIG_DIAGONAL_DIRS = num;
|
CONFIG_DIAGONAL_DIRS = num;
|
||||||
|
|
|
||||||
161
src/fight.c
161
src/fight.c
|
|
@ -58,7 +58,6 @@ static struct char_data *next_combat_list = NULL;
|
||||||
/* local file scope utility functions */
|
/* local file scope utility functions */
|
||||||
static void perform_group_gain(struct char_data *ch, int base, struct char_data *victim);
|
static void perform_group_gain(struct char_data *ch, int base, struct char_data *victim);
|
||||||
static void dam_message(int dam, struct char_data *ch, struct char_data *victim, int w_type);
|
static void dam_message(int dam, struct char_data *ch, struct char_data *victim, int w_type);
|
||||||
static void free_messages_type(struct msg_type *msg);
|
|
||||||
static void make_corpse(struct char_data *ch);
|
static void make_corpse(struct char_data *ch);
|
||||||
static void change_alignment(struct char_data *ch, struct char_data *victim);
|
static void change_alignment(struct char_data *ch, struct char_data *victim);
|
||||||
static void group_gain(struct char_data *ch, struct char_data *victim);
|
static void group_gain(struct char_data *ch, struct char_data *victim);
|
||||||
|
|
@ -95,89 +94,6 @@ int compute_armor_class(struct char_data *ch)
|
||||||
return (MAX(-100, armorclass)); /* -100 is lowest */
|
return (MAX(-100, armorclass)); /* -100 is lowest */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_messages_type(struct msg_type *msg)
|
|
||||||
{
|
|
||||||
if (msg->attacker_msg) free(msg->attacker_msg);
|
|
||||||
if (msg->victim_msg) free(msg->victim_msg);
|
|
||||||
if (msg->room_msg) free(msg->room_msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void free_messages(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_MESSAGES; i++)
|
|
||||||
while (fight_messages[i].msg) {
|
|
||||||
struct message_type *former = fight_messages[i].msg;
|
|
||||||
|
|
||||||
free_messages_type(&former->die_msg);
|
|
||||||
free_messages_type(&former->miss_msg);
|
|
||||||
free_messages_type(&former->hit_msg);
|
|
||||||
free_messages_type(&former->god_msg);
|
|
||||||
|
|
||||||
fight_messages[i].msg = fight_messages[i].msg->next;
|
|
||||||
free(former);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void load_messages(void)
|
|
||||||
{
|
|
||||||
FILE *fl;
|
|
||||||
int i, type;
|
|
||||||
struct message_type *messages;
|
|
||||||
char chk[128], *buf;
|
|
||||||
|
|
||||||
if (!(fl = fopen(MESS_FILE, "r"))) {
|
|
||||||
log("SYSERR: Error reading combat message file %s: %s", MESS_FILE, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_MESSAGES; i++) {
|
|
||||||
fight_messages[i].a_type = 0;
|
|
||||||
fight_messages[i].number_of_attacks = 0;
|
|
||||||
fight_messages[i].msg = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!feof(fl)) {
|
|
||||||
buf = fgets(chk, 128, fl);
|
|
||||||
while (!feof(fl) && (*chk == '\n' || *chk == '*'))
|
|
||||||
buf = fgets(chk, 128, fl);
|
|
||||||
|
|
||||||
while (*chk == 'M') {
|
|
||||||
buf = fgets(chk, 128, fl);
|
|
||||||
sscanf(chk, " %d\n", &type);
|
|
||||||
for (i = 0; (i < MAX_MESSAGES) && (fight_messages[i].a_type != type) &&
|
|
||||||
(fight_messages[i].a_type); i++);
|
|
||||||
if (i >= MAX_MESSAGES) {
|
|
||||||
log("SYSERR: Too many combat messages. Increase MAX_MESSAGES and recompile.");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
CREATE(messages, struct message_type, 1);
|
|
||||||
fight_messages[i].number_of_attacks++;
|
|
||||||
fight_messages[i].a_type = type;
|
|
||||||
messages->next = fight_messages[i].msg;
|
|
||||||
fight_messages[i].msg = messages;
|
|
||||||
|
|
||||||
messages->die_msg.attacker_msg = fread_action(fl, i);
|
|
||||||
messages->die_msg.victim_msg = fread_action(fl, i);
|
|
||||||
messages->die_msg.room_msg = fread_action(fl, i);
|
|
||||||
messages->miss_msg.attacker_msg = fread_action(fl, i);
|
|
||||||
messages->miss_msg.victim_msg = fread_action(fl, i);
|
|
||||||
messages->miss_msg.room_msg = fread_action(fl, i);
|
|
||||||
messages->hit_msg.attacker_msg = fread_action(fl, i);
|
|
||||||
messages->hit_msg.victim_msg = fread_action(fl, i);
|
|
||||||
messages->hit_msg.room_msg = fread_action(fl, i);
|
|
||||||
messages->god_msg.attacker_msg = fread_action(fl, i);
|
|
||||||
messages->god_msg.victim_msg = fread_action(fl, i);
|
|
||||||
messages->god_msg.room_msg = fread_action(fl, i);
|
|
||||||
buf = fgets(chk, 128, fl);
|
|
||||||
while (!feof(fl) && (*chk == '\n' || *chk == '*'))
|
|
||||||
buf = fgets(chk, 128, fl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(fl);
|
|
||||||
}
|
|
||||||
|
|
||||||
void update_pos(struct char_data *victim)
|
void update_pos(struct char_data *victim)
|
||||||
{
|
{
|
||||||
if ((GET_HIT(victim) > 0) && (GET_POS(victim) > POS_STUNNED))
|
if ((GET_HIT(victim) > 0) && (GET_POS(victim) > POS_STUNNED))
|
||||||
|
|
@ -204,7 +120,7 @@ void check_killer(struct char_data *ch, struct char_data *vict)
|
||||||
SET_BIT_AR(PLR_FLAGS(ch), PLR_KILLER);
|
SET_BIT_AR(PLR_FLAGS(ch), PLR_KILLER);
|
||||||
send_to_char(ch, "If you want to be a PLAYER KILLER, so be it...\r\n");
|
send_to_char(ch, "If you want to be a PLAYER KILLER, so be it...\r\n");
|
||||||
mudlog(BRF, LVL_IMMORT, TRUE, "PC Killer bit set on %s for initiating attack on %s at %s.",
|
mudlog(BRF, LVL_IMMORT, TRUE, "PC Killer bit set on %s for initiating attack on %s at %s.",
|
||||||
GET_NAME(ch), GET_NAME(vict), world[IN_ROOM(vict)].name);
|
GET_NAME(ch), GET_NAME(vict), world[IN_ROOM(vict)].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* start one char fighting another (yes, it is horrible, I know... ) */
|
/* start one char fighting another (yes, it is horrible, I know... ) */
|
||||||
|
|
@ -605,58 +521,60 @@ int skill_message(int dam, struct char_data *ch, struct char_data *vict,
|
||||||
|
|
||||||
struct obj_data *weap = GET_EQ(ch, WEAR_WIELD);
|
struct obj_data *weap = GET_EQ(ch, WEAR_WIELD);
|
||||||
|
|
||||||
|
/* @todo restructure the messages library to a pointer based system as
|
||||||
|
* opposed to the current cyclic location system. */
|
||||||
for (i = 0; i < MAX_MESSAGES; i++) {
|
for (i = 0; i < MAX_MESSAGES; i++) {
|
||||||
if (fight_messages[i].a_type == attacktype) {
|
if (fight_messages[i].a_type == attacktype) {
|
||||||
nr = dice(1, fight_messages[i].number_of_attacks);
|
nr = dice(1, fight_messages[i].number_of_attacks);
|
||||||
for (j = 1, msg = fight_messages[i].msg; (j < nr) && msg; j++)
|
for (j = 1, msg = fight_messages[i].msg; (j < nr) && msg; j++)
|
||||||
msg = msg->next;
|
msg = msg->next;
|
||||||
|
|
||||||
if (!IS_NPC(vict) && (GET_LEVEL(vict) >= LVL_IMPL)) {
|
if (!IS_NPC(vict) && (GET_LEVEL(vict) >= LVL_IMPL)) {
|
||||||
act(msg->god_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR);
|
act(msg->god_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR);
|
||||||
act(msg->god_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT);
|
act(msg->god_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT);
|
||||||
act(msg->god_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT);
|
act(msg->god_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT);
|
||||||
} else if (dam != 0) {
|
} else if (dam != 0) {
|
||||||
/*
|
/*
|
||||||
* Don't send redundant color codes for TYPE_SUFFERING & other types
|
* Don't send redundant color codes for TYPE_SUFFERING & other types
|
||||||
* of damage without attacker_msg.
|
* of damage without attacker_msg.
|
||||||
*/
|
*/
|
||||||
if (GET_POS(vict) == POS_DEAD) {
|
if (GET_POS(vict) == POS_DEAD) {
|
||||||
if (msg->die_msg.attacker_msg) {
|
if (msg->die_msg.attacker_msg) {
|
||||||
send_to_char(ch, CCYEL(ch, C_CMP));
|
send_to_char(ch, CCYEL(ch, C_CMP));
|
||||||
act(msg->die_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR);
|
act(msg->die_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR);
|
||||||
send_to_char(ch, CCNRM(ch, C_CMP));
|
send_to_char(ch, CCNRM(ch, C_CMP));
|
||||||
}
|
}
|
||||||
|
|
||||||
send_to_char(vict, CCRED(vict, C_CMP));
|
send_to_char(vict, CCRED(vict, C_CMP));
|
||||||
act(msg->die_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP);
|
act(msg->die_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP);
|
||||||
send_to_char(vict, CCNRM(vict, C_CMP));
|
send_to_char(vict, CCNRM(vict, C_CMP));
|
||||||
|
|
||||||
act(msg->die_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT);
|
act(msg->die_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT);
|
||||||
} else {
|
} else {
|
||||||
if (msg->hit_msg.attacker_msg) {
|
if (msg->hit_msg.attacker_msg) {
|
||||||
send_to_char(ch, CCYEL(ch, C_CMP));
|
send_to_char(ch, CCYEL(ch, C_CMP));
|
||||||
act(msg->hit_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR);
|
act(msg->hit_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR);
|
||||||
send_to_char(ch, CCNRM(ch, C_CMP));
|
send_to_char(ch, CCNRM(ch, C_CMP));
|
||||||
}
|
}
|
||||||
|
|
||||||
send_to_char(vict, CCRED(vict, C_CMP));
|
send_to_char(vict, CCRED(vict, C_CMP));
|
||||||
act(msg->hit_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP);
|
act(msg->hit_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP);
|
||||||
send_to_char(vict, CCNRM(vict, C_CMP));
|
send_to_char(vict, CCNRM(vict, C_CMP));
|
||||||
|
|
||||||
act(msg->hit_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT);
|
act(msg->hit_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT);
|
||||||
}
|
}
|
||||||
} else if (ch != vict) { /* Dam == 0 */
|
} else if (ch != vict) { /* Dam == 0 */
|
||||||
if (msg->miss_msg.attacker_msg) {
|
if (msg->miss_msg.attacker_msg) {
|
||||||
send_to_char(ch, CCYEL(ch, C_CMP));
|
send_to_char(ch, CCYEL(ch, C_CMP));
|
||||||
act(msg->miss_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR);
|
act(msg->miss_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR);
|
||||||
send_to_char(ch, CCNRM(ch, C_CMP));
|
send_to_char(ch, CCNRM(ch, C_CMP));
|
||||||
}
|
}
|
||||||
|
|
||||||
send_to_char(vict, CCRED(vict, C_CMP));
|
send_to_char(vict, CCRED(vict, C_CMP));
|
||||||
act(msg->miss_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP);
|
act(msg->miss_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP);
|
||||||
send_to_char(vict, CCNRM(vict, C_CMP));
|
send_to_char(vict, CCNRM(vict, C_CMP));
|
||||||
|
|
||||||
act(msg->miss_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT);
|
act(msg->miss_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT);
|
||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
@ -681,7 +599,7 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
log("SYSERR: Attempt to damage corpse '%s' in room #%d by '%s'.",
|
log("SYSERR: Attempt to damage corpse '%s' in room #%d by '%s'.",
|
||||||
GET_NAME(victim), GET_ROOM_VNUM(IN_ROOM(victim)), GET_NAME(ch));
|
GET_NAME(victim), GET_ROOM_VNUM(IN_ROOM(victim)), GET_NAME(ch));
|
||||||
die(victim, ch);
|
die(victim, ch);
|
||||||
return (-1); /* -je, 7/7/92 */
|
return (-1); /* -je, 7/7/92 */
|
||||||
}
|
}
|
||||||
|
|
@ -921,6 +839,11 @@ void hit(struct char_data *ch, struct char_data *victim, int type)
|
||||||
/* roll the die and take your chances... */
|
/* roll the die and take your chances... */
|
||||||
diceroll = rand_number(1, 20);
|
diceroll = rand_number(1, 20);
|
||||||
|
|
||||||
|
/* report for debugging if necessary */
|
||||||
|
if (CONFIG_DEBUG_MODE >= NRM)
|
||||||
|
send_to_char(ch, "\t1Debug:\r\n \t2Thaco: \t3%d\r\n \t2AC: \t3%d\r\n \t2Diceroll: \t3%d\tn\r\n",
|
||||||
|
calc_thaco, victim_ac, diceroll);
|
||||||
|
|
||||||
/* Decide whether this is a hit or a miss.
|
/* Decide whether this is a hit or a miss.
|
||||||
* Victim asleep = hit, otherwise:
|
* Victim asleep = hit, otherwise:
|
||||||
* 1 = Automatic miss.
|
* 1 = Automatic miss.
|
||||||
|
|
@ -948,10 +871,10 @@ void hit(struct char_data *ch, struct char_data *victim, int type)
|
||||||
dam += dice(GET_OBJ_VAL(wielded, 1), GET_OBJ_VAL(wielded, 2));
|
dam += dice(GET_OBJ_VAL(wielded, 1), GET_OBJ_VAL(wielded, 2));
|
||||||
} else {
|
} else {
|
||||||
/* If no weapon, add bare hand damage instead */
|
/* If no weapon, add bare hand damage instead */
|
||||||
if (IS_NPC(ch))
|
if (IS_NPC(ch))
|
||||||
dam += dice(ch->mob_specials.damnodice, ch->mob_specials.damsizedice);
|
dam += dice(ch->mob_specials.damnodice, ch->mob_specials.damsizedice);
|
||||||
else
|
else
|
||||||
dam += rand_number(0, 2); /* Max 2 bare hand damage for players */
|
dam += rand_number(0, 2); /* Max 2 bare hand damage for players */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Include a damage multiplier if victim isn't ready to fight:
|
/* Include a damage multiplier if victim isn't ready to fight:
|
||||||
|
|
@ -995,13 +918,13 @@ void perform_violence(void)
|
||||||
|
|
||||||
if (IS_NPC(ch)) {
|
if (IS_NPC(ch)) {
|
||||||
if (GET_MOB_WAIT(ch) > 0) {
|
if (GET_MOB_WAIT(ch) > 0) {
|
||||||
GET_MOB_WAIT(ch) -= PULSE_VIOLENCE;
|
GET_MOB_WAIT(ch) -= PULSE_VIOLENCE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
GET_MOB_WAIT(ch) = 0;
|
GET_MOB_WAIT(ch) = 0;
|
||||||
if (GET_POS(ch) < POS_FIGHTING) {
|
if (GET_POS(ch) < POS_FIGHTING) {
|
||||||
GET_POS(ch) = POS_FIGHTING;
|
GET_POS(ch) = POS_FIGHTING;
|
||||||
act("$n scrambles to $s feet!", TRUE, ch, 0, 0, TO_ROOM);
|
act("$n scrambles to $s feet!", TRUE, ch, 0, 0, TO_ROOM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,7 @@ int compute_armor_class(struct char_data *ch);
|
||||||
int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype);
|
int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype);
|
||||||
void death_cry(struct char_data *ch);
|
void death_cry(struct char_data *ch);
|
||||||
void die(struct char_data * ch, struct char_data * killer);
|
void die(struct char_data * ch, struct char_data * killer);
|
||||||
void free_messages(void);
|
|
||||||
void hit(struct char_data *ch, struct char_data *victim, int type);
|
void hit(struct char_data *ch, struct char_data *victim, int type);
|
||||||
void load_messages(void);
|
|
||||||
void perform_violence(void);
|
void perform_violence(void);
|
||||||
void raw_kill(struct char_data * ch, struct char_data * killer);
|
void raw_kill(struct char_data * ch, struct char_data * killer);
|
||||||
void set_fighting(struct char_data *ch, struct char_data *victim);
|
void set_fighting(struct char_data *ch, struct char_data *victim);
|
||||||
|
|
|
||||||
20
src/hedit.c
20
src/hedit.c
|
|
@ -37,6 +37,7 @@ ACMD(do_oasis_hedit)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct descriptor_data *d;
|
struct descriptor_data *d;
|
||||||
|
int i;
|
||||||
|
|
||||||
/* No building as a mob or while being forced. */
|
/* No building as a mob or while being forced. */
|
||||||
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
|
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
|
||||||
|
|
@ -80,13 +81,22 @@ ACMD(do_oasis_hedit)
|
||||||
CREATE(d->olc, struct oasis_olc_data, 1);
|
CREATE(d->olc, struct oasis_olc_data, 1);
|
||||||
OLC_NUM(d) = 0;
|
OLC_NUM(d) = 0;
|
||||||
OLC_STORAGE(d) = strdup(arg);
|
OLC_STORAGE(d) = strdup(arg);
|
||||||
|
|
||||||
OLC_ZNUM(d) = search_help(OLC_STORAGE(d), LVL_IMPL);
|
OLC_ZNUM(d) = search_help(OLC_STORAGE(d), LVL_IMPL);
|
||||||
|
|
||||||
|
if (help_table[OLC_ZNUM(d)].duplicate) {
|
||||||
|
for (i = 0; i < top_of_helpt; i++)
|
||||||
|
if (help_table[i].duplicate == 0 && help_table[i].entry == help_table[OLC_ZNUM(d)].entry) {
|
||||||
|
OLC_ZNUM(d) = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (OLC_ZNUM(d) == NOWHERE) {
|
if (OLC_ZNUM(d) == NOWHERE) {
|
||||||
send_to_char(ch, "Do you wish to add the '%s' help file? ", OLC_STORAGE(d));
|
send_to_char(ch, "Do you wish to add the '%s' help file? ", OLC_STORAGE(d));
|
||||||
OLC_MODE(d) = HEDIT_CONFIRM_ADD;
|
OLC_MODE(d) = HEDIT_CONFIRM_ADD;
|
||||||
} else {
|
} else {
|
||||||
send_to_char(ch, "Do you wish to edit the '%s' help file? ", help_table[OLC_ZNUM(d)].keywords);
|
send_to_char(ch, "Do you wish to edit the '%s' help file?", help_table[OLC_ZNUM(d)].keywords);
|
||||||
OLC_MODE(d) = HEDIT_CONFIRM_EDIT;
|
OLC_MODE(d) = HEDIT_CONFIRM_EDIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -132,6 +142,7 @@ static void hedit_save_internally(struct descriptor_data *d)
|
||||||
|
|
||||||
for (i = 0; i < top_of_helpt; i++)
|
for (i = 0; i < top_of_helpt; i++)
|
||||||
new_help_table[i] = help_table[i];
|
new_help_table[i] = help_table[i];
|
||||||
|
|
||||||
new_help_table[top_of_helpt++] = *OLC_HELP(d);
|
new_help_table[top_of_helpt++] = *OLC_HELP(d);
|
||||||
free(help_table);
|
free(help_table);
|
||||||
help_table = new_help_table;
|
help_table = new_help_table;
|
||||||
|
|
@ -397,8 +408,8 @@ ACMD(do_hindex)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = sprintf(buf, "Help index entries beginning with '%s':\r\n", argument);
|
len = sprintf(buf, "\t1Help index entries beginning with '%s':\t2\r\n", argument);
|
||||||
len2 = sprintf(buf2, "Help index entries containing '%s':\r\n", argument);
|
len2 = sprintf(buf2, "\t1Help index entries containing '%s':\t2\r\n", argument);
|
||||||
for (i = 0; i < top_of_helpt; i++) {
|
for (i = 0; i < top_of_helpt; i++) {
|
||||||
if (is_abbrev(argument, help_table[i].keywords)
|
if (is_abbrev(argument, help_table[i].keywords)
|
||||||
&& (GET_LEVEL(ch) >= help_table[i].min_level))
|
&& (GET_LEVEL(ch) >= help_table[i].min_level))
|
||||||
|
|
@ -424,5 +435,8 @@ ACMD(do_hindex)
|
||||||
// Join the two strings
|
// Join the two strings
|
||||||
len += snprintf(buf + len, sizeof(buf) - len, "%s", buf2);
|
len += snprintf(buf + len, sizeof(buf) - len, "%s", buf2);
|
||||||
|
|
||||||
|
len += snprintf(buf + len, sizeof(buf) - len, "\t1Applicable Index Entries: \t3%d\r\n"
|
||||||
|
"\t1Total Index Entries: \t3%d\tn\r\n", count + count2, top_of_helpt);
|
||||||
|
|
||||||
page_string(ch->desc, buf, TRUE);
|
page_string(ch->desc, buf, TRUE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -210,6 +210,7 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "medit" , "med" , POS_DEAD , do_oasis_medit, LVL_BUILDER, 0 },
|
{ "medit" , "med" , POS_DEAD , do_oasis_medit, LVL_BUILDER, 0 },
|
||||||
{ "mlist" , "mlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_MLIST },
|
{ "mlist" , "mlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_MLIST },
|
||||||
{ "mcopy" , "mcopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_MEDIT },
|
{ "mcopy" , "mcopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_MEDIT },
|
||||||
|
{ "msgedit" , "msgedit" , POS_DEAD , do_msgedit, LVL_GOD, 0 },
|
||||||
{ "mute" , "mute" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_MUTE },
|
{ "mute" , "mute" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_MUTE },
|
||||||
|
|
||||||
{ "news" , "news" , POS_SLEEPING, do_gen_ps , 0, SCMD_NEWS },
|
{ "news" , "news" , POS_SLEEPING, do_gen_ps , 0, SCMD_NEWS },
|
||||||
|
|
@ -1333,6 +1334,7 @@ void nanny(struct descriptor_data *d, char *arg)
|
||||||
{ CON_QEDIT, qedit_parse },
|
{ CON_QEDIT, qedit_parse },
|
||||||
{ CON_PREFEDIT, prefedit_parse },
|
{ CON_PREFEDIT, prefedit_parse },
|
||||||
{ CON_IBTEDIT, ibtedit_parse },
|
{ CON_IBTEDIT, ibtedit_parse },
|
||||||
|
{ CON_MSGEDIT, msgedit_parse },
|
||||||
{ -1, NULL }
|
{ -1, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
665
src/msgedit.c
Normal file
665
src/msgedit.c
Normal file
|
|
@ -0,0 +1,665 @@
|
||||||
|
/**************************************************************************
|
||||||
|
* File: msgedit.c Part of tbaMUD *
|
||||||
|
* Usage: Handling of loading/saving messages and the olc editor. *
|
||||||
|
* *
|
||||||
|
* By Vatiken. Copyright 2012 by Joseph Arnusch *
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include "conf.h"
|
||||||
|
#include "sysdep.h"
|
||||||
|
#include "structs.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "comm.h"
|
||||||
|
#include "screen.h"
|
||||||
|
#include "spells.h"
|
||||||
|
#include "db.h"
|
||||||
|
#include "msgedit.h"
|
||||||
|
#include "oasis.h"
|
||||||
|
#include "genolc.h"
|
||||||
|
#include "interpreter.h"
|
||||||
|
#include "modify.h"
|
||||||
|
|
||||||
|
/* Statics */
|
||||||
|
static void free_messages_type(struct msg_type *msg);
|
||||||
|
static void msgedit_main_menu(struct descriptor_data * d);
|
||||||
|
static void copy_message_strings(struct message_type *tmsg, struct message_type * fmsg);
|
||||||
|
static void copy_message_list(struct message_list *to, struct message_list *from);
|
||||||
|
|
||||||
|
static void free_messages_type(struct msg_type *msg)
|
||||||
|
{
|
||||||
|
if (msg->attacker_msg) { free(msg->attacker_msg); msg->attacker_msg = NULL; }
|
||||||
|
if (msg->victim_msg) { free(msg->victim_msg); msg->victim_msg = NULL; }
|
||||||
|
if (msg->room_msg) { free(msg->room_msg); msg->room_msg = NULL; }
|
||||||
|
}
|
||||||
|
|
||||||
|
void free_message_list(struct message_list * mlist)
|
||||||
|
{
|
||||||
|
struct message_type * msg, * orig;
|
||||||
|
|
||||||
|
msg = mlist->msg;
|
||||||
|
|
||||||
|
while (msg) {
|
||||||
|
orig = msg;
|
||||||
|
|
||||||
|
free_messages_type(&msg->die_msg);
|
||||||
|
free_messages_type(&msg->miss_msg);
|
||||||
|
free_messages_type(&msg->hit_msg);
|
||||||
|
free_messages_type(&msg->god_msg);
|
||||||
|
|
||||||
|
msg = msg->next;
|
||||||
|
free(orig);
|
||||||
|
}
|
||||||
|
free (mlist);
|
||||||
|
}
|
||||||
|
|
||||||
|
void free_messages(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < MAX_MESSAGES; i++)
|
||||||
|
while (fight_messages[i].msg) {
|
||||||
|
struct message_type *former = fight_messages[i].msg;
|
||||||
|
|
||||||
|
free_messages_type(&former->die_msg);
|
||||||
|
free_messages_type(&former->miss_msg);
|
||||||
|
free_messages_type(&former->hit_msg);
|
||||||
|
free_messages_type(&former->god_msg);
|
||||||
|
|
||||||
|
fight_messages[i].msg = fight_messages[i].msg->next;
|
||||||
|
free(former);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_messages(void)
|
||||||
|
{
|
||||||
|
FILE *fl;
|
||||||
|
int i, type;
|
||||||
|
struct message_type *messages;
|
||||||
|
char chk[128], *buf;
|
||||||
|
|
||||||
|
if (!(fl = fopen(MESS_FILE, "r"))) {
|
||||||
|
log("SYSERR: Error reading combat message file %s: %s", MESS_FILE, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < MAX_MESSAGES; i++) {
|
||||||
|
fight_messages[i].a_type = 0;
|
||||||
|
fight_messages[i].number_of_attacks = 0;
|
||||||
|
fight_messages[i].msg = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!feof(fl)) {
|
||||||
|
buf = fgets(chk, 128, fl);
|
||||||
|
while (!feof(fl) && (*chk == '\n' || *chk == '*'))
|
||||||
|
buf = fgets(chk, 128, fl);
|
||||||
|
|
||||||
|
while (*chk == 'M') {
|
||||||
|
buf = fgets(chk, 128, fl);
|
||||||
|
sscanf(chk, " %d\n", &type);
|
||||||
|
for (i = 0; (i < MAX_MESSAGES) && (fight_messages[i].a_type != type) &&
|
||||||
|
(fight_messages[i].a_type); i++);
|
||||||
|
if (i >= MAX_MESSAGES) {
|
||||||
|
log("SYSERR: Too many combat messages. Increase MAX_MESSAGES and recompile.");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
CREATE(messages, struct message_type, 1);
|
||||||
|
fight_messages[i].number_of_attacks++;
|
||||||
|
fight_messages[i].a_type = type;
|
||||||
|
messages->next = fight_messages[i].msg;
|
||||||
|
fight_messages[i].msg = messages;
|
||||||
|
|
||||||
|
messages->die_msg.attacker_msg = fread_action(fl, i);
|
||||||
|
messages->die_msg.victim_msg = fread_action(fl, i);
|
||||||
|
messages->die_msg.room_msg = fread_action(fl, i);
|
||||||
|
messages->miss_msg.attacker_msg = fread_action(fl, i);
|
||||||
|
messages->miss_msg.victim_msg = fread_action(fl, i);
|
||||||
|
messages->miss_msg.room_msg = fread_action(fl, i);
|
||||||
|
messages->hit_msg.attacker_msg = fread_action(fl, i);
|
||||||
|
messages->hit_msg.victim_msg = fread_action(fl, i);
|
||||||
|
messages->hit_msg.room_msg = fread_action(fl, i);
|
||||||
|
messages->god_msg.attacker_msg = fread_action(fl, i);
|
||||||
|
messages->god_msg.victim_msg = fread_action(fl, i);
|
||||||
|
messages->god_msg.room_msg = fread_action(fl, i);
|
||||||
|
buf = fgets(chk, 128, fl);
|
||||||
|
while (!feof(fl) && (*chk == '\n' || *chk == '*'))
|
||||||
|
buf = fgets(chk, 128, fl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(fl);
|
||||||
|
log("Loaded %d Combat Messages...", i);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void show_messages(struct char_data *ch)
|
||||||
|
{
|
||||||
|
int i, half = MAX_MESSAGES / 2, count = 0;
|
||||||
|
char buf[MAX_STRING_LENGTH];
|
||||||
|
int len;
|
||||||
|
|
||||||
|
len = snprintf(buf, sizeof(buf), "\t1Message List:\tn \r\n");
|
||||||
|
|
||||||
|
for (i = 0; i < MAX_MESSAGES / 2; i++, half++)
|
||||||
|
if (fight_messages[i].msg != NULL && len < sizeof(buf)) {
|
||||||
|
count += fight_messages[i].number_of_attacks;
|
||||||
|
len += snprintf(buf + len, sizeof(buf) - len, "%-2d) [%-3d] %d, %-18s%s", i, fight_messages[i].a_type, fight_messages[i].number_of_attacks, fight_messages[i].a_type < TOP_SPELL_DEFINE ? spell_info[fight_messages[i].a_type].name : "Unknown", half < MAX_MESSAGES && fight_messages[half].msg ? " " : "\r\n");
|
||||||
|
if (half < MAX_MESSAGES && fight_messages[half].msg)
|
||||||
|
len += snprintf(buf + len, sizeof(buf) - len, "%-2d) [%-3d] %d, %-18s\r\n", half, fight_messages[half].a_type, fight_messages[half].number_of_attacks, fight_messages[half].a_type < TOP_SPELL_DEFINE ? spell_info[fight_messages[half].a_type].name : "Unknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
len += snprintf(buf + len, sizeof(buf) - len, "Total Messages: %d\r\n", count);
|
||||||
|
page_string(ch->desc, buf, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define PRINT_MSG(msg) (msg == NULL ? "#" : msg)
|
||||||
|
|
||||||
|
void save_messages_to_disk(void)
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
int i;
|
||||||
|
struct message_type *msg;
|
||||||
|
|
||||||
|
if (!(fp = fopen(MESS_FILE, "w"))) {
|
||||||
|
log("SYSERR: Error writing combat message file %s: %s", MESS_FILE, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(fp, "* TBAMUD 3.64 Combat Message File\n");
|
||||||
|
|
||||||
|
for (i = 0; i < MAX_MESSAGES; i++) {
|
||||||
|
if (fight_messages[i].msg == NULL)
|
||||||
|
continue;
|
||||||
|
if (fight_messages[i].a_type > 0 && fight_messages[i].a_type < TOP_SPELL_DEFINE)
|
||||||
|
fprintf(fp, "* %s %d\n", PRINT_MSG(spell_info[fight_messages[i].a_type].name), fight_messages[i].a_type);
|
||||||
|
else
|
||||||
|
fprintf(fp, "* %d\n", fight_messages[i].a_type);
|
||||||
|
|
||||||
|
for (msg = fight_messages[i].msg; msg; msg = msg->next){
|
||||||
|
fprintf(fp, "M\n"
|
||||||
|
"%d\n"
|
||||||
|
"%s\n"
|
||||||
|
"%s\n"
|
||||||
|
"%s\n"
|
||||||
|
"%s\n"
|
||||||
|
"%s\n"
|
||||||
|
"%s\n"
|
||||||
|
"%s\n"
|
||||||
|
"%s\n"
|
||||||
|
"%s\n"
|
||||||
|
"%s\n"
|
||||||
|
"%s\n"
|
||||||
|
"%s\n"
|
||||||
|
"\n",
|
||||||
|
fight_messages[i].a_type,
|
||||||
|
PRINT_MSG(msg->die_msg.attacker_msg),
|
||||||
|
PRINT_MSG(msg->die_msg.victim_msg),
|
||||||
|
PRINT_MSG(msg->die_msg.room_msg),
|
||||||
|
PRINT_MSG(msg->miss_msg.attacker_msg),
|
||||||
|
PRINT_MSG(msg->miss_msg.victim_msg),
|
||||||
|
PRINT_MSG(msg->miss_msg.room_msg),
|
||||||
|
PRINT_MSG(msg->hit_msg.attacker_msg),
|
||||||
|
PRINT_MSG(msg->hit_msg.victim_msg),
|
||||||
|
PRINT_MSG(msg->hit_msg.room_msg),
|
||||||
|
PRINT_MSG(msg->god_msg.attacker_msg),
|
||||||
|
PRINT_MSG(msg->god_msg.victim_msg),
|
||||||
|
PRINT_MSG(msg->god_msg.room_msg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void msgedit_setup(struct descriptor_data *d)
|
||||||
|
{
|
||||||
|
CREATE(OLC_MSG_LIST(d), struct message_list, 1);
|
||||||
|
OLC_MSG_LIST(d)->msg = NULL;
|
||||||
|
|
||||||
|
copy_message_list(OLC_MSG_LIST(d), &fight_messages[OLC_NUM(d)]);
|
||||||
|
OLC_MSG(d) = OLC_MSG_LIST(d)->msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void copy_message_list(struct message_list *to, struct message_list *from)
|
||||||
|
{
|
||||||
|
struct message_type * msg, * tmp_msg, * orig;
|
||||||
|
|
||||||
|
to->a_type = from->a_type;
|
||||||
|
to->number_of_attacks = from->number_of_attacks;
|
||||||
|
|
||||||
|
/* Lets free any messages in *to just in case */
|
||||||
|
tmp_msg = to->msg;
|
||||||
|
|
||||||
|
while (tmp_msg) {
|
||||||
|
msg = tmp_msg;
|
||||||
|
|
||||||
|
free_messages_type(&msg->die_msg);
|
||||||
|
free_messages_type(&msg->miss_msg);
|
||||||
|
free_messages_type(&msg->hit_msg);
|
||||||
|
free_messages_type(&msg->god_msg);
|
||||||
|
|
||||||
|
tmp_msg = msg->next;
|
||||||
|
free(msg);
|
||||||
|
}
|
||||||
|
to->msg = NULL;
|
||||||
|
|
||||||
|
/* Now lets copy */
|
||||||
|
if (from->msg == NULL) {
|
||||||
|
CREATE(msg, struct message_type, 1);
|
||||||
|
copy_message_strings(msg, NULL);
|
||||||
|
msg->next = NULL;
|
||||||
|
to->msg = msg;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (tmp_msg = from->msg, orig = NULL; tmp_msg; tmp_msg = tmp_msg->next)
|
||||||
|
{
|
||||||
|
CREATE(msg, struct message_type, 1);
|
||||||
|
copy_message_strings(msg, tmp_msg);
|
||||||
|
|
||||||
|
msg->next = orig;
|
||||||
|
orig = msg;
|
||||||
|
}
|
||||||
|
to->msg = orig;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void copy_message_strings(struct message_type *tmsg, struct message_type * fmsg)
|
||||||
|
{
|
||||||
|
tmsg->die_msg.attacker_msg = fmsg && fmsg->die_msg.attacker_msg ? strdup(fmsg->die_msg.attacker_msg) : NULL;
|
||||||
|
tmsg->die_msg.victim_msg = fmsg && fmsg->die_msg.victim_msg ? strdup(fmsg->die_msg.victim_msg) : NULL;
|
||||||
|
tmsg->die_msg.room_msg = fmsg && fmsg->die_msg.room_msg ? strdup(fmsg->die_msg.room_msg) : NULL;
|
||||||
|
|
||||||
|
tmsg->miss_msg.attacker_msg = fmsg && fmsg->miss_msg.attacker_msg ? strdup(fmsg->miss_msg.attacker_msg) : NULL;
|
||||||
|
tmsg->miss_msg.victim_msg = fmsg && fmsg->miss_msg.victim_msg ? strdup(fmsg->miss_msg.victim_msg) : NULL;
|
||||||
|
tmsg->miss_msg.room_msg = fmsg && fmsg->miss_msg.room_msg ? strdup(fmsg->miss_msg.room_msg) : NULL;
|
||||||
|
|
||||||
|
tmsg->hit_msg.attacker_msg = fmsg && fmsg->hit_msg.attacker_msg ? strdup(fmsg->hit_msg.attacker_msg) : NULL;
|
||||||
|
tmsg->hit_msg.victim_msg = fmsg && fmsg->hit_msg.victim_msg ? strdup(fmsg->hit_msg.victim_msg) : NULL;
|
||||||
|
tmsg->hit_msg.room_msg = fmsg && fmsg->hit_msg.room_msg ? strdup(fmsg->hit_msg.room_msg) : NULL;
|
||||||
|
|
||||||
|
tmsg->god_msg.attacker_msg = fmsg && fmsg->god_msg.attacker_msg ? strdup(fmsg->god_msg.attacker_msg) : NULL;
|
||||||
|
tmsg->god_msg.victim_msg = fmsg && fmsg->god_msg.victim_msg ? strdup(fmsg->god_msg.victim_msg) : NULL;
|
||||||
|
tmsg->god_msg.room_msg = fmsg && fmsg->god_msg.room_msg ? strdup(fmsg->god_msg.room_msg) : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ACMD(do_msgedit)
|
||||||
|
{
|
||||||
|
int num;
|
||||||
|
struct descriptor_data *d;
|
||||||
|
|
||||||
|
if (!*argument) {
|
||||||
|
show_messages(ch);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((num = atoi(argument)) < 0) {
|
||||||
|
send_to_char(ch, "You must select a message # between 0 and %d.\r\n", MAX_MESSAGES);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num >= MAX_MESSAGES) {
|
||||||
|
send_to_char(ch, "You must select a message # between 0 and %d.\r\n", MAX_MESSAGES - 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (d = descriptor_list; d; d = d->next)
|
||||||
|
if (STATE(d) == CON_MSGEDIT) {
|
||||||
|
if (OLC_MSG_LIST(d) && OLC_NUM(d) == num) {
|
||||||
|
send_to_char(ch, "Someone is already editing that message.\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Retrieve the player's descriptor. */
|
||||||
|
d = ch->desc;
|
||||||
|
|
||||||
|
/* Give the descriptor an OLC structure. */
|
||||||
|
if (d->olc) {
|
||||||
|
mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_msg_edit: Player already had olc structure.");
|
||||||
|
free(d->olc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create the OLC structure. */
|
||||||
|
CREATE(d->olc, struct oasis_olc_data, 1);
|
||||||
|
|
||||||
|
OLC_NUM(d) = num;
|
||||||
|
OLC_VAL(d) = 0;
|
||||||
|
msgedit_setup(d);
|
||||||
|
|
||||||
|
msgedit_main_menu(ch->desc);
|
||||||
|
STATE(d) = CON_MSGEDIT;
|
||||||
|
|
||||||
|
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||||
|
SET_BIT_AR(PLR_FLAGS(ch), PLR_WRITING);
|
||||||
|
|
||||||
|
mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s starts editing message %d",
|
||||||
|
GET_NAME(ch), OLC_NUM(d));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void msgedit_main_menu(struct descriptor_data * d)
|
||||||
|
{
|
||||||
|
get_char_colors(d->character);
|
||||||
|
|
||||||
|
write_to_output(d, "%sMsg Edit: %s[%s%dx%d%s] [%s$n: Attacker | $N: Victim%s]%s\r\n", cyn, grn, yel, OLC_NUM(d), OLC_MSG_LIST(d)->number_of_attacks, grn, yel, grn, nrm);
|
||||||
|
write_to_output(d, "%s1%s) %sAction Type: %s%d %s[%s%s%s]%s\r\n", grn, yel, cyn, yel, OLC_MSG_LIST(d)->a_type, grn, yel, OLC_MSG_LIST(d)->a_type < TOP_SPELL_DEFINE ? spell_info[OLC_MSG_LIST(d)->a_type].name : "Unknown", grn, nrm);
|
||||||
|
|
||||||
|
write_to_output(d, " %sDeath Messages:\r\n"
|
||||||
|
"%sA%s) CHAR : %s %s\r\n"
|
||||||
|
"%sB%s) VICT : %s %s\r\n"
|
||||||
|
"%sC%s) ROOM : %s %s\r\n",
|
||||||
|
cyn,
|
||||||
|
grn, yel, nrm, PRINT_MSG(OLC_MSG(d)->die_msg.attacker_msg),
|
||||||
|
grn, yel, nrm, PRINT_MSG(OLC_MSG(d)->die_msg.victim_msg),
|
||||||
|
grn, yel, nrm, PRINT_MSG(OLC_MSG(d)->die_msg.room_msg));
|
||||||
|
|
||||||
|
write_to_output(d, " %sMiss Messages:\r\n"
|
||||||
|
"%sD%s) CHAR : %s %s\r\n"
|
||||||
|
"%sE%s) VICT : %s %s\r\n"
|
||||||
|
"%sF%s) ROOM : %s %s\r\n",
|
||||||
|
cyn,
|
||||||
|
grn, yel, nrm, PRINT_MSG(OLC_MSG(d)->miss_msg.attacker_msg),
|
||||||
|
grn, yel, nrm, PRINT_MSG(OLC_MSG(d)->miss_msg.victim_msg),
|
||||||
|
grn, yel, nrm, PRINT_MSG(OLC_MSG(d)->miss_msg.room_msg));
|
||||||
|
|
||||||
|
write_to_output(d, " %sHit Messages:\r\n"
|
||||||
|
"%sG%s) CHAR : %s %s\r\n"
|
||||||
|
"%sH%s) VICT : %s %s\r\n"
|
||||||
|
"%sI%s) ROOM : %s %s\r\n",
|
||||||
|
cyn,
|
||||||
|
grn, yel, nrm, PRINT_MSG(OLC_MSG(d)->hit_msg.attacker_msg),
|
||||||
|
grn, yel, nrm, PRINT_MSG(OLC_MSG(d)->hit_msg.victim_msg),
|
||||||
|
grn, yel, nrm, PRINT_MSG(OLC_MSG(d)->hit_msg.room_msg));
|
||||||
|
|
||||||
|
write_to_output(d, " %sGod Messages:\r\n"
|
||||||
|
"%sJ%s) CHAR : %s %s\r\n"
|
||||||
|
"%sK%s) VICT : %s %s\r\n"
|
||||||
|
"%sL%s) ROOM : %s %s\r\n",
|
||||||
|
cyn,
|
||||||
|
grn, yel, nrm, PRINT_MSG(OLC_MSG(d)->god_msg.attacker_msg),
|
||||||
|
grn, yel, nrm, PRINT_MSG(OLC_MSG(d)->god_msg.victim_msg),
|
||||||
|
grn, yel, nrm, PRINT_MSG(OLC_MSG(d)->god_msg.room_msg));
|
||||||
|
|
||||||
|
write_to_output(d, "\r\n%sN%s)%s %s", grn, yel, nrm, OLC_MSG(d)->next ? "Next" : "New");
|
||||||
|
if (OLC_MSG(d) != OLC_MSG_LIST(d)->msg)
|
||||||
|
write_to_output(d, " %sP%s)%s Previous", grn, yel, nrm);
|
||||||
|
if (OLC_VAL(d))
|
||||||
|
write_to_output(d, " %sS%s)%s Save", grn, yel, nrm);
|
||||||
|
write_to_output(d, " %sQ%s)%s Quit\r\n"
|
||||||
|
"Enter Selection : ", grn, yel, nrm);
|
||||||
|
OLC_MODE(d) = MSGEDIT_MAIN_MENU;
|
||||||
|
}
|
||||||
|
|
||||||
|
void msgedit_parse(struct descriptor_data *d, char *arg)
|
||||||
|
{
|
||||||
|
struct message_type * temp;
|
||||||
|
static bool quit = FALSE;
|
||||||
|
|
||||||
|
switch (OLC_MODE(d)) {
|
||||||
|
case MSGEDIT_MAIN_MENU:
|
||||||
|
if (!*arg) {
|
||||||
|
write_to_output(d, "Enter Option : ");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (*arg) {
|
||||||
|
case '1':
|
||||||
|
write_to_output(d, "Enter Action Type : ");
|
||||||
|
OLC_MODE(d) = MSGEDIT_TYPE;
|
||||||
|
return;
|
||||||
|
case 'A':
|
||||||
|
case 'a':
|
||||||
|
write_to_output(d, "Example: You kill $N!\r\n");
|
||||||
|
write_to_output(d, "Enter new string : ");
|
||||||
|
OLC_MODE(d) = MSGEDIT_DEATH_CHAR;
|
||||||
|
return;
|
||||||
|
case 'B':
|
||||||
|
case 'b':
|
||||||
|
write_to_output(d, "Example: $n kills you!\r\n");
|
||||||
|
write_to_output(d, "Enter new string : ");
|
||||||
|
OLC_MODE(d) = MSGEDIT_DEATH_VICT;
|
||||||
|
return;
|
||||||
|
case 'C':
|
||||||
|
case 'c':
|
||||||
|
write_to_output(d, "Example: $n kills $N!\r\n");
|
||||||
|
write_to_output(d, "Enter new string : ");
|
||||||
|
OLC_MODE(d) = MSGEDIT_DEATH_ROOM;
|
||||||
|
return;
|
||||||
|
case 'D':
|
||||||
|
case 'd':
|
||||||
|
write_to_output(d, "Example: You miss $N!\r\n");
|
||||||
|
write_to_output(d, "Enter new string : ");
|
||||||
|
OLC_MODE(d) = MSGEDIT_MISS_CHAR;
|
||||||
|
return;
|
||||||
|
case 'E':
|
||||||
|
case 'e':
|
||||||
|
write_to_output(d, "Example: $n misses you!\r\n");
|
||||||
|
write_to_output(d, "Enter new string : ");
|
||||||
|
OLC_MODE(d) = MSGEDIT_MISS_VICT;
|
||||||
|
return;
|
||||||
|
case 'F':
|
||||||
|
case 'f':
|
||||||
|
write_to_output(d, "Example: $n misses $N!\r\n");
|
||||||
|
write_to_output(d, "Enter new string : ");
|
||||||
|
OLC_MODE(d) = MSGEDIT_MISS_ROOM;
|
||||||
|
return;
|
||||||
|
case 'G':
|
||||||
|
case 'g':
|
||||||
|
write_to_output(d, "Example: You hit $N!\r\n");
|
||||||
|
write_to_output(d, "Enter new string : ");
|
||||||
|
OLC_MODE(d) = MSGEDIT_HIT_CHAR;
|
||||||
|
return;
|
||||||
|
case 'H':
|
||||||
|
case 'h':
|
||||||
|
write_to_output(d, "Example: $n hits you!\r\n");
|
||||||
|
write_to_output(d, "Enter new string : ");
|
||||||
|
OLC_MODE(d) = MSGEDIT_HIT_VICT;
|
||||||
|
return;
|
||||||
|
case 'I':
|
||||||
|
case 'i':
|
||||||
|
write_to_output(d, "Example: $n hits $N!\r\n");
|
||||||
|
write_to_output(d, "Enter new string : ");
|
||||||
|
OLC_MODE(d) = MSGEDIT_HIT_ROOM;
|
||||||
|
return;
|
||||||
|
case 'J':
|
||||||
|
case 'j':
|
||||||
|
write_to_output(d, "Example: You can't hit $N!\r\n");
|
||||||
|
write_to_output(d, "Enter new string : ");
|
||||||
|
OLC_MODE(d) = MSGEDIT_GOD_CHAR;
|
||||||
|
return;
|
||||||
|
case 'K':
|
||||||
|
case 'k':
|
||||||
|
write_to_output(d, "Example: $n can't hit you!\r\n");
|
||||||
|
write_to_output(d, "Enter new string : ");
|
||||||
|
OLC_MODE(d) = MSGEDIT_GOD_VICT;
|
||||||
|
return;
|
||||||
|
case 'L':
|
||||||
|
case 'l':
|
||||||
|
write_to_output(d, "Example: $n can't hit $N!\r\n");
|
||||||
|
write_to_output(d, "Enter new string : ");
|
||||||
|
OLC_MODE(d) = MSGEDIT_GOD_ROOM;
|
||||||
|
return;
|
||||||
|
case 'N':
|
||||||
|
case 'n':
|
||||||
|
if (OLC_MSG(d)->next == NULL) {
|
||||||
|
temp = OLC_MSG(d);
|
||||||
|
CREATE(OLC_MSG(d), struct message_type, 1);
|
||||||
|
copy_message_strings(OLC_MSG(d), NULL);
|
||||||
|
OLC_MSG_LIST(d)->number_of_attacks++;
|
||||||
|
temp->next = OLC_MSG(d);
|
||||||
|
} else
|
||||||
|
OLC_MSG(d) = OLC_MSG(d)->next;
|
||||||
|
|
||||||
|
msgedit_main_menu(d);
|
||||||
|
return;
|
||||||
|
case 'P':
|
||||||
|
case 'p':
|
||||||
|
if (OLC_MSG(d) == OLC_MSG_LIST(d)->msg) {
|
||||||
|
msgedit_main_menu(d);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
temp = OLC_MSG(d);
|
||||||
|
for (OLC_MSG(d) = OLC_MSG_LIST(d)->msg; OLC_MSG(d); OLC_MSG(d) = OLC_MSG(d)->next)
|
||||||
|
if (OLC_MSG(d)->next == temp)
|
||||||
|
break;
|
||||||
|
|
||||||
|
msgedit_main_menu(d);
|
||||||
|
return;
|
||||||
|
case 'S':
|
||||||
|
case 's':
|
||||||
|
write_to_output(d, "Do you wish to save? Y/N : ");
|
||||||
|
OLC_MODE(d) = MSGEDIT_CONFIRM_SAVE;
|
||||||
|
return;
|
||||||
|
case 'Q':
|
||||||
|
case 'q':
|
||||||
|
if (OLC_VAL(d)) {
|
||||||
|
OLC_MODE(d) = MSGEDIT_CONFIRM_SAVE;
|
||||||
|
quit = TRUE;
|
||||||
|
write_to_output(d, "Do you wish to save? Y/N : ");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
write_to_output(d, "Exiting message editor.\r\n");
|
||||||
|
cleanup_olc(d, CLEANUP_ALL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MSGEDIT_CONFIRM_SAVE:
|
||||||
|
if (*arg && (*arg == 'Y' || *arg == 'y')) {
|
||||||
|
copy_message_list(&fight_messages[OLC_NUM(d)], OLC_MSG_LIST(d));
|
||||||
|
save_messages_to_disk();
|
||||||
|
OLC_VAL(d) = 0;
|
||||||
|
write_to_output(d, "Messages saved.\r\n");
|
||||||
|
} else
|
||||||
|
write_to_output(d, "Save aborted.\r\n");
|
||||||
|
|
||||||
|
if (quit) {
|
||||||
|
quit = FALSE;
|
||||||
|
write_to_output(d, "Exiting message editor.\r\n");
|
||||||
|
cleanup_olc(d, CLEANUP_ALL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
msgedit_main_menu(d);
|
||||||
|
return;
|
||||||
|
case MSGEDIT_TYPE:
|
||||||
|
OLC_MSG_LIST(d)->a_type = LIMIT(atoi(arg), 0, 500);
|
||||||
|
break;
|
||||||
|
case MSGEDIT_DEATH_CHAR:
|
||||||
|
if (!genolc_checkstring(d, arg))
|
||||||
|
break;
|
||||||
|
delete_doubledollar(arg);
|
||||||
|
|
||||||
|
if (OLC_MSG(d)->die_msg.attacker_msg)
|
||||||
|
free(OLC_MSG(d)->die_msg.attacker_msg);
|
||||||
|
|
||||||
|
OLC_MSG(d)->die_msg.attacker_msg = strdup(arg);
|
||||||
|
break;
|
||||||
|
case MSGEDIT_DEATH_VICT:
|
||||||
|
if (!genolc_checkstring(d, arg))
|
||||||
|
break;
|
||||||
|
delete_doubledollar(arg);
|
||||||
|
|
||||||
|
if (OLC_MSG(d)->die_msg.victim_msg)
|
||||||
|
free(OLC_MSG(d)->die_msg.victim_msg);
|
||||||
|
|
||||||
|
OLC_MSG(d)->die_msg.victim_msg = strdup(arg);
|
||||||
|
break;
|
||||||
|
case MSGEDIT_DEATH_ROOM:
|
||||||
|
if (!genolc_checkstring(d, arg))
|
||||||
|
break;
|
||||||
|
delete_doubledollar(arg);
|
||||||
|
|
||||||
|
if (OLC_MSG(d)->die_msg.room_msg)
|
||||||
|
free(OLC_MSG(d)->die_msg.room_msg);
|
||||||
|
|
||||||
|
OLC_MSG(d)->die_msg.room_msg = strdup(arg);
|
||||||
|
break;
|
||||||
|
case MSGEDIT_MISS_CHAR:
|
||||||
|
if (!genolc_checkstring(d, arg))
|
||||||
|
break;
|
||||||
|
delete_doubledollar(arg);
|
||||||
|
|
||||||
|
if (OLC_MSG(d)->miss_msg.attacker_msg)
|
||||||
|
free(OLC_MSG(d)->miss_msg.attacker_msg);
|
||||||
|
|
||||||
|
OLC_MSG(d)->miss_msg.attacker_msg = strdup(arg);
|
||||||
|
break;
|
||||||
|
case MSGEDIT_MISS_VICT:
|
||||||
|
if (!genolc_checkstring(d, arg))
|
||||||
|
break;
|
||||||
|
delete_doubledollar(arg);
|
||||||
|
|
||||||
|
if (OLC_MSG(d)->miss_msg.victim_msg)
|
||||||
|
free(OLC_MSG(d)->miss_msg.victim_msg);
|
||||||
|
|
||||||
|
OLC_MSG(d)->miss_msg.victim_msg = strdup(arg);
|
||||||
|
break;
|
||||||
|
case MSGEDIT_MISS_ROOM:
|
||||||
|
if (!genolc_checkstring(d, arg))
|
||||||
|
break;
|
||||||
|
delete_doubledollar(arg);
|
||||||
|
|
||||||
|
if (OLC_MSG(d)->miss_msg.room_msg)
|
||||||
|
free(OLC_MSG(d)->miss_msg.room_msg);
|
||||||
|
|
||||||
|
OLC_MSG(d)->miss_msg.room_msg = strdup(arg);
|
||||||
|
break;
|
||||||
|
case MSGEDIT_HIT_CHAR:
|
||||||
|
if (!genolc_checkstring(d, arg))
|
||||||
|
break;
|
||||||
|
delete_doubledollar(arg);
|
||||||
|
|
||||||
|
if (OLC_MSG(d)->hit_msg.attacker_msg)
|
||||||
|
free(OLC_MSG(d)->hit_msg.attacker_msg);
|
||||||
|
|
||||||
|
OLC_MSG(d)->hit_msg.attacker_msg = strdup(arg);
|
||||||
|
break;
|
||||||
|
case MSGEDIT_HIT_VICT:
|
||||||
|
if (!genolc_checkstring(d, arg))
|
||||||
|
break;
|
||||||
|
delete_doubledollar(arg);
|
||||||
|
|
||||||
|
if (OLC_MSG(d)->hit_msg.victim_msg)
|
||||||
|
free(OLC_MSG(d)->hit_msg.victim_msg);
|
||||||
|
|
||||||
|
OLC_MSG(d)->hit_msg.victim_msg = strdup(arg);
|
||||||
|
break;
|
||||||
|
case MSGEDIT_HIT_ROOM:
|
||||||
|
if (!genolc_checkstring(d, arg))
|
||||||
|
break;
|
||||||
|
delete_doubledollar(arg);
|
||||||
|
|
||||||
|
if (OLC_MSG(d)->hit_msg.room_msg)
|
||||||
|
free(OLC_MSG(d)->hit_msg.room_msg);
|
||||||
|
|
||||||
|
OLC_MSG(d)->hit_msg.room_msg = strdup(arg);
|
||||||
|
break;
|
||||||
|
case MSGEDIT_GOD_CHAR:
|
||||||
|
if (!genolc_checkstring(d, arg))
|
||||||
|
break;
|
||||||
|
delete_doubledollar(arg);
|
||||||
|
|
||||||
|
if (OLC_MSG(d)->god_msg.attacker_msg)
|
||||||
|
free(OLC_MSG(d)->god_msg.attacker_msg);
|
||||||
|
|
||||||
|
OLC_MSG(d)->god_msg.attacker_msg = strdup(arg);
|
||||||
|
break;
|
||||||
|
case MSGEDIT_GOD_VICT:
|
||||||
|
if (!genolc_checkstring(d, arg))
|
||||||
|
break;
|
||||||
|
delete_doubledollar(arg);
|
||||||
|
|
||||||
|
if (OLC_MSG(d)->god_msg.victim_msg)
|
||||||
|
free(OLC_MSG(d)->god_msg.victim_msg);
|
||||||
|
|
||||||
|
OLC_MSG(d)->god_msg.victim_msg = strdup(arg);
|
||||||
|
break;
|
||||||
|
case MSGEDIT_GOD_ROOM:
|
||||||
|
if (!genolc_checkstring(d, arg))
|
||||||
|
break;
|
||||||
|
delete_doubledollar(arg);
|
||||||
|
|
||||||
|
if (OLC_MSG(d)->god_msg.room_msg)
|
||||||
|
free(OLC_MSG(d)->god_msg.room_msg);
|
||||||
|
|
||||||
|
OLC_MSG(d)->god_msg.room_msg = strdup(arg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
OLC_VAL(d) = 1;
|
||||||
|
msgedit_main_menu(d);
|
||||||
|
}
|
||||||
44
src/msgedit.h
Normal file
44
src/msgedit.h
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
/**
|
||||||
|
* @file msgedit.h
|
||||||
|
*
|
||||||
|
* Copyright 2012 Joseph Arnusch
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
|
/* Externals */
|
||||||
|
void load_messages(void);
|
||||||
|
void free_messages(void);
|
||||||
|
void save_messages_to_disk(void);
|
||||||
|
void free_message_list(struct message_list * mlist);
|
||||||
|
|
||||||
|
/* Defines */
|
||||||
|
#define MSGEDIT_MAIN_MENU 1
|
||||||
|
#define MSGEDIT_CONFIRM_SAVE 2
|
||||||
|
#define MSGEDIT_TYPE 3
|
||||||
|
#define MSGEDIT_DEATH_CHAR 4
|
||||||
|
#define MSGEDIT_DEATH_VICT 5
|
||||||
|
#define MSGEDIT_DEATH_ROOM 6
|
||||||
|
#define MSGEDIT_MISS_CHAR 7
|
||||||
|
#define MSGEDIT_MISS_VICT 8
|
||||||
|
#define MSGEDIT_MISS_ROOM 9
|
||||||
|
#define MSGEDIT_HIT_CHAR 10
|
||||||
|
#define MSGEDIT_HIT_VICT 11
|
||||||
|
#define MSGEDIT_HIT_ROOM 12
|
||||||
|
#define MSGEDIT_GOD_CHAR 13
|
||||||
|
#define MSGEDIT_GOD_VICT 14
|
||||||
|
#define MSGEDIT_GOD_ROOM 15
|
||||||
|
|
@ -41,7 +41,7 @@ void init_events(void)
|
||||||
* mud_event_index[] such as:
|
* mud_event_index[] such as:
|
||||||
* { "Lay on hands" , event_countdown, EVENT_CHAR }
|
* { "Lay on hands" , event_countdown, EVENT_CHAR }
|
||||||
* and then add the event after a successful skill call:
|
* and then add the event after a successful skill call:
|
||||||
* attach_mud_event(new_mud_event(eLAYONHANDS, ch, NULL), 24 * SECS_PER_MUD_HOUR);
|
* NEW_EVENT(eLAYONHANDS, ch, NULL, 24 * SECS_PER_MUD_HOUR)
|
||||||
* and then add something like this is your skill function:
|
* and then add something like this is your skill function:
|
||||||
* if (char_has_mud_event(ch, eLAYONHANDS)) {
|
* if (char_has_mud_event(ch, eLAYONHANDS)) {
|
||||||
* send_to_char(ch, "You must wait a full 24 hours before re-using this skill.\r\n");
|
* send_to_char(ch, "You must wait a full 24 hours before re-using this skill.\r\n");
|
||||||
|
|
|
||||||
11
src/oasis.c
11
src/oasis.c
|
|
@ -26,6 +26,7 @@
|
||||||
#include "handler.h" /* for is_name */
|
#include "handler.h" /* for is_name */
|
||||||
#include "quest.h"
|
#include "quest.h"
|
||||||
#include "ibt.h"
|
#include "ibt.h"
|
||||||
|
#include "msgedit.h"
|
||||||
|
|
||||||
/* Internal Data Structures */
|
/* Internal Data Structures */
|
||||||
/** @deprecated olc_scmd_info appears to be deprecated. Commented out for now.
|
/** @deprecated olc_scmd_info appears to be deprecated. Commented out for now.
|
||||||
|
|
@ -174,8 +175,14 @@ void cleanup_olc(struct descriptor_data *d, byte cleanup_type)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OLC_IBT(d)) {
|
if (OLC_IBT(d)) {
|
||||||
free_olc_ibt(OLC_IBT(d));
|
free_olc_ibt(OLC_IBT(d));
|
||||||
OLC_IBT(d) = NULL;
|
OLC_IBT(d) = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OLC_MSG_LIST(d)) {
|
||||||
|
free_message_list(OLC_MSG_LIST(d));
|
||||||
|
OLC_MSG_LIST(d) = NULL;
|
||||||
|
OLC_MSG(d) = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free storage if allocated (tedit, aedit, and trigedit). This is the command
|
/* Free storage if allocated (tedit, aedit, and trigedit). This is the command
|
||||||
|
|
|
||||||
11
src/oasis.h
11
src/oasis.h
|
|
@ -100,6 +100,8 @@ struct oasis_olc_data {
|
||||||
struct trig_data *trig;
|
struct trig_data *trig;
|
||||||
struct prefs_data *prefs; /* used for 'prefedit' */
|
struct prefs_data *prefs; /* used for 'prefedit' */
|
||||||
struct ibt_data *ibt; /* used for 'ibtedit' */
|
struct ibt_data *ibt; /* used for 'ibtedit' */
|
||||||
|
struct message_list *msg;
|
||||||
|
struct message_type *m_type;
|
||||||
int script_mode;
|
int script_mode;
|
||||||
int trigger_position;
|
int trigger_position;
|
||||||
int item_type;
|
int item_type;
|
||||||
|
|
@ -127,13 +129,15 @@ extern const char *nrm, *grn, *cyn, *yel;
|
||||||
#define OLC_CONFIG(d) (OLC(d)->config) /**< Config structure. */
|
#define OLC_CONFIG(d) (OLC(d)->config) /**< Config structure. */
|
||||||
#define OLC_TRIG(d) (OLC(d)->trig) /**< Trigger structure. */
|
#define OLC_TRIG(d) (OLC(d)->trig) /**< Trigger structure. */
|
||||||
#define OLC_QUEST(d) (OLC(d)->quest) /**< Quest structure */
|
#define OLC_QUEST(d) (OLC(d)->quest) /**< Quest structure */
|
||||||
|
#define OLC_MSG_LIST(d) (OLC(d)->msg) /**< Message structure */
|
||||||
|
|
||||||
#define OLC_ACTION(d) (OLC(d)->action) /**< Action structure */
|
#define OLC_ACTION(d) (OLC(d)->action) /**< Action structure */
|
||||||
#define OLC_HELP(d) (OLC(d)->help) /**< Hedit structure */
|
#define OLC_HELP(d) (OLC(d)->help) /**< Hedit structure */
|
||||||
#define OLC_PREFS(d) (OLC(d)->prefs) /**< Preferences structure */
|
#define OLC_PREFS(d) (OLC(d)->prefs) /**< Preferences structure */
|
||||||
#define OLC_IBT(d) (OLC(d)->ibt) /**< IBT (idea/bug/typo) structure */
|
#define OLC_IBT(d) (OLC(d)->ibt) /**< IBT (idea/bug/typo) structure */
|
||||||
/* Other macros. */
|
/* Other macros. */
|
||||||
#define OLC_EXIT(d) (OLC_ROOM(d)->dir_option[OLC_VAL(d)])
|
#define OLC_EXIT(d) (OLC_ROOM(d)->dir_option[OLC_VAL(d)])
|
||||||
|
#define OLC_MSG(d) (OLC(d)->m_type)
|
||||||
|
|
||||||
/* Cleanup types. */
|
/* Cleanup types. */
|
||||||
#define CLEANUP_ALL 1 /* Free the whole lot. */
|
#define CLEANUP_ALL 1 /* Free the whole lot. */
|
||||||
|
|
@ -373,6 +377,7 @@ extern const char *nrm, *grn, *cyn, *yel;
|
||||||
#define CEDIT_MAP_OPTION 54
|
#define CEDIT_MAP_OPTION 54
|
||||||
#define CEDIT_MAP_SIZE 55
|
#define CEDIT_MAP_SIZE 55
|
||||||
#define CEDIT_MINIMAP_SIZE 56
|
#define CEDIT_MINIMAP_SIZE 56
|
||||||
|
#define CEDIT_DEBUG_MODE 57
|
||||||
|
|
||||||
/* Hedit Submodes of connectedness. */
|
/* Hedit Submodes of connectedness. */
|
||||||
#define HEDIT_CONFIRM_SAVESTRING 0
|
#define HEDIT_CONFIRM_SAVESTRING 0
|
||||||
|
|
@ -452,6 +457,10 @@ ACMD(do_tedit);
|
||||||
/* public functions from qedit.c */
|
/* public functions from qedit.c */
|
||||||
ACMD(do_oasis_qedit);
|
ACMD(do_oasis_qedit);
|
||||||
|
|
||||||
|
/* public functions from msgedit.c */
|
||||||
|
ACMD(do_msgedit);
|
||||||
|
void msgedit_parse(struct descriptor_data *d, char *arg);
|
||||||
|
|
||||||
/* public functions from oasis_copy.c */
|
/* public functions from oasis_copy.c */
|
||||||
int buildwalk(struct char_data *ch, int dir);
|
int buildwalk(struct char_data *ch, int dir);
|
||||||
ACMD(do_dig);
|
ACMD(do_dig);
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,11 @@
|
||||||
#include "act.h"
|
#include "act.h"
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
|
|
||||||
|
/* Globals */
|
||||||
|
const char * RGBone = "F022";
|
||||||
|
const char * RGBtwo = "F055";
|
||||||
|
const char * RGBthree = "F555";
|
||||||
|
|
||||||
static void Write( descriptor_t *apDescriptor, const char *apData )
|
static void Write( descriptor_t *apDescriptor, const char *apData )
|
||||||
{
|
{
|
||||||
if ( apDescriptor != NULL)
|
if ( apDescriptor != NULL)
|
||||||
|
|
@ -565,13 +570,13 @@ const char *ProtocolOutput( descriptor_t *apDescriptor, const char *apData, int
|
||||||
/* 1,2,3 to be used a MUD's base colour palette. Just to maintain
|
/* 1,2,3 to be used a MUD's base colour palette. Just to maintain
|
||||||
* some sort of common colouring scheme amongst coders/builders */
|
* some sort of common colouring scheme amongst coders/builders */
|
||||||
case '1':
|
case '1':
|
||||||
pCopyFrom = ColourRGB(apDescriptor, "F022");
|
pCopyFrom = ColourRGB(apDescriptor, RGBone);
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
pCopyFrom = ColourRGB(apDescriptor, "F055");
|
pCopyFrom = ColourRGB(apDescriptor, RGBtwo);
|
||||||
break;
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
pCopyFrom = ColourRGB(apDescriptor, "F555");
|
pCopyFrom = ColourRGB(apDescriptor, RGBthree);
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
pCopyFrom = s_Clean;
|
pCopyFrom = s_Clean;
|
||||||
|
|
@ -1499,6 +1504,15 @@ static void Negotiate( descriptor_t *apDescriptor )
|
||||||
|
|
||||||
/* Check for other protocols. */
|
/* Check for other protocols. */
|
||||||
Write(apDescriptor, DoNAWS);
|
Write(apDescriptor, DoNAWS);
|
||||||
|
/* Gnome-mud seems to have an issue with negotiating DoCHARSET under
|
||||||
|
* certain conditions cause it to crash. This is a GNOME-MUD issue
|
||||||
|
* and not an issue on our end. Never-the-less, if you discover you
|
||||||
|
* are having this issue you can either a) disable protocol negotiation
|
||||||
|
* in cedit, or b) disable detection of CHARSET by deleting/commenting
|
||||||
|
* the following line.
|
||||||
|
*
|
||||||
|
* For more information on gnome-mud's bug see:
|
||||||
|
* https://bugs.launchpad.net/ubuntu/+source/gnome-mud/+bug/398340 */
|
||||||
Write(apDescriptor, DoCHARSET);
|
Write(apDescriptor, DoCHARSET);
|
||||||
Write(apDescriptor, WillMSDP);
|
Write(apDescriptor, WillMSDP);
|
||||||
Write(apDescriptor, WillMSSP);
|
Write(apDescriptor, WillMSSP);
|
||||||
|
|
|
||||||
|
|
@ -250,6 +250,12 @@ void ProtocolNegotiate( descriptor_t *apDescriptor );
|
||||||
* whatever is left for the mud to parse normally. Call this after data has
|
* whatever is left for the mud to parse normally. Call this after data has
|
||||||
* been read into the input buffer, before it is used for anything else.
|
* been read into the input buffer, before it is used for anything else.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* MUD Primary Colours */
|
||||||
|
extern const char * RGBone;
|
||||||
|
extern const char * RGBtwo;
|
||||||
|
extern const char * RGBthree;
|
||||||
|
|
||||||
ssize_t ProtocolInput( descriptor_t *apDescriptor, char *apData, int aSize, char *apOut );
|
ssize_t ProtocolInput( descriptor_t *apDescriptor, char *apData, int aSize, char *apOut );
|
||||||
|
|
||||||
/* Function: ProtocolOutput
|
/* Function: ProtocolOutput
|
||||||
|
|
|
||||||
|
|
@ -329,11 +329,12 @@
|
||||||
#define CON_QEDIT 28 /**< OLC mode - quest edit */
|
#define CON_QEDIT 28 /**< OLC mode - quest edit */
|
||||||
#define CON_PREFEDIT 29 /**< OLC mode - preference edit */
|
#define CON_PREFEDIT 29 /**< OLC mode - preference edit */
|
||||||
#define CON_IBTEDIT 30 /**< OLC mode - idea/bug/typo edit */
|
#define CON_IBTEDIT 30 /**< OLC mode - idea/bug/typo edit */
|
||||||
#define CON_GET_PROTOCOL 31 /**< Used at log-in while attempting to get protocols > */
|
#define CON_MSGEDIT 31 /**< OLC mode - message editor */
|
||||||
|
#define CON_GET_PROTOCOL 32 /**< Used at log-in while attempting to get protocols > */
|
||||||
|
|
||||||
/* OLC States range - used by IS_IN_OLC and IS_PLAYING */
|
/* OLC States range - used by IS_IN_OLC and IS_PLAYING */
|
||||||
#define FIRST_OLC_STATE CON_OEDIT /**< The first CON_ state that is an OLC */
|
#define FIRST_OLC_STATE CON_OEDIT /**< The first CON_ state that is an OLC */
|
||||||
#define LAST_OLC_STATE CON_IBTEDIT /**< The last CON_ state that is an OLC */
|
#define LAST_OLC_STATE CON_MSGEDIT /**< The last CON_ state that is an OLC */
|
||||||
|
|
||||||
/* Character equipment positions: used as index for char_data.equipment[] */
|
/* Character equipment positions: used as index for char_data.equipment[] */
|
||||||
/* NOTE: Don't confuse these constants with the ITEM_ bitvectors
|
/* NOTE: Don't confuse these constants with the ITEM_ bitvectors
|
||||||
|
|
@ -1350,6 +1351,7 @@ struct game_operation
|
||||||
int ibt_autosave; /**< Does "bug resolve" autosave ? */
|
int ibt_autosave; /**< Does "bug resolve" autosave ? */
|
||||||
int protocol_negotiation; /**< Enable the protocol negotiation system ? */
|
int protocol_negotiation; /**< Enable the protocol negotiation system ? */
|
||||||
int special_in_comm; /**< Enable use of a special character in communication channels ? */
|
int special_in_comm; /**< Enable use of a special character in communication channels ? */
|
||||||
|
int debug_mode; /**< Current Debug Mode */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The Autowizard options. */
|
/** The Autowizard options. */
|
||||||
|
|
|
||||||
|
|
@ -1050,6 +1050,8 @@ do \
|
||||||
#define CONFIG_PROTOCOL_NEGOTIATION config_info.operation.protocol_negotiation
|
#define CONFIG_PROTOCOL_NEGOTIATION config_info.operation.protocol_negotiation
|
||||||
/** Use the special character in comm channels? */
|
/** Use the special character in comm channels? */
|
||||||
#define CONFIG_SPECIAL_IN_COMM config_info.operation.special_in_comm
|
#define CONFIG_SPECIAL_IN_COMM config_info.operation.special_in_comm
|
||||||
|
/** Activate debug mode? */
|
||||||
|
#define CONFIG_DEBUG_MODE config_info.operation.debug_mode
|
||||||
|
|
||||||
/* Autowiz */
|
/* Autowiz */
|
||||||
/** Use autowiz or not? */
|
/** Use autowiz or not? */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue