MAJOR: 3.63 Pre-Release: Cedit Toggle for prot system, new skill, updated documentation, and more.

This commit is contained in:
Vatiken 2012-03-31 17:03:54 +00:00
parent 5c317f6863
commit 24018d145b
24 changed files with 854 additions and 38 deletions

View file

@ -185,7 +185,7 @@ ACMD(do_kick);
ACMD(do_kill);
ACMD(do_order);
ACMD(do_rescue);
ACMD(do_whirlwind);
/*****************************************************************************
* Begin Functions and defines for act.other.c

View file

@ -2441,7 +2441,7 @@ ACMD(do_whois)
if (!got_from_file && victim->desc != NULL && GET_LEVEL(ch) >= LVL_GOD) {
protocol_t * prot = victim->desc->pProtocol;
send_to_char(ch, "Client: %s\r\n", prot->pVariables[eMSDP_CLIENT_ID]->pValueString);
send_to_char(ch, "Color: %s\r\n", prot->pVariables[eMSDP_XTERM_256_COLORS] ? "Xterm" : (prot->pVariables[eMSDP_ANSI_COLORS] ? "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, "Charset: %s\r\n", prot->bCHARSET ? "Yes" : "No");
send_to_char(ch, "MSP: %s\r\n", prot->bMSP ? "Yes" : "No");

View file

@ -19,6 +19,7 @@
#include "spells.h"
#include "act.h"
#include "fight.h"
#include "mud_event.h"
ACMD(do_assist)
{
@ -390,6 +391,98 @@ ACMD(do_rescue)
WAIT_STATE(vict, 2 * PULSE_VIOLENCE);
}
EVENTFUNC(event_whirlwind)
{
struct char_data *ch, *tch;
struct mud_event_data *pMudEvent;
struct list_data *room_list;
int count;
/* This is just a dummy check, but we'll do it anyway */
if (event_obj == NULL)
return 0;
/* For the sake of simplicity, we will place the event data in easily
* referenced pointers */
pMudEvent = (struct mud_event_data *) event_obj;
ch = (struct char_data *) pMudEvent->pStruct;
/* When using a list, we have to make sure to allocate the list as it
* uses dynamic memory */
room_list = create_list();
/* We search through the "next_in_room", and grab all NPCs and add them
* to our list */
for (tch = world[IN_ROOM(ch)].people; tch; tch = tch->next_in_room)
if (IS_NPC(tch))
add_to_list(tch, room_list);
/* If our list is empty or has "0" entries, we free it from memory and
* close off our event */
if (room_list->iSize == 0) {
free_list(room_list);
send_to_char(ch, "There is no one in the room to whirlwind!\r\n");
return 0;
}
/* We spit out some ugly colour, making use of the new colour options,
* to let the player know they are performing their whirlwind strike */
send_to_char(ch, "\t[f313]You deliver a vicious \t[f014]\t[b451]WHIRLWIND!!!\tn\r\n");
/* Lets grab some a random NPC from the list, and hit() them up */
for (count = dice(1, 4); count > 0; count--) {
tch = random_from_list(room_list);
hit(ch, tch, TYPE_UNDEFINED);
}
/* Now that our attack is done, let's free out list */
free_list(room_list);
/* The "return" of the event function is the time until the event is called
* again. If we return 0, then the event is freed and removed from the list, but
* any other numerical response will be the delay until the next call */
if (GET_SKILL(ch, SKILL_WHIRLWIND) < rand_number(1, 101)) {
send_to_char(ch, "You stop spinning.\r\n");
return 0;
} else
return 1.5 * PASSES_PER_SEC;
}
/* The "Whirlwind" skill is designed to provide a basic understanding of the
* mud event and list systems. This is in NO WAY a balanced skill. */
ACMD(do_whirlwind)
{
if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_WHIRLWIND)) {
send_to_char(ch, "You have no idea how.\r\n");
return;
}
if (GET_POS(ch) < POS_FIGHTING) {
send_to_char(ch, "You must be on your feet to perform a whirlwind.\r\n");
return;
}
/* First thing we do is check to make sure the character is not in the middle
* of a whirl wind attack.
*
* "char_had_mud_event() will sift through the character's event list to see if
* an event of type "eWHIRLWIND" currently exists. */
if (char_has_mud_event(ch, eWHIRLWIND)) {
send_to_char(ch, "You are already attempting that!\r\n");
return;
}
send_to_char(ch, "You begin to spin rapidly in circles.\r\n");
act("$N begins to rapidly spin in a circle!", FALSE, ch, 0, 0, TO_ROOM);
/* NEW_EVENT() will add a new mud event to the event list of the character.
* This function below adds a new event of "eWHIRLWIND", to "ch", and passes "NULL" as
* additional data. The event will be called in "3 * PASSES_PER_SEC" or 3 seconds */
NEW_EVENT(eWHIRLWIND, ch, NULL, 3 * PASSES_PER_SEC);
WAIT_STATE(ch, PULSE_VIOLENCE * 3);
}
ACMD(do_kick)
{
char arg[MAX_INPUT_LENGTH];

View file

@ -134,6 +134,8 @@ static void cedit_setup(struct descriptor_data *d)
OLC_CONFIG(d)->operation.nameserver_is_slow = CONFIG_NS_IS_SLOW;
OLC_CONFIG(d)->operation.medit_advanced = CONFIG_MEDIT_ADVANCED;
OLC_CONFIG(d)->operation.ibt_autosave = CONFIG_IBT_AUTOSAVE;
OLC_CONFIG(d)->operation.protocol_negotiation = CONFIG_PROTOCOL_NEGOTIATION;
/* Autowiz */
OLC_CONFIG(d)->autowiz.use_autowiz = CONFIG_USE_AUTOWIZ;
OLC_CONFIG(d)->autowiz.min_wizlist_lev = CONFIG_MIN_WIZLIST_LEV;
@ -233,6 +235,8 @@ static void cedit_save_internally(struct descriptor_data *d)
CONFIG_OLC_SAVE = OLC_CONFIG(d)->operation.auto_save_olc;
CONFIG_MEDIT_ADVANCED = OLC_CONFIG(d)->operation.medit_advanced;
CONFIG_IBT_AUTOSAVE = OLC_CONFIG(d)->operation.ibt_autosave;
CONFIG_PROTOCOL_NEGOTIATION = OLC_CONFIG(d)->operation.protocol_negotiation;
/* Autowiz */
CONFIG_USE_AUTOWIZ = OLC_CONFIG(d)->autowiz.use_autowiz;
CONFIG_MIN_WIZLIST_LEV = OLC_CONFIG(d)->autowiz.min_wizlist_lev;
@ -542,6 +546,9 @@ int save_config( IDXTYPE nowhere )
"min_wizlist_lev = %d\n\n",
CONFIG_MIN_WIZLIST_LEV);
fprintf(fl, "* If yes, enable the protocol negotiation system?\n"
"protocol_negotiation = %d\n\n",
CONFIG_PROTOCOL_NEGOTIATION);
fclose(fl);
@ -727,6 +734,7 @@ static void cedit_disp_operation_options(struct descriptor_data *d)
"%sN%s) Start Message : \r\n%s%s\r\n"
"%sO%s) Medit Stats Menu : %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"
"%sQ%s) Exit To The Main Menu\r\n"
"Enter your choice : ",
grn, nrm, cyn, OLC_CONFIG(d)->operation.DFLT_PORT,
@ -745,6 +753,7 @@ static void cedit_disp_operation_options(struct descriptor_data *d)
grn, nrm, cyn, OLC_CONFIG(d)->operation.START_MESSG ? OLC_CONFIG(d)->operation.START_MESSG : "<None>",
grn, nrm, cyn, OLC_CONFIG(d)->operation.medit_advanced ? "Advanced" : "Standard",
grn, nrm, cyn, OLC_CONFIG(d)->operation.ibt_autosave ? "Yes" : "No",
grn, nrm, cyn, OLC_CONFIG(d)->operation.protocol_negotiation ? "Yes" : "No",
grn, nrm
);
@ -1218,6 +1227,11 @@ void cedit_parse(struct descriptor_data *d, char *arg)
TOGGLE_VAR(OLC_CONFIG(d)->operation.ibt_autosave);
break;
case 'r':
case 'R':
TOGGLE_VAR(OLC_CONFIG(d)->operation.protocol_negotiation);
break;
case 'q':
case 'Q':
cedit_disp_menu(d);

View file

@ -1634,6 +1634,7 @@ void init_spell_levels(void)
spell_level(SKILL_RESCUE, CLASS_WARRIOR, 3);
spell_level(SKILL_TRACK, CLASS_WARRIOR, 9);
spell_level(SKILL_BASH, CLASS_WARRIOR, 12);
spell_level(SKILL_WHIRLWIND, CLASS_WARRIOR, 12);
}
/* This is the exp given to implementors -- it must always be greater than the

View file

@ -1443,7 +1443,7 @@ static void init_descriptor (struct descriptor_data *newd, int desc)
*newd->output = '\0';
newd->bufptr = 0;
newd->has_prompt = 1; /* prompt is part of greetings */
STATE(newd) = CON_GET_PROTOCOL;
STATE(newd) = CONFIG_PROTOCOL_NEGOTIATION ? CON_GET_PROTOCOL : CON_GET_NAME;
CREATE(newd->history, char *, HISTORY_SIZE);
if (++last_desc == 1000)
last_desc = 1;
@ -1457,6 +1457,7 @@ static int new_descriptor(socket_t s)
{
socket_t desc;
int sockets_connected = 0;
int greetsize;
socklen_t i;
struct descriptor_data *newd;
struct sockaddr_in peer;
@ -1521,13 +1522,16 @@ static int new_descriptor(socket_t s)
newd->next = descriptor_list;
descriptor_list = newd;
/* Attach Event */
attach_mud_event(new_mud_event(ePROTOCOLS, newd, NULL), 1.5 * PASSES_PER_SEC);
/* KaVir's plugin*/
write_to_output(newd, "Attempting to Detect Client, Please Wait...\r\n");
ProtocolNegotiate(newd);
if (CONFIG_PROTOCOL_NEGOTIATION) {
/* Attach Event */
NEW_EVENT(ePROTOCOLS, newd, NULL, 1.5 * PASSES_PER_SEC);
/* KaVir's plugin*/
write_to_output(newd, "Attempting to Detect Client, Please Wait...\r\n");
ProtocolNegotiate(newd);
} else {
greetsize = strlen(GREETINGS);
write_to_output(newd, "%s", ProtocolOutput(newd, GREETINGS, &greetsize));
}
return (0);
}

View file

@ -297,7 +297,6 @@ int min_wizlist_lev = LVL_GOD;
* set to YES. */
int display_closed_doors = YES;
/* Automap and map options */
/* Default is to have automap and map command only enabled for immortals */
int map_option = MAP_IMM_ONLY;
@ -309,3 +308,6 @@ int medit_advanced_stats = YES;
/* Does "bug resolve" autosave ? */
int ibt_autosave = YES;
/* Use the protocol negotiation system */
int protocol_negotiation = YES;

View file

@ -68,6 +68,7 @@ extern const char *START_MESSG;
extern int use_autowiz;
extern int min_wizlist_lev;
extern int display_closed_doors;
extern int protocol_negotiation;
/* Automap and map options */
extern int map_option;
extern int default_map_size;

View file

@ -24,7 +24,7 @@
* @todo cpp_extern isn't needed here (or anywhere) as the extern reserved word
* works correctly with C compilers (at least in my Experience)
* Jeremy Osborne 1/28/2008 */
cpp_extern const char *tbamud_version = "tbaMUD 3.62";
cpp_extern const char *tbamud_version = "tbaMUD 3.63";
/* strings corresponding to ordinals/bitvectors in structs.h */
/* (Note: strings for class definitions in class.c instead of here) */

View file

@ -3761,6 +3761,7 @@ static void load_default_config( void )
CONFIG_TRACK_T_DOORS = track_through_doors;
CONFIG_NO_MORT_TO_IMMORT = no_mort_to_immort;
CONFIG_DISP_CLOSED_DOORS = display_closed_doors;
CONFIG_PROTOCOL_NEGOTIATION = protocol_negotiation;
CONFIG_DIAGONAL_DIRS = diagonal_dirs;
CONFIG_MAP = map_option;
CONFIG_MAP_SIZE = default_map_size;
@ -4005,6 +4006,8 @@ void load_config( void )
case 'p':
if (!str_cmp(tag, "pk_allowed"))
CONFIG_PK_ALLOWED = num;
else if (!str_cmp(tag, "protocol_negotiation"))
CONFIG_PROTOCOL_NEGOTIATION = num;
else if (!str_cmp(tag, "pt_allowed"))
CONFIG_PT_ALLOWED = num;
break;

View file

@ -127,6 +127,8 @@ void event_process(void)
the_event->q_el = queue_enq(event_q, the_event, new_time + pulse);
else
{
if (the_event->isMudEvent && the_event->event_obj != NULL)
free_mud_event((struct mud_event_data *) the_event->event_obj);
/* It is assumed that the_event will already have freed ->event_obj. */
free(the_event);
}

View file

@ -343,6 +343,7 @@ cpp_extern const struct command_info cmd_info[] = {
{ "whois" , "whoi" , POS_DEAD , do_whois , 0, 0 },
{ "whoami" , "whoami" , POS_DEAD , do_gen_ps , 0, SCMD_WHOAMI },
{ "where" , "where" , POS_RESTING , do_where , 1, 0 },
{ "whirlwind", "whirl" , POS_FIGHTING, do_whirlwind, 0, 0 },
{ "whisper" , "whisper" , POS_RESTING , do_spec_comm, 0, SCMD_WHISPER },
{ "wield" , "wie" , POS_RESTING , do_wield , 0, 0 },
{ "withdraw" , "withdraw", POS_STANDING, do_not_here , 1, 0 },
@ -1303,7 +1304,6 @@ EVENTFUNC(get_protocols)
write_to_output(d, GREETINGS, 0);
STATE(d) = CON_GET_NAME;
free_mud_event(pMudEvent);
return 0;
}

View file

@ -18,17 +18,38 @@
/* Global List */
struct list_data * world_events = NULL;
/* The mud_event_index[] is merely a tool for organizing events, and giving
* them a "const char *" name to help in potential debugging */
struct mud_event_list mud_event_index[] = {
{ "Null" , NULL , -1 }, /* eNULL */
{ "Protocol" , get_protocols, EVENT_DESC } /* ePROTOCOLS */
{ "Null" , NULL , -1 }, /* eNULL */
{ "Protocol" , get_protocols , EVENT_DESC }, /* ePROTOCOLS */
{ "Whirlwind" , event_whirlwind, EVENT_CHAR } /* eWHIRLWIND */
};
/* init_events() is the ideal function for starting global events. This
* might be the case if you were to move the contents of heartbeat() into
* the event system */
void init_events(void)
{
/* Allocate Event List */
world_events = create_list();
}
/* event_countdown() is used for events which are to be used as a countdown...
* go figure eh? This could be useful for skills which have an extended cooldown,
* like "lay on hands" once every 24 hours. Simply add an event to the
* mud_event_index[] such as:
* { "Lay on hands" , event_countdown, EVENT_CHAR }
* and then add the event after a successful skill call:
* attach_mud_event(new_mud_event(eLAYONHANDS, ch, NULL), 24 * SECS_PER_MUD_HOUR);
* and then add something like this is your skill function:
* 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");
* return;
* }
* The bottom switch() is for any post-event actions, like telling the character they can
* now access their skill again.
*/
EVENTFUNC(event_countdown)
{
struct mud_event_data * pMudEvent;
@ -48,11 +69,14 @@ EVENTFUNC(event_countdown)
default:
break;
}
free_mud_event(pMudEvent);
return 0;
}
/* As of 3.63, there are only global, descriptor, and character events. This
* is due to the potential scope of the necessary debugging if events were
* included with rooms, objects, spells or any other structure type. Adding
* events to these other systems should be just as easy as adding the current
* library was, and should be available in a future release. - Vat */
void attach_mud_event(struct mud_event_data *pMudEvent, long time)
{
struct event * pEvent;
@ -126,6 +150,9 @@ struct mud_event_data * char_has_mud_event(struct char_data * ch, event_id iId)
struct mud_event_data * pMudEvent;
bool found = FALSE;
if (ch->events->iSize == 0)
return NULL;
simple_list(NULL);
while ((pEvent = (struct event *) simple_list(ch->events)) != NULL) {

View file

@ -19,9 +19,12 @@
#define EVENT_DESC 1
#define EVENT_CHAR 2
#define NEW_EVENT(event_id, struct, var, time) (attach_mud_event(new_mud_event(event_id, struct, var), time))
typedef enum {
eNULL,
ePROTOCOLS,
ePROTOCOLS, /* The Protocol Detection Event */
eWHIRLWIND, /* The Whirlwind Attack */
} event_id;
struct mud_event_list {
@ -50,5 +53,6 @@ struct mud_event_data * char_has_mud_event(struct char_data * ch, event_id iId);
/* Events */
EVENTFUNC(event_countdown);
EVENTFUNC(get_protocols);
EVENTFUNC(event_whirlwind);
#endif /* _MUD_EVENT_H_ */

View file

@ -1,9 +1,5 @@
/******************************************************************************
Protocol snippet by KaVir. Released into the Public Domain in February 2011.
This snippet was originally designed to be codebase independent, but has been
modified slightly so that it runs out-of-the-box on Merc derivatives. To use
it for other codebases, just change the code in the "Diku/Merc" section below.
******************************************************************************/
/******************************************************************************
@ -550,13 +546,16 @@ const char *ProtocolOutput( descriptor_t *apDescriptor, const char *apData, int
pCopyFrom = Tab;
break;
case '_':
pCopyFrom = "\x1B[4m"; /* Underline */
pCopyFrom = "\x1B[4m"; /* Underline... if supported */
break;
case '+':
pCopyFrom = "\x1B[1m"; /* Bold */
pCopyFrom = "\x1B[1m"; /* Bold... if supported */
break;
case '-':
pCopyFrom = "\x1B[5m"; /* Blinking??? */
pCopyFrom = "\x1B[5m"; /* Blinking... if supported */
break;
case '=':
pCopyFrom = "\x1B[7m"; /* Reverse... if supported */
break;
case '*':
pCopyFrom = "@"; /* The At Symbol... I don't really like this, but it seems like
@ -2429,9 +2428,9 @@ static const char *GetAnsiColour( bool_t abBackground, int aRed, int aGreen, int
else if ( aRed == aGreen && aRed == aBlue )
return abBackground ? s_BackWhite : aRed >= 4 ? s_BoldWhite : s_DarkWhite;
else if ( aRed > aGreen && aRed > aBlue )
return abBackground ? s_BackRed : aRed >= 3 ? s_BoldRed : s_DarkRed;
return abBackground ? s_BackRed : aRed > 3 ? s_BoldRed : s_DarkRed;
else if ( aRed == aGreen && aRed > aBlue )
return abBackground ? s_BackYellow : aRed >= 3 ? s_BoldYellow : s_DarkYellow;
return abBackground ? s_BackYellow : aRed > 3 ? s_BoldYellow : s_DarkYellow;
else if ( aRed == aBlue && aRed > aGreen )
return abBackground ? s_BackMagenta : aRed >= 3 ? s_BoldMagenta : s_DarkMagenta;
else if ( aGreen > aBlue )

View file

@ -950,5 +950,6 @@ void mag_assign_spells(void)
skillo(SKILL_SNEAK, "sneak");
skillo(SKILL_STEAL, "steal");
skillo(SKILL_TRACK, "track");
skillo(SKILL_WHIRLWIND, "whirlwind");
}

View file

@ -103,11 +103,11 @@
#define SKILL_HIDE 133 /* Reserved Skill[] DO NOT CHANGE */
#define SKILL_KICK 134 /* Reserved Skill[] DO NOT CHANGE */
#define SKILL_PICK_LOCK 135 /* Reserved Skill[] DO NOT CHANGE */
/* Undefined 136 */
#define SKILL_WHIRLWIND 136
#define SKILL_RESCUE 137 /* Reserved Skill[] DO NOT CHANGE */
#define SKILL_SNEAK 138 /* Reserved Skill[] DO NOT CHANGE */
#define SKILL_STEAL 139 /* Reserved Skill[] DO NOT CHANGE */
#define SKILL_TRACK 140 /* Reserved Skill[] DO NOT CHANGE */
#define SKILL_TRACK 140 /* Reserved Skill[] DO NOT CHANGE */
/* New skills may be added here up to MAX_SKILLS (200) */
/* NON-PLAYER AND OBJECT SPELLS AND SKILLS: The practice levels for the spells

View file

@ -22,7 +22,7 @@
* on an older version. You are supposed to compare this with the macro
* TBAMUD_VERSION() in utils.h.
* It is read as Major/Minor/Patchlevel - MMmmPP */
#define _TBAMUD 0x030620
#define _TBAMUD 0x030630
/** If you want equipment to be automatically equipped to the same place
* it was when players rented, set the define below to 1 because
@ -1348,6 +1348,7 @@ struct game_operation
char *START_MESSG; /**< The start msg for new characters. */
int medit_advanced; /**< Does the medit OLC show the advanced stats menu ? */
int ibt_autosave; /**< Does "bug resolve" autosave ? */
int protocol_negotiation; /**< Enable the protocol negotiation system ? */
};
/** The Autowizard options. */

View file

@ -1046,6 +1046,8 @@ do \
#define CONFIG_MEDIT_ADVANCED config_info.operation.medit_advanced
/** Does "bug resolve" autosave ? */
#define CONFIG_IBT_AUTOSAVE config_info.operation.ibt_autosave
/** Use the protocol negotiation system? */
#define CONFIG_PROTOCOL_NEGOTIATION config_info.operation.protocol_negotiation
/* Autowiz */
/** Use autowiz or not? */