mirror of
https://github.com/tbamud/tbamud.git
synced 2025-09-21 21:40:49 +02:00
Added room login trig types --Jamdog
This commit is contained in:
parent
e9373bb849
commit
ca675fdb67
6 changed files with 178 additions and 151 deletions
|
@ -35,6 +35,8 @@ export (QQ's a zone into a tarball)t
|
|||
Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist)
|
||||
(lots of major bugfixes too)
|
||||
tbaMUD 3.59
|
||||
[Jan 31 2009] - Jamdog
|
||||
Added room login trig types, to catch players logging in to a particular room
|
||||
[Jan 29 2009] - Rumble
|
||||
Corrected zcheck MAX_OBJ_GOLD_ALLOWED to compare against Val 0, not Val 1. (thanks Tails)
|
||||
Created new MAX_OBJ_GOLD_ALLOWED define for zcheck. (thanks Tails)
|
||||
|
|
Binary file not shown.
|
@ -1,14 +1,14 @@
|
|||
/**
|
||||
* @file constants.c
|
||||
* Numeric and string contants used by the MUD.
|
||||
*
|
||||
*
|
||||
* Part of the core tbaMUD source code distribution, which is a derivative
|
||||
* of, and continuation of, CircleMUD.
|
||||
*
|
||||
* All rights reserved. See license for complete information.
|
||||
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
|
||||
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
|
||||
*
|
||||
*
|
||||
* All rights reserved. See license for complete information.
|
||||
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
|
||||
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
|
||||
*
|
||||
* @todo Come up with a standard for descriptive arrays. Either all end with
|
||||
* newlines or all of them don not.
|
||||
*/
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
/** Current tbaMUD version.
|
||||
* @todo defined with _TBAMUD so we don't have multiple constants to change.
|
||||
* @todo cpp_extern isn't needed here (or anywhere) as the extern reserved word
|
||||
* @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.58";
|
||||
|
@ -29,8 +29,8 @@ cpp_extern const char *tbamud_version = "tbaMUD 3.58";
|
|||
/* strings corresponding to ordinals/bitvectors in structs.h */
|
||||
/* (Note: strings for class definitions in class.c instead of here) */
|
||||
|
||||
/** Description of cardinal directions.
|
||||
* @pre Must be in the same order as the defines.
|
||||
/** Description of cardinal directions.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *dirs[] =
|
||||
{
|
||||
|
@ -40,11 +40,11 @@ const char *dirs[] =
|
|||
"west",
|
||||
"up",
|
||||
"down",
|
||||
"\n"
|
||||
"\n"
|
||||
};
|
||||
|
||||
/** Room flag descriptions.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *room_bits[] = {
|
||||
"DARK",
|
||||
|
@ -64,11 +64,11 @@ const char *room_bits[] = {
|
|||
"OLC",
|
||||
"*", /* The BFS Mark. */
|
||||
"WORLDMAP",
|
||||
"\n"
|
||||
"\n"
|
||||
};
|
||||
|
||||
/** Exit bits for doors.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *exit_bits[] = {
|
||||
"DOOR",
|
||||
|
@ -79,7 +79,7 @@ const char *exit_bits[] = {
|
|||
};
|
||||
|
||||
/** Description of the room sector type.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *sector_types[] = {
|
||||
"Inside",
|
||||
|
@ -96,7 +96,7 @@ const char *sector_types[] = {
|
|||
};
|
||||
|
||||
/** PC and NPC sex.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *genders[] =
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ const char *genders[] =
|
|||
};
|
||||
|
||||
/** Character positions.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *position_types[] = {
|
||||
"Dead",
|
||||
|
@ -123,7 +123,7 @@ const char *position_types[] = {
|
|||
};
|
||||
|
||||
/** Player flags.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *player_bits[] = {
|
||||
"KILLER",
|
||||
|
@ -152,7 +152,7 @@ const char *player_bits[] = {
|
|||
};
|
||||
|
||||
/** Mob action flags.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *action_bits[] = {
|
||||
"SPEC",
|
||||
|
@ -178,7 +178,7 @@ const char *action_bits[] = {
|
|||
};
|
||||
|
||||
/** PC Preference flags.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *preference_bits[] = {
|
||||
"BRIEF",
|
||||
|
@ -217,7 +217,7 @@ const char *preference_bits[] = {
|
|||
};
|
||||
|
||||
/** Affected bits.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *affected_bits[] =
|
||||
{
|
||||
|
@ -248,7 +248,7 @@ const char *affected_bits[] =
|
|||
};
|
||||
|
||||
/** Connection type descriptions.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *connected_types[] = {
|
||||
"Playing",
|
||||
|
@ -284,7 +284,7 @@ const char *connected_types[] = {
|
|||
};
|
||||
|
||||
/** Describes the position in the equipment listing.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Not used in sprinttype() so no \n. */
|
||||
const char *wear_where[] = {
|
||||
"<used as light> ",
|
||||
|
@ -308,7 +308,7 @@ const char *wear_where[] = {
|
|||
};
|
||||
|
||||
/* Describes where an item can be worn.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *equipment_types[] = {
|
||||
"Used as light",
|
||||
|
@ -333,7 +333,7 @@ const char *equipment_types[] = {
|
|||
};
|
||||
|
||||
/** Describes the type of object.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *item_types[] = {
|
||||
"UNDEFINED",
|
||||
|
@ -364,7 +364,7 @@ const char *item_types[] = {
|
|||
};
|
||||
|
||||
/** Describes the wear flags set on an item.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *wear_bits[] = {
|
||||
"TAKE",
|
||||
|
@ -386,7 +386,7 @@ const char *wear_bits[] = {
|
|||
};
|
||||
|
||||
/** Describes the extra flags applied to an item.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *extra_bits[] = {
|
||||
"GLOW",
|
||||
|
@ -411,7 +411,7 @@ const char *extra_bits[] = {
|
|||
};
|
||||
|
||||
/** Describes the apply types.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *apply_types[] = {
|
||||
"NONE",
|
||||
|
@ -443,7 +443,7 @@ const char *apply_types[] = {
|
|||
};
|
||||
|
||||
/** Describes the closure mechanism for a container.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *container_bits[] = {
|
||||
"CLOSEABLE",
|
||||
|
@ -454,7 +454,7 @@ const char *container_bits[] = {
|
|||
};
|
||||
|
||||
/** Describes the liquid description.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *drinks[] =
|
||||
{
|
||||
|
@ -478,7 +478,7 @@ const char *drinks[] =
|
|||
};
|
||||
|
||||
/** Describes a one word alias for each type of liquid.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *drinknames[] =
|
||||
{
|
||||
|
@ -502,7 +502,7 @@ const char *drinknames[] =
|
|||
};
|
||||
|
||||
/** Define the effect of liquids on hunger, thirst, and drunkenness, in that
|
||||
* order. See values.doc for more information.
|
||||
* order. See values.doc for more information.
|
||||
* @pre Must be in the same order as the defines. */
|
||||
int drink_aff[][3] = {
|
||||
{0, 1, 10},
|
||||
|
@ -524,7 +524,7 @@ int drink_aff[][3] = {
|
|||
};
|
||||
|
||||
/** Describes the color of the various drinks.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* @pre Must be in the same order as the defines.
|
||||
* Must end array with a single newline. */
|
||||
const char *color_liquid[] =
|
||||
{
|
||||
|
@ -547,7 +547,7 @@ const char *color_liquid[] =
|
|||
"\n"
|
||||
};
|
||||
|
||||
/** Used to describe the level of fullness of a drink container. Not used in
|
||||
/** Used to describe the level of fullness of a drink container. Not used in
|
||||
* sprinttype() so no \n. */
|
||||
const char *fullness[] =
|
||||
{
|
||||
|
@ -877,17 +877,17 @@ const char *wtrig_types[] = {
|
|||
"Cast",
|
||||
"Leave",
|
||||
"Door",
|
||||
"UNUSED",
|
||||
"Login",
|
||||
"Time",
|
||||
"\n"
|
||||
};
|
||||
|
||||
/** The names of the different channels that history is stored for.
|
||||
/** The names of the different channels that history is stored for.
|
||||
* @todo Only referenced by do_history at the moment. Should be moved local
|
||||
* to that function. */
|
||||
const char *history_types[] = {
|
||||
"all",
|
||||
"say",
|
||||
"all",
|
||||
"say",
|
||||
"gossip",
|
||||
"wiznet",
|
||||
"tell",
|
||||
|
@ -895,7 +895,7 @@ const char *history_types[] = {
|
|||
"grats",
|
||||
"holler",
|
||||
"auction",
|
||||
"\n"
|
||||
"\n"
|
||||
};
|
||||
/* --- End of constants arrays. --- */
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/**
|
||||
* @file dg_scripts.h
|
||||
* Header file for script structures, constants, and function prototypes for
|
||||
* Header file for script structures, constants, and function prototypes for
|
||||
* dg_scripts.c
|
||||
*
|
||||
*
|
||||
* Part of the core tbaMUD source code distribution, which is a derivative
|
||||
* of, and continuation of, CircleMUD.
|
||||
*
|
||||
*
|
||||
* This source code, which was not part of the CircleMUD legacy code,
|
||||
* was created by the following people:
|
||||
* $Author: Mark A. Heilpern/egreen/Welcor $
|
||||
* $Date: 2004/10/11 12:07:00$
|
||||
* $Revision: 1.0.14 $
|
||||
* was created by the following people:
|
||||
* $Author: Mark A. Heilpern/egreen/Welcor $
|
||||
* $Date: 2004/10/11 12:07:00$
|
||||
* $Revision: 1.0.14 $
|
||||
*/
|
||||
#ifndef _DG_SCRIPTS_H_
|
||||
#define _DG_SCRIPTS_H_
|
||||
|
@ -26,15 +26,15 @@
|
|||
/* spells cast by objects and rooms use this level */
|
||||
#define DG_SPELL_LEVEL 25
|
||||
|
||||
/* Define this if you don't want wear/remove triggers to fire when a player
|
||||
/* Define this if you don't want wear/remove triggers to fire when a player
|
||||
* is saved. */
|
||||
#define NO_EXTRANEOUS_TRIGGERS
|
||||
|
||||
/* %actor.room% behaviour :
|
||||
* Until pl 7 %actor.room% returned a room vnum. Working with this number in
|
||||
* scripts was unnecessarily hard, especially in those situations one needed
|
||||
* Until pl 7 %actor.room% returned a room vnum. Working with this number in
|
||||
* scripts was unnecessarily hard, especially in those situations one needed
|
||||
* the id of the room, the items in it, etc. As a result of this, the output
|
||||
* has been changed (as of pl 8) to a room variable.i This means old scripts
|
||||
* has been changed (as of pl 8) to a room variable.i This means old scripts
|
||||
* will need a minor adjustment;
|
||||
*
|
||||
* Before:
|
||||
|
@ -105,8 +105,9 @@
|
|||
#define WTRIG_CAST (1 << 15) /* spell cast in room */
|
||||
#define WTRIG_LEAVE (1 << 16) /* character leaves the room */
|
||||
#define WTRIG_DOOR (1 << 17) /* door manipulated in room */
|
||||
|
||||
#define WTRIG_LOGIN (1 << 18) /* character logs into MUD */
|
||||
#define WTRIG_TIME (1 << 19) /* trigger based on game hour */
|
||||
|
||||
/* obj command trigger types */
|
||||
#define OCMD_EQUIP (1 << 0) /* obj must be in char's equip */
|
||||
#define OCMD_INVEN (1 << 1) /* obj must be in char's inven */
|
||||
|
@ -120,7 +121,7 @@
|
|||
#define TRIG_NEW 0 /* trigger starts from top */
|
||||
#define TRIG_RESTART 1 /* trigger restarting */
|
||||
|
||||
/* These are slightly off of PULSE_MOBILE so everything isnt happening at the
|
||||
/* These are slightly off of PULSE_MOBILE so everything isnt happening at the
|
||||
* same time. */
|
||||
#define PULSE_DG_SCRIPT (13 RL_SEC)
|
||||
|
||||
|
@ -260,6 +261,8 @@ void time_mtrigger(char_data *ch);
|
|||
void time_otrigger(obj_data *obj);
|
||||
void time_wtrigger(room_data *room);
|
||||
|
||||
int login_wtrigger(struct room_data *room, char_data *actor);
|
||||
|
||||
/* function prototypes from dg_scripts.c */
|
||||
ACMD(do_attach) ;
|
||||
ACMD(do_detach);
|
||||
|
|
|
@ -88,8 +88,8 @@ int is_substring(char *sub, char *string)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Return 1 if str contains a word or phrase from wordlist. Phrases are in
|
||||
* double quotes ("). if wrdlist is NULL, then return 1, if str is NULL,
|
||||
/* Return 1 if str contains a word or phrase from wordlist. Phrases are in
|
||||
* double quotes ("). if wrdlist is NULL, then return 1, if str is NULL,
|
||||
* return 0. */
|
||||
int word_check(char *str, char *wordlist)
|
||||
{
|
||||
|
@ -674,7 +674,7 @@ int get_otrigger(obj_data *obj, char_data *actor)
|
|||
if (TRIGGER_CHECK(t, OTRIG_GET) && (rand_number(1, 100) <= GET_TRIG_NARG(t))) {
|
||||
ADD_UID_VAR(buf, t, actor, "actor", 0);
|
||||
ret_val = script_driver(&obj, t, OBJ_TRIGGER, TRIG_NEW);
|
||||
/* Don't allow a get to take place, if the actor is killed (the mud
|
||||
/* Don't allow a get to take place, if the actor is killed (the mud
|
||||
* would choke on obj_to_char) or the object is purged. */
|
||||
if (DEAD(actor) || !obj)
|
||||
return 0;
|
||||
|
@ -837,7 +837,7 @@ int give_otrigger(obj_data *obj, char_data *actor, char_data *victim)
|
|||
ADD_UID_VAR(buf, t, actor, "actor", 0);
|
||||
ADD_UID_VAR(buf, t, victim, "victim", 0);
|
||||
ret_val = script_driver(&obj, t, OBJ_TRIGGER, TRIG_NEW);
|
||||
/* Don't allow a give to take place, if the object is purged or the
|
||||
/* Don't allow a give to take place, if the object is purged or the
|
||||
* object is not carried by the giver. */
|
||||
if (!obj || obj->carried_by != actor)
|
||||
return 0;
|
||||
|
@ -1237,3 +1237,22 @@ void time_wtrigger(struct room_data *room)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
int login_wtrigger(struct room_data *room, char_data *actor)
|
||||
{
|
||||
trig_data *t;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
|
||||
if (!SCRIPT_CHECK(room, WTRIG_LOGIN))
|
||||
return 1;
|
||||
|
||||
for (t = TRIGGERS(SCRIPT(room)); t; t = t->next) {
|
||||
if (TRIGGER_CHECK(t, WTRIG_LOGIN) &&
|
||||
(rand_number(1, 100) <= GET_TRIG_NARG(t))) {
|
||||
ADD_UID_VAR(buf, t, actor, "actor", 0);
|
||||
return script_driver(&room, t, WLD_TRIGGER, TRIG_NEW);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -51,12 +51,12 @@ int *cmd_sort_info = NULL;
|
|||
|
||||
struct command_info *complete_cmd_info;
|
||||
|
||||
/* This is the Master Command List. You can put new commands in, take commands
|
||||
* out, change the order they appear in, etc. You can adjust the "priority"
|
||||
/* This is the Master Command List. You can put new commands in, take commands
|
||||
* out, change the order they appear in, etc. You can adjust the "priority"
|
||||
* of commands simply by changing the order they appear in the command list.
|
||||
* (For example, if you want "as" to mean "assist" instead of "ask", just put
|
||||
* "assist" above "ask" in the Master Command List. In general, utility
|
||||
* commands such as "at" should have high priority; infrequently used and
|
||||
* (For example, if you want "as" to mean "assist" instead of "ask", just put
|
||||
* "assist" above "ask" in the Master Command List. In general, utility
|
||||
* commands such as "at" should have high priority; infrequently used and
|
||||
* dangerously destructive commands should have low priority. */
|
||||
|
||||
cpp_extern const struct command_info cmd_info[] = {
|
||||
|
@ -333,61 +333,61 @@ cpp_extern const struct command_info cmd_info[] = {
|
|||
{ "zcheck" , "zcheck" , POS_DEAD , do_zcheck , LVL_GOD, 0 },
|
||||
{ "zpurge" , "zpurge" , POS_DEAD , do_zpurge , LVL_BUILDER, 0 },
|
||||
|
||||
{ "\n", "zzzzzzz", 0, 0, 0, 0 } }; /* this must be last */
|
||||
|
||||
|
||||
/* Thanks to Melzaren for this change to allow DG Scripts to be attachable
|
||||
*to player's while still disallowing them to manually use the DG-Commands. */
|
||||
const struct mob_script_command_t mob_script_commands[] = {
|
||||
{ "\n", "zzzzzzz", 0, 0, 0, 0 } }; /* this must be last */
|
||||
|
||||
|
||||
/* Thanks to Melzaren for this change to allow DG Scripts to be attachable
|
||||
*to player's while still disallowing them to manually use the DG-Commands. */
|
||||
const struct mob_script_command_t mob_script_commands[] = {
|
||||
|
||||
/* DG trigger commands. minimum_level should be set to -1. */
|
||||
{ "masound" , do_masound , 0 },
|
||||
{ "mkill" , do_mkill , 0 },
|
||||
{ "mjunk" , do_mjunk , 0 },
|
||||
{ "mdamage" , do_mdamage , 0 },
|
||||
{ "mdoor" , do_mdoor , 0 },
|
||||
{ "mecho" , do_mecho , 0 },
|
||||
{ "mrecho" , do_mrecho , 0 },
|
||||
{ "mechoaround", do_mechoaround , 0 },
|
||||
{ "msend" , do_msend , 0 },
|
||||
{ "mload" , do_mload , 0 },
|
||||
{ "mpurge" , do_mpurge , 0 },
|
||||
{ "mgoto" , do_mgoto , 0 },
|
||||
{ "mat" , do_mat , 0 },
|
||||
{ "mteleport", do_mteleport, 0 },
|
||||
{ "mforce" , do_mforce , 0 },
|
||||
{ "mhunt" , do_mhunt , 0 },
|
||||
{ "mremember", do_mremember, 0 },
|
||||
{ "mforget" , do_mforget , 0 },
|
||||
{ "mtransform", do_mtransform , 0 },
|
||||
{ "mzoneecho", do_mzoneecho, 0 },
|
||||
{ "mfollow" , do_mfollow , 0 },
|
||||
{ "masound" , do_masound , 0 },
|
||||
{ "mkill" , do_mkill , 0 },
|
||||
{ "mjunk" , do_mjunk , 0 },
|
||||
{ "mdamage" , do_mdamage , 0 },
|
||||
{ "mdoor" , do_mdoor , 0 },
|
||||
{ "mecho" , do_mecho , 0 },
|
||||
{ "mrecho" , do_mrecho , 0 },
|
||||
{ "mechoaround", do_mechoaround , 0 },
|
||||
{ "msend" , do_msend , 0 },
|
||||
{ "mload" , do_mload , 0 },
|
||||
{ "mpurge" , do_mpurge , 0 },
|
||||
{ "mgoto" , do_mgoto , 0 },
|
||||
{ "mat" , do_mat , 0 },
|
||||
{ "mteleport", do_mteleport, 0 },
|
||||
{ "mforce" , do_mforce , 0 },
|
||||
{ "mhunt" , do_mhunt , 0 },
|
||||
{ "mremember", do_mremember, 0 },
|
||||
{ "mforget" , do_mforget , 0 },
|
||||
{ "mtransform", do_mtransform , 0 },
|
||||
{ "mzoneecho", do_mzoneecho, 0 },
|
||||
{ "mfollow" , do_mfollow , 0 },
|
||||
{ "\n" , do_not_here , 0 } };
|
||||
|
||||
int script_command_interpreter(struct char_data *ch, char *arg) {
|
||||
/* DG trigger commands */
|
||||
|
||||
int i;
|
||||
char first_arg[MAX_INPUT_LENGTH];
|
||||
char *line;
|
||||
|
||||
skip_spaces(&arg);
|
||||
if (!*arg)
|
||||
return 0;
|
||||
|
||||
line = any_one_arg(arg, first_arg);
|
||||
|
||||
for (i = 0; *mob_script_commands[i].command_name != '\n'; i++)
|
||||
if (!str_cmp(first_arg, mob_script_commands[i].command_name))
|
||||
break; // NB - only allow full matches.
|
||||
|
||||
if (*mob_script_commands[i].command_name == '\n')
|
||||
return 0; // no matching commands.
|
||||
|
||||
/* Poiner to the command? */
|
||||
((*mob_script_commands[i].command_pointer) (ch, line, 0,
|
||||
mob_script_commands[i].subcmd));
|
||||
return 1; // We took care of execution. Let caller know.
|
||||
int script_command_interpreter(struct char_data *ch, char *arg) {
|
||||
/* DG trigger commands */
|
||||
|
||||
int i;
|
||||
char first_arg[MAX_INPUT_LENGTH];
|
||||
char *line;
|
||||
|
||||
skip_spaces(&arg);
|
||||
if (!*arg)
|
||||
return 0;
|
||||
|
||||
line = any_one_arg(arg, first_arg);
|
||||
|
||||
for (i = 0; *mob_script_commands[i].command_name != '\n'; i++)
|
||||
if (!str_cmp(first_arg, mob_script_commands[i].command_name))
|
||||
break; // NB - only allow full matches.
|
||||
|
||||
if (*mob_script_commands[i].command_name == '\n')
|
||||
return 0; // no matching commands.
|
||||
|
||||
/* Poiner to the command? */
|
||||
((*mob_script_commands[i].command_pointer) (ch, line, 0,
|
||||
mob_script_commands[i].subcmd));
|
||||
return 1; // We took care of execution. Let caller know.
|
||||
}
|
||||
|
||||
const char *fill[] =
|
||||
|
@ -456,7 +456,7 @@ void command_interpreter(struct char_data *ch, char *argument)
|
|||
return;
|
||||
|
||||
/* special case to handle one-character, non-alphanumeric commands; requested
|
||||
* by many people so "'hi" or ";godnet test" is possible. Patch sent by Eric
|
||||
* by many people so "'hi" or ";godnet test" is possible. Patch sent by Eric
|
||||
* Green and Stefan Wasilewski. */
|
||||
if (!isalpha(*argument)) {
|
||||
arg[0] = argument[0];
|
||||
|
@ -475,11 +475,11 @@ void command_interpreter(struct char_data *ch, char *argument)
|
|||
if (cont) return; /* yes, command trigger took over */
|
||||
}
|
||||
|
||||
/* Allow IMPLs to switch into mobs to test the commands. */
|
||||
if (IS_NPC(ch) && ch->desc && GET_LEVEL(ch->desc->original) >= LVL_IMPL) {
|
||||
if (script_command_interpreter(ch, argument))
|
||||
return;
|
||||
}
|
||||
/* Allow IMPLs to switch into mobs to test the commands. */
|
||||
if (IS_NPC(ch) && ch->desc && GET_LEVEL(ch->desc->original) >= LVL_IMPL) {
|
||||
if (script_command_interpreter(ch, argument))
|
||||
return;
|
||||
}
|
||||
|
||||
for (length = strlen(arg), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++)
|
||||
if(complete_cmd_info[cmd].command_pointer != do_action &&
|
||||
|
@ -500,17 +500,17 @@ void command_interpreter(struct char_data *ch, char *argument)
|
|||
int found = 0;
|
||||
send_to_char(ch, "Huh!?!\r\n");
|
||||
|
||||
for (cmd = 0; *cmd_info[cmd].command != '\n'; cmd++)
|
||||
for (cmd = 0; *cmd_info[cmd].command != '\n'; cmd++)
|
||||
{
|
||||
if (*arg != *cmd_info[cmd].command || cmd_info[cmd].minimum_level > GET_LEVEL(ch))
|
||||
continue;
|
||||
|
||||
/* Only apply levenshtein counts if the command is not a trigger command. */
|
||||
if ( (levenshtein_distance(arg, cmd_info[cmd].command) <= 2) &&
|
||||
(cmd_info[cmd].minimum_level >= 0) )
|
||||
(cmd_info[cmd].minimum_level >= 0) )
|
||||
{
|
||||
if (!found)
|
||||
{
|
||||
if (!found)
|
||||
{
|
||||
send_to_char(ch, "\r\nDid you mean:\r\n");
|
||||
found = 1;
|
||||
}
|
||||
|
@ -631,8 +631,8 @@ ACMD(do_alias)
|
|||
}
|
||||
|
||||
/* Valid numeric replacements are only $1 .. $9 (makes parsing a little easier,
|
||||
* and it's not that much of a limitation anyway.) Also valid is "$*", which
|
||||
* stands for the entire original line after the alias. ";" is used to delimit
|
||||
* and it's not that much of a limitation anyway.) Also valid is "$*", which
|
||||
* stands for the entire original line after the alias. ";" is used to delimit
|
||||
* commands. */
|
||||
#define NUM_TOKENS 9
|
||||
|
||||
|
@ -730,8 +730,8 @@ int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen)
|
|||
/* Various other parsing utilities. */
|
||||
|
||||
/* Searches an array of strings for a target string. "exact" can be 0 or non-0,
|
||||
* depending on whether or not the match must be exact for it to be returned.
|
||||
* Returns -1 if not found; 0..n otherwise. Array must be terminated with a
|
||||
* depending on whether or not the match must be exact for it to be returned.
|
||||
* Returns -1 if not found; 0..n otherwise. Array must be terminated with a
|
||||
* '\n' so it knows to stop searching. */
|
||||
int search_block(char *arg, const char **list, int exact)
|
||||
{
|
||||
|
@ -784,13 +784,13 @@ void skip_spaces(char **string)
|
|||
for (; **string && isspace(**string); (*string)++);
|
||||
}
|
||||
|
||||
/* Given a string, change all instances of double dollar signs ($$) to single
|
||||
* dollar signs ($). When strings come in, all $'s are changed to $$'s to
|
||||
* avoid having users be able to crash the system if the inputted string is
|
||||
* eventually sent to act(). If you are using user input to produce screen
|
||||
* output AND YOU ARE SURE IT WILL NOT BE SENT THROUGH THE act() FUNCTION
|
||||
* (i.e., do_gecho, do_title, but NOT do_say), you can call
|
||||
* delete_doubledollar() to make the output look correct.
|
||||
/* Given a string, change all instances of double dollar signs ($$) to single
|
||||
* dollar signs ($). When strings come in, all $'s are changed to $$'s to
|
||||
* avoid having users be able to crash the system if the inputted string is
|
||||
* eventually sent to act(). If you are using user input to produce screen
|
||||
* output AND YOU ARE SURE IT WILL NOT BE SENT THROUGH THE act() FUNCTION
|
||||
* (i.e., do_gecho, do_title, but NOT do_say), you can call
|
||||
* delete_doubledollar() to make the output look correct.
|
||||
* Modifies the string in-place. */
|
||||
char *delete_doubledollar(char *string)
|
||||
{
|
||||
|
@ -851,7 +851,7 @@ char *one_argument(char *argument, char *first_arg)
|
|||
return (argument);
|
||||
}
|
||||
|
||||
/* one_word is like any_one_arg, except that words in quotes ("") are
|
||||
/* one_word is like any_one_arg, except that words in quotes ("") are
|
||||
* considered one word. No longer ignores fill words. -dak */
|
||||
char *one_word(char *argument, char *first_arg)
|
||||
{
|
||||
|
@ -1049,11 +1049,11 @@ static int perform_dupe_check(struct descriptor_data *d)
|
|||
}
|
||||
}
|
||||
|
||||
/* Now, go through the character list, deleting all characters that are not
|
||||
* already marked for deletion from the above step (i.e., in the CON_HANGUP
|
||||
/* Now, go through the character list, deleting all characters that are not
|
||||
* already marked for deletion from the above step (i.e., in the CON_HANGUP
|
||||
* state), and have not already been selected as a target for switching into.
|
||||
* In addition, if we haven't already found a target, choose one if one is
|
||||
* available (while still deleting the other duplicates, though theoretically
|
||||
* In addition, if we haven't already found a target, choose one if one is
|
||||
* available (while still deleting the other duplicates, though theoretically
|
||||
* none should be able to exist). */
|
||||
for (ch = character_list; ch; ch = next_ch) {
|
||||
next_ch = ch->next;
|
||||
|
@ -1088,9 +1088,9 @@ static int perform_dupe_check(struct descriptor_data *d)
|
|||
|
||||
/* no target for switching into was found - allow login to continue */
|
||||
if (!target) {
|
||||
GET_PREF(d->character) = rand_number(1, 128000);
|
||||
if (GET_HOST(d->character))
|
||||
free(GET_HOST(d->character));
|
||||
GET_PREF(d->character) = rand_number(1, 128000);
|
||||
if (GET_HOST(d->character))
|
||||
free(GET_HOST(d->character));
|
||||
GET_HOST(d->character) = strdup(d->host);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1169,8 +1169,8 @@ int enter_player_game (struct descriptor_data *d)
|
|||
/* find_char helper */
|
||||
add_to_lookup_table(GET_ID(d->character), (void *)d->character);
|
||||
|
||||
/* After moving saving of variables to the player file, this should only
|
||||
* be called in case nothing was found in the pfile. If something was
|
||||
/* After moving saving of variables to the player file, this should only
|
||||
* be called in case nothing was found in the pfile. If something was
|
||||
* found, SCRIPT(ch) will be set. */
|
||||
if (!SCRIPT(d->character))
|
||||
read_saved_vars(d->character);
|
||||
|
@ -1181,6 +1181,9 @@ int enter_player_game (struct descriptor_data *d)
|
|||
load_result = Crash_load(d->character);
|
||||
save_char(d->character);
|
||||
|
||||
/* Check for a login trigger in the players' start room */
|
||||
login_wtrigger(&world[IN_ROOM(d->character)], d->character);
|
||||
|
||||
return load_result;
|
||||
}
|
||||
|
||||
|
@ -1242,7 +1245,7 @@ void nanny(struct descriptor_data *d, char *arg)
|
|||
GET_PFILEPOS(d->character) = player_i;
|
||||
|
||||
if (PLR_FLAGGED(d->character, PLR_DELETED)) {
|
||||
/* Make sure old files are removed so the new player doesn't get the
|
||||
/* Make sure old files are removed so the new player doesn't get the
|
||||
* deleted player's equipment. */
|
||||
if ((player_i = get_ptable_by_name(tmp_name)) >= 0)
|
||||
remove_player(player_i);
|
||||
|
@ -1324,12 +1327,12 @@ void nanny(struct descriptor_data *d, char *arg)
|
|||
break;
|
||||
|
||||
case CON_PASSWORD: /* get pwd for known player */
|
||||
/* To really prevent duping correctly, the player's record should be reloaded
|
||||
* from disk at this point (after the password has been typed). However I'm
|
||||
* afraid that trying to load a character over an already loaded character is
|
||||
* going to cause some problem down the road that I can't see at the moment.
|
||||
* So to compensate, I'm going to (1) add a 15 or 20-second time limit for
|
||||
* entering a password, and (2) re-add the code to cut off duplicates when a
|
||||
/* To really prevent duping correctly, the player's record should be reloaded
|
||||
* from disk at this point (after the password has been typed). However I'm
|
||||
* afraid that trying to load a character over an already loaded character is
|
||||
* going to cause some problem down the road that I can't see at the moment.
|
||||
* So to compensate, I'm going to (1) add a 15 or 20-second time limit for
|
||||
* entering a password, and (2) re-add the code to cut off duplicates when a
|
||||
* player quits. JE 6 Feb 96 */
|
||||
|
||||
echo_on(d); /* turn echo back on */
|
||||
|
@ -1534,7 +1537,7 @@ void nanny(struct descriptor_data *d, char *arg)
|
|||
case '2':
|
||||
if (d->character->player.description) {
|
||||
write_to_output(d, "Current description:\r\n%s", d->character->player.description);
|
||||
/* Don't free this now... so that the old description gets loaded as the
|
||||
/* Don't free this now... so that the old description gets loaded as the
|
||||
* current buffer in the editor. Do setup the ABORT buffer here, however. */
|
||||
d->backstr = strdup(d->character->player.description);
|
||||
}
|
||||
|
@ -1605,7 +1608,7 @@ void nanny(struct descriptor_data *d, char *arg)
|
|||
SET_BIT_AR(PLR_FLAGS(d->character), PLR_DELETED);
|
||||
save_char(d->character);
|
||||
Crash_delete_file(GET_NAME(d->character));
|
||||
/* If the selfdelete_fastwipe flag is set (in config.c), remove all the
|
||||
/* If the selfdelete_fastwipe flag is set (in config.c), remove all the
|
||||
* player's immediately. */
|
||||
if (selfdelete_fastwipe)
|
||||
if ((player_i = get_ptable_by_name(GET_NAME(d->character))) >= 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue