2006-12-19 22:56:18 +00:00
|
|
|
/**************************************************************************
|
2007-04-08 10:36:36 +00:00
|
|
|
* File: dg_variables.c Part of tbaMUD *
|
|
|
|
|
* Usage: Contains the functions dealing with variable substitution. *
|
2006-12-19 22:56:18 +00:00
|
|
|
* *
|
|
|
|
|
* $Author: Mark A. Heilpern/egreen/Welcor $ *
|
2007-01-23 03:07:23 +00:00
|
|
|
* $Date: 2004/10/11 12:07:00 $ *
|
2006-12-19 22:56:18 +00:00
|
|
|
* $Revision: 1.0.14 $ *
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "conf.h"
|
|
|
|
|
#include "sysdep.h"
|
|
|
|
|
#include "structs.h"
|
|
|
|
|
#include "dg_scripts.h"
|
|
|
|
|
#include "utils.h"
|
|
|
|
|
#include "comm.h"
|
|
|
|
|
#include "interpreter.h"
|
|
|
|
|
#include "handler.h"
|
|
|
|
|
#include "dg_event.h"
|
|
|
|
|
#include "db.h"
|
2009-07-04 20:11:06 +00:00
|
|
|
#include "fight.h"
|
2006-12-19 22:56:18 +00:00
|
|
|
#include "screen.h"
|
|
|
|
|
#include "constants.h"
|
|
|
|
|
#include "spells.h"
|
2007-10-04 18:37:07 +00:00
|
|
|
#include "oasis.h"
|
jeremyosborne | 2008-04-04 02:36:38 +0200 (Fri, 04 Apr 2008) | 1 line
Minor Bugfix: All game configuration settings now reference the world config
structure, not the individual config variables found in config.c.
------------------------------------------------------------------------
rumble | 2008-03-22 13:27:00 +0100 (Sat, 22 Mar 2008) | 1 line
Added lib/world/qst/ directory, index, index.mini, and 0.qst.
------------------------------------------------------------------------
jeremyosborne | 2008-03-08 03:27:51 +0100 (Sat, 08 Mar 2008) | 3 lines
Bugfix: the include directory (for .h files) is now referenced correctly in the
depend statement.
Deletion: listrent.c removed as a separate utility.
------------------------------------------------------------------------
jeremyosborne | 2008-03-08 03:08:51 +0100 (Sat, 08 Mar 2008) | 1 line
Enhancement: utils/ Makefile will now use a depends file, and looks for dependen
cies in the ../ directory (shrinks the necessary information to make each utilit
y).
------------------------------------------------------------------------
Rumble | 2008-03-06 23:39:35 +0100 (Thu, 06 Mar 2008) | 1 line
Made TBA specific changes. do_cheat, removed help level checking, and advance to
level 32.
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 18:37:12 +0100 (Thu, 06 Mar 2008) | 1 line
Minor Update: Changed header of Makefile.in to read 'tbaMUD' and also added in a
ttribution for the changes. (Thanks seqwith.)
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 18:31:07 +0100 (Thu, 06 Mar 2008) | 4 lines
Changed Makefile.in to use glob expressions when building the objects. This
translates into no longer a need to update Makefile.in whenever a new .c file
is added to the mud code. Other Makefile.* have not yet been changed (and
need review, anyway).
All CXREF cruft left in Makefile.in has been removed. tbaMUD is now using
Doxygen. Technically, CXREF provides a bit more auto-documentation than Doxygen
does, however the tbaMUD (and legacy circle code) has never been marked-up with
the special CXREF codes required to effectively use the program. Since Doxygen
is easier to use, and provides almost as much functionality as CXREF, CXREF
support has been dropped.
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 08:31:02 +0100 (Thu, 06 Mar 2008) | 1 line
Bug Fix: asciiflag_conv* functions now can handle a negative numeric value.
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 08:16:06 +0100 (Thu, 06 Mar 2008) | 1 line
Bug fix/enhancement: Charmed mobs (specifically charmed mobs with a ->master)
will no longer attempt to wander off.
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 08:13:38 +0100 (Thu, 06 Mar 2008) | 6 lines
Based on the compiler warning about mag_materials being an unused function, and
the clone spell being unused.
Bug fix: Clone can now be cast. It is an 'ignore' target spell.
Fix and Modification: Clone, being an effectively unused spell that is only used
by mortal Magic Users at level 30, is now implemented as very simple example of
how to use mag_materials(). The item required by mag_materials is vnum 161,
which in stock tbaMUD is some sacrificial entrails.
------------------------------------------------------------------------
jeremyosborne | 2008-03-05 01:43:09 +0100 (Wed, 05 Mar 2008) | 3 lines
Bug Fix for "Did you mean:" including DG commands.
------------------------------------------------------------------------
jeremyosborne | 2008-03-05 01:29:18 +0100 (Wed, 05 Mar 2008) | 3 lines
Bug Fix: do_simple_move slightly rewritten to handle Leave triggers that purge a
door.
Documentation: do_simple_move documented.
------------------------------------------------------------------------
Laoris | 2008-03-01 08:22:12 +0100 (Sat, 01 Mar 2008) | 1 line
Trial run of columnizer function on commands list to see how people like it.
------------------------------------------------------------------------
jeremyosborne | 2008-02-26 22:36:17 +0100 (Tue, 26 Feb 2008) | 1 line
asciimap, an in game automap, along with a couple of minor bug fixes to do with
the automap, patched in (Thanks Jamdog).
------------------------------------------------------------------------
jeremyosborne | 2008-02-22 04:08:05 +0100 (Fri, 22 Feb 2008) | 1 line
Minor update: Relocate local variable declaration to the top of ACMD(do_help)
------------------------------------------------------------------------
jeremyosborne | 2008-02-22 04:04:37 +0100 (Fri, 22 Feb 2008) | 6 lines
Checked in the following placeholders for do_gen_tog:
#define SCMD_AUTOLOOT 24
#define SCMD_AUTOGOLD 25
#define SCMD_AUTOSPLIT 26
#define SCMD_AUTOSAC 27
#define SCMD_AUTOASSIST 28
------------------------------------------------------------------------
jeremyosborne | 2008-02-22 03:57:06 +0100 (Fri, 22 Feb 2008) | 1 line
The Autoquest patch, along with a couple of minor bug fixes, has been integrated
into tbaMUD. (Thanks Jamdog, Kenneth Ray and Morgaelin.)
------------------------------------------------------------------------
jeremyosborne | 2008-02-18 21:46:45 +0100 (Mon, 18 Feb 2008) | 2 lines
Minor Fix:
Casted NOWHERE, NOTHING, NOBODY and NOFLAG as IDXTYPE for the signed short int
index types.
------------------------------------------------------------------------
jeremyosborne | 2008-02-18 03:36:16 +0100 (Mon, 18 Feb 2008) | 7 lines
Added a new atoidx() conversion function for dealing with string to IDXTYPE
conversions (in utils.c, prototype exported through utils.h).
Added IDXTYPE_MIN and IDXTYPE_MAX defines (in structs.h).
Replaced atoi references with atoidx in do_oasis_zedit (in zedit.c).
------------------------------------------------------------------------
Rumble | 2008-02-18 01:44:13 +0100 (Mon, 18 Feb 2008) | 1 line
Fixed direction mapping to give readable directions instead of sub commands.
------------------------------------------------------------------------
jeremyosborne | 2008-02-18 00:26:15 +0100 (Mon, 18 Feb 2008) | 5 lines
Since general olc editing are automatically saved to disk, 'shutdown reboot' has
been changed to not-autosave by default. (Small change made to do_shutdown in
act.wizard.c).
------------------------------------------------------------------------
jeremyosborne | 2008-02-18 00:12:12 +0100 (Mon, 18 Feb 2008) | 3 lines
Changed:
struct attack_hit_type moved to fight.h
attack_hit_text exported through fight.h
------------------------------------------------------------------------
jeremyosborne | 2008-02-17 22:32:51 +0100 (Sun, 17 Feb 2008) | 7 lines
- do_file heads or tails files correctly and has also been enhanced to return
file info (act.wizard.c)
- defines made for common log files created by autorun, and those used by
do_file (db.h)
- utility functions added: file_head(), file_tail(), file_sizeof(), and
file_numlines() (defined utils.c and exported through utils.h)
------------------------------------------------------------------------
Rumble | 2008-02-16 23:24:05 +0100 (Sat, 16 Feb 2008) | 1 line
Fixed export command. (thanks Kyle)
------------------------------------------------------------------------
jeremyosborne | 2008-02-16 22:42:46 +0100 (Sat, 16 Feb 2008) | 1 line
Files are now tagged as executable. Should be able to be checked out from subver
sion and executed without running chmod.
------------------------------------------------------------------------
Rumble | 2008-02-15 17:03:06 +0100 (Fri, 15 Feb 2008) | 1 line
Fixed strcat() writing out of bounds in cedit.c since strdup() only malloc()
strlen(str)+1 bytes. (thanks Buggo) and moved attack_hit_text back.
------------------------------------------------------------------------
jeremyosborne | 2008-02-13 20:41:02 +0100 (Wed, 13 Feb 2008) | 1 line
Event queue function definitions, global variables and defines doxygenated.
------------------------------------------------------------------------
Rumble | 2008-02-12 00:23:38 +0100 (Tue, 12 Feb 2008) | 1 line
Updated levels command to use an arg/range and added color parsing to greetings.
(thanks Jamdog)
------------------------------------------------------------------------
jeremyosborne | 2008-02-11 21:06:10 +0100 (Mon, 11 Feb 2008) | 1 line
Doxygen comments completed for weather.c
------------------------------------------------------------------------
Rumble | 2008-02-11 03:52:50 +0100 (Mon, 11 Feb 2008) | 1 line
Corrected several 64-bit warnings. (thanks Buggo)
------------------------------------------------------------------------
Rumble | 2008-02-10 22:56:56 +0100 (Sun, 10 Feb 2008) | 1 line
Added get_flag_by_name allowing for new trigedit variable checks like
%actor.pref(FLAG)% checks. (thanks Jamdog)
------------------------------------------------------------------------
jeremyosborne | 2008-02-08 21:22:26 +0100 (Fri, 08 Feb 2008) | 3 lines
COMPLETE: tbaMUD code re-org of global and local scope function and variable
declarations. There may be a few things that I did not catch (some non extern
keyword declarations of function prototypes within other functions, for
example).
BUG FIX: Unused functions encrypt_hex() and decrypt_hex() removed from mail.c.
------------------------------------------------------------------------
jeremyosborne | 2008-02-05 23:31:09 +0100 (Tue, 05 Feb 2008) | 2 lines
Continued clean-up of 'extern' references to functions and variables.
BUG UNCOVERED: set_title() in class.c incorrectly handles the const nature of
the char * returned from title_female and title_male.
------------------------------------------------------------------------
jeremyosborne | 2008-02-05 19:38:17 +0100 (Tue, 05 Feb 2008) | 3 lines
More work on mud clean-up.
New file: spec_procs.h
Created this file to house the legacy special procedures (spec_procs.c and
castle.c) and special feature assignment in general.
------------------------------------------------------------------------
jeremyosborne | 2008-02-05 00:59:44 +0100 (Tue, 05 Feb 2008) | 3 lines
- Minor Bugfix: Fixed parse error in mobact.c
- Minor Bugfix: act.h is now included in all of the act functions. Forgot to do
that the first time :(
- Additions: ban.h has been added as the external entry point into the ban.c
globals and functions. Files needing ban.h have been updated.
------------------------------------------------------------------------
jeremyosborne | 2008-02-04 20:02:11 +0100 (Mon, 04 Feb 2008) | 1 line
All act*.c functions, defines and globals have been prototyped/declared in
act.h. The file act.h does not contain every ACMD, only those ACMDs and
utility functions available within the act*.c files.
------------------------------------------------------------------------
Rumble | 2008-02-04 17:59:47 +0100 (Mon, 04 Feb 2008) | 1 line
Fixed the last few flags missed for the 128 bit conversion.
------------------------------------------------------------------------
Laoris | 2008-02-04 07:27:56 +0100 (Mon, 04 Feb 2008) | 3 lines
Adding a column formatter for lists. Accepts printf-like arguments.
Only used by medit right now.
------------------------------------------------------------------------
jeremyosborne | 2008-02-04 07:09:19 +0100 (Mon, 04 Feb 2008) | 2 lines
- Changed the 'struct queue' to 'struct dg_queue' to avoid namespace conflicts.
- Ongoing cleanup to mud project.
------------------------------------------------------------------------
Rumble | 2008-02-04 00:07:09 +0100 (Mon, 04 Feb 2008) | 1 line
Fixed run_autowiz which ran twice on advancement.
------------------------------------------------------------------------
jeremyosborne | 2008-02-03 03:46:22 +0100 (Sun, 03 Feb 2008) | 1 line
act.h created and added. This header will be the external entry point for the
functions, function subcommands and variables within the act*.c files. It is
not designed to be the entry point for all ACMD functions.
------------------------------------------------------------------------
jeremyosborne | 2008-02-03 02:44:29 +0100 (Sun, 03 Feb 2008) | 1 line
Merge of another part of the code cleanup, the dg script stuff.
------------------------------------------------------------------------
jeremyosborne | 2008-02-02 08:56:03 +0100 (Sat, 02 Feb 2008) | 1 line
Modularizing and organizing files continues. Committing comm.c and comm.h
because they are hairy, and I don't want to do them over if my hard drive
crashes.
------------------------------------------------------------------------
jeremyosborne | 2008-02-02 07:05:08 +0100 (Sat, 02 Feb 2008) | 4 lines
- Marking all file scope functions as 'static'
- Reorganization of the global variables and functions.
------------------------------------------------------------------------
jeremyosborne | 2008-01-31 10:20:47 +0100 (Thu, 31 Jan 2008) | 1 line
* Protected the conf.h.* system config files from multiple calls.
------------------------------------------------------------------------
jeremyosborne | 2008-01-31 09:56:18 +0100 (Thu, 31 Jan 2008) | 1 line
* Removed extraneous references to TRUE / FALSE and YES / NO defines.
------------------------------------------------------------------------
jeremyosborne | 2008-01-31 09:46:20 +0100 (Thu, 31 Jan 2008) | 2 lines
* BUGFIX: NUM_POSITIONS set to 8 (was incorrectly set to 15 before)
* Migrated NUM_* settings from oasis.h to more appropriate locations near where
they are defined. (For Example: NUM_POSITIONS moved to structs.h next to the
POSITION_* defines.)
------------------------------------------------------------------------
jeremyosborne | 2008-01-31 03:58:28 +0100 (Thu, 31 Jan 2008) | 1 line
Added Appendix A - Coder Support. Right now, it simply speaks to the fact that
we have included doxygen config files, are working to document the source code,
and provides a rudimentary "do this" guide to create the doxygen cross
references.
------------------------------------------------------------------------
jeremyosborne | 2008-01-30 07:12:07 +0100 (Wed, 30 Jan 2008) | 2 lines
- All .h files now have doxygen recognized headers, and the format is slightly
altered to ease editing of headers.
- Protected all .h files from multiple calls. (Standard format is #ifndef _HEADE
R_H_ #define _HEADER_H_ .... #endif)
------------------------------------------------------------------------
jeremyosborne | 2008-01-29 11:18:14 +0100 (Tue, 29 Jan 2008) | 1 line
constants.h, structs.h and utils.h now protected from multiple includes. This is
sometimes overkill, but good practice overall.
------------------------------------------------------------------------
jeremyosborne | 2008-01-29 10:38:18 +0100 (Tue, 29 Jan 2008) | 1 line
Updated documentation for constants.c and constants.h.
------------------------------------------------------------------------
jeremyosborne | 2008-01-29 10:15:25 +0100 (Tue, 29 Jan 2008) | 3 lines
The standard Doxygen configuration doxyfiles (config files) for tbaMUD. One is
to be used with the Graphviz DOT (dox_withGraphs), one is designed to be used if
Graphviz is not available.
Now just need a short document describing the usage of doxygen.
------------------------------------------------------------------------
jeremyosborne | 2008-01-29 10:11:36 +0100 (Tue, 29 Jan 2008) | 1 line
Minor document correction in struct dex_app_tpe.
------------------------------------------------------------------------
jeremyosborne | 2008-01-28 20:53:51 +0100 (Mon, 28 Jan 2008) | 1 line
*bugfix* do_drink command: When a container is empty, the correct, "It is
empty." message is now displayed.
------------------------------------------------------------------------
jeremyosborne | 2008-01-28 07:58:15 +0100 (Mon, 28 Jan 2008) | 3 lines
Merging changes to trunk for:
* utils.h, utils.c and structs.h doxygen comments
* adding file dox_withGraphs.doxyfile
2008-04-12 01:31:58 +00:00
|
|
|
#include "class.h"
|
2008-12-28 22:08:11 +00:00
|
|
|
#include "quest.h"
|
2010-12-05 16:28:00 +00:00
|
|
|
#include "act.h"
|
2006-12-19 22:56:18 +00:00
|
|
|
|
|
|
|
|
/* Utility functions */
|
|
|
|
|
|
2010-11-06 15:47:38 +00:00
|
|
|
/* Thanks to James Long for his assistance in plugging the memory leak that
|
2007-04-08 10:36:36 +00:00
|
|
|
* used to be here. - Welcor */
|
|
|
|
|
/* Adds a variable with given name and value to trigger. */
|
2008-05-07 23:34:40 +00:00
|
|
|
void add_var(struct trig_var_data **var_list, const char *name, const char *value, long id)
|
2006-12-19 22:56:18 +00:00
|
|
|
{
|
|
|
|
|
struct trig_var_data *vd;
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
if (strchr(name, '.')) {
|
|
|
|
|
log("add_var() : Attempt to add illegal var: %s", name);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
for (vd = *var_list; vd && str_cmp(vd->name, name); vd = vd->next);
|
|
|
|
|
|
|
|
|
|
if (vd && (!vd->context || vd->context==id)) {
|
|
|
|
|
free(vd->value);
|
|
|
|
|
CREATE(vd->value, char, strlen(value) + 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
CREATE(vd, struct trig_var_data, 1);
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
CREATE(vd->name, char, strlen(name) + 1);
|
|
|
|
|
strcpy(vd->name, name); /* strcpy: ok*/
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
CREATE(vd->value, char, strlen(value) + 1);
|
|
|
|
|
|
|
|
|
|
vd->next = *var_list;
|
|
|
|
|
vd->context = id;
|
|
|
|
|
*var_list = vd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
strcpy(vd->value, value); /* strcpy: ok*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* perhaps not the best place for this, but I didn't want a new file */
|
|
|
|
|
char *skill_percent(struct char_data *ch, char *skill)
|
|
|
|
|
{
|
|
|
|
|
static char retval[16];
|
|
|
|
|
int skillnum;
|
|
|
|
|
|
|
|
|
|
skillnum = find_skill_num(skill);
|
|
|
|
|
if (skillnum<=0) return("unknown skill");
|
|
|
|
|
|
|
|
|
|
snprintf(retval, sizeof(retval), "%d", GET_SKILL(ch, skillnum));
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-06 15:47:38 +00:00
|
|
|
/* Search through all the persons items, including containers. 0 if it doesnt
|
|
|
|
|
* exist, and greater then 0 if it does! Jamie Nelson. Now also searches by
|
2007-04-08 10:36:36 +00:00
|
|
|
* vnum and returns the number of matching objects. - Welcor */
|
2007-01-23 03:07:23 +00:00
|
|
|
int item_in_list(char *item, obj_data *list)
|
2006-12-19 22:56:18 +00:00
|
|
|
{
|
|
|
|
|
obj_data *i;
|
2007-01-23 03:07:23 +00:00
|
|
|
int count = 0;
|
2006-12-19 22:56:18 +00:00
|
|
|
|
|
|
|
|
if (!item || !*item)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (*item == UID_CHAR) {
|
|
|
|
|
long id = atol(item + 1);
|
|
|
|
|
|
|
|
|
|
for (i = list; i; i = i->next_content) {
|
2007-01-23 03:07:23 +00:00
|
|
|
if (id == GET_ID(i))
|
2006-12-19 22:56:18 +00:00
|
|
|
count ++;
|
2007-01-23 03:07:23 +00:00
|
|
|
if (GET_OBJ_TYPE(i) == ITEM_CONTAINER)
|
2006-12-19 22:56:18 +00:00
|
|
|
count += item_in_list(item, i->contains);
|
|
|
|
|
}
|
|
|
|
|
} else if (is_number(item)) { /* check for vnum */
|
|
|
|
|
obj_vnum ovnum = atoi(item);
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
for (i = list; i; i = i->next_content) {
|
2007-01-23 03:07:23 +00:00
|
|
|
if (GET_OBJ_VNUM(i) == ovnum)
|
2006-12-19 22:56:18 +00:00
|
|
|
count++;
|
2007-01-23 03:07:23 +00:00
|
|
|
if (GET_OBJ_TYPE(i) == ITEM_CONTAINER)
|
2006-12-19 22:56:18 +00:00
|
|
|
count += item_in_list(item, i->contains);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
for (i = list; i; i = i->next_content) {
|
2007-01-23 03:07:23 +00:00
|
|
|
if (isname(item, i->name))
|
2006-12-19 22:56:18 +00:00
|
|
|
count++;
|
2007-01-23 03:07:23 +00:00
|
|
|
if (GET_OBJ_TYPE(i) == ITEM_CONTAINER)
|
2006-12-19 22:56:18 +00:00
|
|
|
count += item_in_list(item, i->contains);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-06 15:47:38 +00:00
|
|
|
/* BOOLEAN return, just check if a player or mob has an item of any sort,
|
|
|
|
|
* searched for by name or id. Searching equipment as well as inventory, and
|
2007-04-08 10:36:36 +00:00
|
|
|
* containers. Jamie Nelson */
|
2006-12-19 22:56:18 +00:00
|
|
|
int char_has_item(char *item, struct char_data *ch)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/* If this works, no more searching needed */
|
2007-01-23 03:07:23 +00:00
|
|
|
if (get_object_in_equip(ch, item) != NULL)
|
|
|
|
|
return 1;
|
2006-12-19 22:56:18 +00:00
|
|
|
|
|
|
|
|
if (item_in_list(item, ch->carrying) == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int text_processed(char *field, char *subfield, struct trig_var_data *vd,
|
|
|
|
|
char *str, size_t slen)
|
|
|
|
|
{
|
|
|
|
|
char *p, *p2;
|
|
|
|
|
char tmpvar[MAX_STRING_LENGTH];
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
if (!str_cmp(field, "strlen")) { /* strlen */
|
jeremyosborne | 2008-04-04 02:36:38 +0200 (Fri, 04 Apr 2008) | 1 line
Minor Bugfix: All game configuration settings now reference the world config
structure, not the individual config variables found in config.c.
------------------------------------------------------------------------
rumble | 2008-03-22 13:27:00 +0100 (Sat, 22 Mar 2008) | 1 line
Added lib/world/qst/ directory, index, index.mini, and 0.qst.
------------------------------------------------------------------------
jeremyosborne | 2008-03-08 03:27:51 +0100 (Sat, 08 Mar 2008) | 3 lines
Bugfix: the include directory (for .h files) is now referenced correctly in the
depend statement.
Deletion: listrent.c removed as a separate utility.
------------------------------------------------------------------------
jeremyosborne | 2008-03-08 03:08:51 +0100 (Sat, 08 Mar 2008) | 1 line
Enhancement: utils/ Makefile will now use a depends file, and looks for dependen
cies in the ../ directory (shrinks the necessary information to make each utilit
y).
------------------------------------------------------------------------
Rumble | 2008-03-06 23:39:35 +0100 (Thu, 06 Mar 2008) | 1 line
Made TBA specific changes. do_cheat, removed help level checking, and advance to
level 32.
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 18:37:12 +0100 (Thu, 06 Mar 2008) | 1 line
Minor Update: Changed header of Makefile.in to read 'tbaMUD' and also added in a
ttribution for the changes. (Thanks seqwith.)
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 18:31:07 +0100 (Thu, 06 Mar 2008) | 4 lines
Changed Makefile.in to use glob expressions when building the objects. This
translates into no longer a need to update Makefile.in whenever a new .c file
is added to the mud code. Other Makefile.* have not yet been changed (and
need review, anyway).
All CXREF cruft left in Makefile.in has been removed. tbaMUD is now using
Doxygen. Technically, CXREF provides a bit more auto-documentation than Doxygen
does, however the tbaMUD (and legacy circle code) has never been marked-up with
the special CXREF codes required to effectively use the program. Since Doxygen
is easier to use, and provides almost as much functionality as CXREF, CXREF
support has been dropped.
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 08:31:02 +0100 (Thu, 06 Mar 2008) | 1 line
Bug Fix: asciiflag_conv* functions now can handle a negative numeric value.
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 08:16:06 +0100 (Thu, 06 Mar 2008) | 1 line
Bug fix/enhancement: Charmed mobs (specifically charmed mobs with a ->master)
will no longer attempt to wander off.
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 08:13:38 +0100 (Thu, 06 Mar 2008) | 6 lines
Based on the compiler warning about mag_materials being an unused function, and
the clone spell being unused.
Bug fix: Clone can now be cast. It is an 'ignore' target spell.
Fix and Modification: Clone, being an effectively unused spell that is only used
by mortal Magic Users at level 30, is now implemented as very simple example of
how to use mag_materials(). The item required by mag_materials is vnum 161,
which in stock tbaMUD is some sacrificial entrails.
------------------------------------------------------------------------
jeremyosborne | 2008-03-05 01:43:09 +0100 (Wed, 05 Mar 2008) | 3 lines
Bug Fix for "Did you mean:" including DG commands.
------------------------------------------------------------------------
jeremyosborne | 2008-03-05 01:29:18 +0100 (Wed, 05 Mar 2008) | 3 lines
Bug Fix: do_simple_move slightly rewritten to handle Leave triggers that purge a
door.
Documentation: do_simple_move documented.
------------------------------------------------------------------------
Laoris | 2008-03-01 08:22:12 +0100 (Sat, 01 Mar 2008) | 1 line
Trial run of columnizer function on commands list to see how people like it.
------------------------------------------------------------------------
jeremyosborne | 2008-02-26 22:36:17 +0100 (Tue, 26 Feb 2008) | 1 line
asciimap, an in game automap, along with a couple of minor bug fixes to do with
the automap, patched in (Thanks Jamdog).
------------------------------------------------------------------------
jeremyosborne | 2008-02-22 04:08:05 +0100 (Fri, 22 Feb 2008) | 1 line
Minor update: Relocate local variable declaration to the top of ACMD(do_help)
------------------------------------------------------------------------
jeremyosborne | 2008-02-22 04:04:37 +0100 (Fri, 22 Feb 2008) | 6 lines
Checked in the following placeholders for do_gen_tog:
#define SCMD_AUTOLOOT 24
#define SCMD_AUTOGOLD 25
#define SCMD_AUTOSPLIT 26
#define SCMD_AUTOSAC 27
#define SCMD_AUTOASSIST 28
------------------------------------------------------------------------
jeremyosborne | 2008-02-22 03:57:06 +0100 (Fri, 22 Feb 2008) | 1 line
The Autoquest patch, along with a couple of minor bug fixes, has been integrated
into tbaMUD. (Thanks Jamdog, Kenneth Ray and Morgaelin.)
------------------------------------------------------------------------
jeremyosborne | 2008-02-18 21:46:45 +0100 (Mon, 18 Feb 2008) | 2 lines
Minor Fix:
Casted NOWHERE, NOTHING, NOBODY and NOFLAG as IDXTYPE for the signed short int
index types.
------------------------------------------------------------------------
jeremyosborne | 2008-02-18 03:36:16 +0100 (Mon, 18 Feb 2008) | 7 lines
Added a new atoidx() conversion function for dealing with string to IDXTYPE
conversions (in utils.c, prototype exported through utils.h).
Added IDXTYPE_MIN and IDXTYPE_MAX defines (in structs.h).
Replaced atoi references with atoidx in do_oasis_zedit (in zedit.c).
------------------------------------------------------------------------
Rumble | 2008-02-18 01:44:13 +0100 (Mon, 18 Feb 2008) | 1 line
Fixed direction mapping to give readable directions instead of sub commands.
------------------------------------------------------------------------
jeremyosborne | 2008-02-18 00:26:15 +0100 (Mon, 18 Feb 2008) | 5 lines
Since general olc editing are automatically saved to disk, 'shutdown reboot' has
been changed to not-autosave by default. (Small change made to do_shutdown in
act.wizard.c).
------------------------------------------------------------------------
jeremyosborne | 2008-02-18 00:12:12 +0100 (Mon, 18 Feb 2008) | 3 lines
Changed:
struct attack_hit_type moved to fight.h
attack_hit_text exported through fight.h
------------------------------------------------------------------------
jeremyosborne | 2008-02-17 22:32:51 +0100 (Sun, 17 Feb 2008) | 7 lines
- do_file heads or tails files correctly and has also been enhanced to return
file info (act.wizard.c)
- defines made for common log files created by autorun, and those used by
do_file (db.h)
- utility functions added: file_head(), file_tail(), file_sizeof(), and
file_numlines() (defined utils.c and exported through utils.h)
------------------------------------------------------------------------
Rumble | 2008-02-16 23:24:05 +0100 (Sat, 16 Feb 2008) | 1 line
Fixed export command. (thanks Kyle)
------------------------------------------------------------------------
jeremyosborne | 2008-02-16 22:42:46 +0100 (Sat, 16 Feb 2008) | 1 line
Files are now tagged as executable. Should be able to be checked out from subver
sion and executed without running chmod.
------------------------------------------------------------------------
Rumble | 2008-02-15 17:03:06 +0100 (Fri, 15 Feb 2008) | 1 line
Fixed strcat() writing out of bounds in cedit.c since strdup() only malloc()
strlen(str)+1 bytes. (thanks Buggo) and moved attack_hit_text back.
------------------------------------------------------------------------
jeremyosborne | 2008-02-13 20:41:02 +0100 (Wed, 13 Feb 2008) | 1 line
Event queue function definitions, global variables and defines doxygenated.
------------------------------------------------------------------------
Rumble | 2008-02-12 00:23:38 +0100 (Tue, 12 Feb 2008) | 1 line
Updated levels command to use an arg/range and added color parsing to greetings.
(thanks Jamdog)
------------------------------------------------------------------------
jeremyosborne | 2008-02-11 21:06:10 +0100 (Mon, 11 Feb 2008) | 1 line
Doxygen comments completed for weather.c
------------------------------------------------------------------------
Rumble | 2008-02-11 03:52:50 +0100 (Mon, 11 Feb 2008) | 1 line
Corrected several 64-bit warnings. (thanks Buggo)
------------------------------------------------------------------------
Rumble | 2008-02-10 22:56:56 +0100 (Sun, 10 Feb 2008) | 1 line
Added get_flag_by_name allowing for new trigedit variable checks like
%actor.pref(FLAG)% checks. (thanks Jamdog)
------------------------------------------------------------------------
jeremyosborne | 2008-02-08 21:22:26 +0100 (Fri, 08 Feb 2008) | 3 lines
COMPLETE: tbaMUD code re-org of global and local scope function and variable
declarations. There may be a few things that I did not catch (some non extern
keyword declarations of function prototypes within other functions, for
example).
BUG FIX: Unused functions encrypt_hex() and decrypt_hex() removed from mail.c.
------------------------------------------------------------------------
jeremyosborne | 2008-02-05 23:31:09 +0100 (Tue, 05 Feb 2008) | 2 lines
Continued clean-up of 'extern' references to functions and variables.
BUG UNCOVERED: set_title() in class.c incorrectly handles the const nature of
the char * returned from title_female and title_male.
------------------------------------------------------------------------
jeremyosborne | 2008-02-05 19:38:17 +0100 (Tue, 05 Feb 2008) | 3 lines
More work on mud clean-up.
New file: spec_procs.h
Created this file to house the legacy special procedures (spec_procs.c and
castle.c) and special feature assignment in general.
------------------------------------------------------------------------
jeremyosborne | 2008-02-05 00:59:44 +0100 (Tue, 05 Feb 2008) | 3 lines
- Minor Bugfix: Fixed parse error in mobact.c
- Minor Bugfix: act.h is now included in all of the act functions. Forgot to do
that the first time :(
- Additions: ban.h has been added as the external entry point into the ban.c
globals and functions. Files needing ban.h have been updated.
------------------------------------------------------------------------
jeremyosborne | 2008-02-04 20:02:11 +0100 (Mon, 04 Feb 2008) | 1 line
All act*.c functions, defines and globals have been prototyped/declared in
act.h. The file act.h does not contain every ACMD, only those ACMDs and
utility functions available within the act*.c files.
------------------------------------------------------------------------
Rumble | 2008-02-04 17:59:47 +0100 (Mon, 04 Feb 2008) | 1 line
Fixed the last few flags missed for the 128 bit conversion.
------------------------------------------------------------------------
Laoris | 2008-02-04 07:27:56 +0100 (Mon, 04 Feb 2008) | 3 lines
Adding a column formatter for lists. Accepts printf-like arguments.
Only used by medit right now.
------------------------------------------------------------------------
jeremyosborne | 2008-02-04 07:09:19 +0100 (Mon, 04 Feb 2008) | 2 lines
- Changed the 'struct queue' to 'struct dg_queue' to avoid namespace conflicts.
- Ongoing cleanup to mud project.
------------------------------------------------------------------------
Rumble | 2008-02-04 00:07:09 +0100 (Mon, 04 Feb 2008) | 1 line
Fixed run_autowiz which ran twice on advancement.
------------------------------------------------------------------------
jeremyosborne | 2008-02-03 03:46:22 +0100 (Sun, 03 Feb 2008) | 1 line
act.h created and added. This header will be the external entry point for the
functions, function subcommands and variables within the act*.c files. It is
not designed to be the entry point for all ACMD functions.
------------------------------------------------------------------------
jeremyosborne | 2008-02-03 02:44:29 +0100 (Sun, 03 Feb 2008) | 1 line
Merge of another part of the code cleanup, the dg script stuff.
------------------------------------------------------------------------
jeremyosborne | 2008-02-02 08:56:03 +0100 (Sat, 02 Feb 2008) | 1 line
Modularizing and organizing files continues. Committing comm.c and comm.h
because they are hairy, and I don't want to do them over if my hard drive
crashes.
------------------------------------------------------------------------
jeremyosborne | 2008-02-02 07:05:08 +0100 (Sat, 02 Feb 2008) | 4 lines
- Marking all file scope functions as 'static'
- Reorganization of the global variables and functions.
------------------------------------------------------------------------
jeremyosborne | 2008-01-31 10:20:47 +0100 (Thu, 31 Jan 2008) | 1 line
* Protected the conf.h.* system config files from multiple calls.
------------------------------------------------------------------------
jeremyosborne | 2008-01-31 09:56:18 +0100 (Thu, 31 Jan 2008) | 1 line
* Removed extraneous references to TRUE / FALSE and YES / NO defines.
------------------------------------------------------------------------
jeremyosborne | 2008-01-31 09:46:20 +0100 (Thu, 31 Jan 2008) | 2 lines
* BUGFIX: NUM_POSITIONS set to 8 (was incorrectly set to 15 before)
* Migrated NUM_* settings from oasis.h to more appropriate locations near where
they are defined. (For Example: NUM_POSITIONS moved to structs.h next to the
POSITION_* defines.)
------------------------------------------------------------------------
jeremyosborne | 2008-01-31 03:58:28 +0100 (Thu, 31 Jan 2008) | 1 line
Added Appendix A - Coder Support. Right now, it simply speaks to the fact that
we have included doxygen config files, are working to document the source code,
and provides a rudimentary "do this" guide to create the doxygen cross
references.
------------------------------------------------------------------------
jeremyosborne | 2008-01-30 07:12:07 +0100 (Wed, 30 Jan 2008) | 2 lines
- All .h files now have doxygen recognized headers, and the format is slightly
altered to ease editing of headers.
- Protected all .h files from multiple calls. (Standard format is #ifndef _HEADE
R_H_ #define _HEADER_H_ .... #endif)
------------------------------------------------------------------------
jeremyosborne | 2008-01-29 11:18:14 +0100 (Tue, 29 Jan 2008) | 1 line
constants.h, structs.h and utils.h now protected from multiple includes. This is
sometimes overkill, but good practice overall.
------------------------------------------------------------------------
jeremyosborne | 2008-01-29 10:38:18 +0100 (Tue, 29 Jan 2008) | 1 line
Updated documentation for constants.c and constants.h.
------------------------------------------------------------------------
jeremyosborne | 2008-01-29 10:15:25 +0100 (Tue, 29 Jan 2008) | 3 lines
The standard Doxygen configuration doxyfiles (config files) for tbaMUD. One is
to be used with the Graphviz DOT (dox_withGraphs), one is designed to be used if
Graphviz is not available.
Now just need a short document describing the usage of doxygen.
------------------------------------------------------------------------
jeremyosborne | 2008-01-29 10:11:36 +0100 (Tue, 29 Jan 2008) | 1 line
Minor document correction in struct dex_app_tpe.
------------------------------------------------------------------------
jeremyosborne | 2008-01-28 20:53:51 +0100 (Mon, 28 Jan 2008) | 1 line
*bugfix* do_drink command: When a container is empty, the correct, "It is
empty." message is now displayed.
------------------------------------------------------------------------
jeremyosborne | 2008-01-28 07:58:15 +0100 (Mon, 28 Jan 2008) | 3 lines
Merging changes to trunk for:
* utils.h, utils.c and structs.h doxygen comments
* adding file dox_withGraphs.doxyfile
2008-04-12 01:31:58 +00:00
|
|
|
snprintf(str, slen, "%d", (int)strlen(vd->value));
|
2006-12-19 22:56:18 +00:00
|
|
|
return TRUE;
|
|
|
|
|
} else if (!str_cmp(field, "trim")) { /* trim */
|
|
|
|
|
/* trim whitespace from ends */
|
|
|
|
|
snprintf(tmpvar, sizeof(tmpvar)-1 , "%s", vd->value); /* -1 to use later*/
|
2007-01-23 03:07:23 +00:00
|
|
|
p = tmpvar;
|
|
|
|
|
p2 = tmpvar + strlen(tmpvar) - 1;
|
|
|
|
|
while (*p && isspace(*p)) p++;
|
|
|
|
|
while ((p<=p2) && isspace(*p2)) p2--;
|
2006-12-19 22:56:18 +00:00
|
|
|
if (p>p2) { /* nothing left */
|
|
|
|
|
*str = '\0';
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
*(++p2) = '\0'; /* +1 ok (see above) */
|
|
|
|
|
snprintf(str, slen, "%s", p);
|
|
|
|
|
return TRUE;
|
|
|
|
|
} else if (!str_cmp(field, "contains")) { /* contains */
|
|
|
|
|
if (str_str(vd->value, subfield))
|
|
|
|
|
strcpy(str, "1");
|
2007-01-23 03:07:23 +00:00
|
|
|
else
|
2006-12-19 22:56:18 +00:00
|
|
|
strcpy(str, "0");
|
|
|
|
|
return TRUE;
|
|
|
|
|
} else if (!str_cmp(field, "car")) { /* car */
|
|
|
|
|
char *car = vd->value;
|
|
|
|
|
while (*car && !isspace(*car))
|
|
|
|
|
*str++ = *car++;
|
|
|
|
|
*str = '\0';
|
|
|
|
|
return TRUE;
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
} else if (!str_cmp(field, "cdr")) { /* cdr */
|
|
|
|
|
char *cdr = vd->value;
|
|
|
|
|
while (*cdr && !isspace(*cdr)) cdr++; /* skip 1st field */
|
|
|
|
|
while (*cdr && isspace(*cdr)) cdr++; /* skip to next */
|
|
|
|
|
|
|
|
|
|
snprintf(str, slen, "%s", cdr);
|
|
|
|
|
return TRUE;
|
|
|
|
|
} else if (!str_cmp(field, "charat")) { /* CharAt */
|
2008-05-07 23:34:40 +00:00
|
|
|
size_t len = strlen(vd->value), cindex = atoi(subfield);
|
|
|
|
|
if (cindex > len || cindex < 1)
|
2006-12-19 22:56:18 +00:00
|
|
|
strcpy(str, "");
|
|
|
|
|
else
|
2008-05-07 23:34:40 +00:00
|
|
|
snprintf(str, slen, "%c", vd->value[cindex - 1]);
|
2006-12-19 22:56:18 +00:00
|
|
|
return TRUE;
|
|
|
|
|
} else if (!str_cmp(field, "mudcommand")) {
|
|
|
|
|
/* find the mud command returned from this text */
|
|
|
|
|
/* NOTE: you may need to replace "cmd_info" with "complete_cmd_info", */
|
|
|
|
|
/* depending on what patches you've got applied. */
|
|
|
|
|
/* on older source bases: extern struct command_info *cmd_info; */
|
|
|
|
|
int length, cmd;
|
|
|
|
|
for (length = strlen(vd->value), cmd = 0;
|
|
|
|
|
*cmd_info[cmd].command != '\n'; cmd++)
|
|
|
|
|
if (!strncmp(cmd_info[cmd].command, vd->value, length))
|
|
|
|
|
break;
|
|
|
|
|
|
2007-01-23 03:07:23 +00:00
|
|
|
if (*cmd_info[cmd].command == '\n')
|
2006-12-19 22:56:18 +00:00
|
|
|
*str = '\0';
|
2007-01-23 03:07:23 +00:00
|
|
|
else
|
2006-12-19 22:56:18 +00:00
|
|
|
snprintf(str, slen, "%s", cmd_info[cmd].command);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* sets str to be the value of var.field */
|
|
|
|
|
void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
|
|
|
|
int type, char *var, char *field, char *subfield, char *str, size_t slen)
|
|
|
|
|
{
|
|
|
|
|
struct trig_var_data *vd=NULL;
|
|
|
|
|
char_data *ch, *c = NULL, *rndm;
|
|
|
|
|
obj_data *obj, *o = NULL;
|
|
|
|
|
struct room_data *room, *r = NULL;
|
|
|
|
|
char *name;
|
|
|
|
|
int num, count, i, j, doors;
|
|
|
|
|
|
|
|
|
|
char *send_cmd[] = {"msend ", "osend ", "wsend " };
|
|
|
|
|
char *echo_cmd[] = {"mecho ", "oecho ", "wecho " };
|
|
|
|
|
char *echoaround_cmd[] = {"mechoaround ", "oechoaround ", "wechoaround "};
|
|
|
|
|
char *door[] = {"mdoor ", "odoor ", "wdoor " };
|
|
|
|
|
char *force[] = {"mforce ", "oforce ", "wforce " };
|
|
|
|
|
char *load[] = {"mload ", "oload ", "wload " };
|
|
|
|
|
char *purge[] = {"mpurge ", "opurge ", "wpurge " };
|
|
|
|
|
char *teleport[] = {"mteleport ", "oteleport ", "wteleport " };
|
|
|
|
|
/* the x kills a 'shadow' warning in gcc. */
|
|
|
|
|
char *xdamage[] = {"mdamage ", "odamage ", "wdamage " };
|
|
|
|
|
char *zoneecho[] = {"mzoneecho ", "ozoneecho ", "wzoneecho " };
|
|
|
|
|
char *asound[] = {"masound ", "oasound ", "wasound " };
|
|
|
|
|
char *at[] = {"mat ", "oat ", "wat " };
|
|
|
|
|
/* there is no such thing as wtransform, thus the wecho below */
|
|
|
|
|
char *transform[] = {"mtransform ", "otransform ", "wecho " };
|
|
|
|
|
char *recho[] = {"mrecho ", "orecho ", "wrecho " };
|
2009-01-21 22:41:00 +00:00
|
|
|
/* there is no such thing as mmove, thus the mecho below */
|
|
|
|
|
char *omove[] = {"mecho ", "omove ", "wmove " };
|
2010-12-06 18:40:28 +00:00
|
|
|
char *mail[] = {"mmail ", "oecho ", "wecho " };
|
2006-12-19 22:56:18 +00:00
|
|
|
|
|
|
|
|
*str = '\0';
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
/* X.global() will have a NULL trig */
|
|
|
|
|
if (trig)
|
|
|
|
|
for (vd = GET_TRIG_VARS(trig); vd; vd = vd->next)
|
|
|
|
|
if (!str_cmp(vd->name, var))
|
|
|
|
|
break;
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
/* some evil waitstates could crash the mud if sent here with sc==NULL*/
|
2007-01-23 03:07:23 +00:00
|
|
|
if (!vd && sc)
|
2006-12-19 22:56:18 +00:00
|
|
|
for (vd = sc->global_vars; vd; vd = vd->next)
|
|
|
|
|
if (!str_cmp(vd->name, var) &&
|
|
|
|
|
(vd->context==0 || vd->context==sc->context))
|
2007-01-23 03:07:23 +00:00
|
|
|
break;
|
2006-12-19 22:56:18 +00:00
|
|
|
|
|
|
|
|
if (!*field) {
|
|
|
|
|
if (vd)
|
|
|
|
|
snprintf(str, slen, "%s", vd->value);
|
|
|
|
|
else {
|
|
|
|
|
if (!str_cmp(var, "self")) {
|
|
|
|
|
switch (type) {
|
|
|
|
|
case MOB_TRIGGER:
|
|
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID((char_data *) go));
|
|
|
|
|
break;
|
|
|
|
|
case OBJ_TRIGGER:
|
|
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID((obj_data *) go));
|
|
|
|
|
break;
|
|
|
|
|
case WLD_TRIGGER:
|
|
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, (long) ((room_data *)go)->number + ROOM_ID_BASE);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
else if (!str_cmp(var, "global")) {
|
2006-12-19 22:56:18 +00:00
|
|
|
/* so "remote varname %global%" will work */
|
|
|
|
|
snprintf(str, slen, "%d", ROOM_ID_BASE);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(var, "door"))
|
|
|
|
|
snprintf(str, slen, "%s", door[type]);
|
|
|
|
|
else if (!str_cmp(var, "force"))
|
|
|
|
|
snprintf(str, slen, "%s", force[type]);
|
|
|
|
|
else if (!str_cmp(var, "load"))
|
|
|
|
|
snprintf(str, slen, "%s", load[type]);
|
|
|
|
|
else if (!str_cmp(var, "purge"))
|
|
|
|
|
snprintf(str, slen, "%s", purge[type]);
|
|
|
|
|
else if (!str_cmp(var, "teleport"))
|
|
|
|
|
snprintf(str, slen, "%s", teleport[type]);
|
|
|
|
|
else if (!str_cmp(var, "damage"))
|
|
|
|
|
snprintf(str, slen, "%s", xdamage[type]);
|
|
|
|
|
else if (!str_cmp(var, "send"))
|
|
|
|
|
snprintf(str, slen, "%s", send_cmd[type]);
|
|
|
|
|
else if (!str_cmp(var, "echo"))
|
|
|
|
|
snprintf(str, slen, "%s", echo_cmd[type]);
|
|
|
|
|
else if (!str_cmp(var, "echoaround"))
|
|
|
|
|
snprintf(str, slen, "%s", echoaround_cmd[type]);
|
|
|
|
|
else if (!str_cmp(var, "zoneecho"))
|
|
|
|
|
snprintf(str, slen, "%s", zoneecho[type]);
|
|
|
|
|
else if (!str_cmp(var, "asound"))
|
|
|
|
|
snprintf(str, slen, "%s", asound[type]);
|
|
|
|
|
else if (!str_cmp(var, "at"))
|
|
|
|
|
snprintf(str, slen, "%s", at[type]);
|
|
|
|
|
else if (!str_cmp(var, "transform"))
|
|
|
|
|
snprintf(str, slen, "%s", transform[type]);
|
|
|
|
|
else if (!str_cmp(var, "recho"))
|
|
|
|
|
snprintf(str, slen, "%s", recho[type]);
|
2009-01-21 22:41:00 +00:00
|
|
|
else if (!str_cmp(var, "move"))
|
|
|
|
|
snprintf(str, slen, "%s", omove[type]);
|
2010-12-06 18:40:28 +00:00
|
|
|
else if (!str_cmp(var, "mail"))
|
|
|
|
|
snprintf(str, slen, "%s", mail[type]);
|
2006-12-19 22:56:18 +00:00
|
|
|
else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-12 01:12:46 +00:00
|
|
|
else if (vd && text_processed(field, subfield, vd, str, slen)) return;
|
|
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
else {
|
|
|
|
|
if (vd) {
|
|
|
|
|
name = vd->value;
|
|
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
|
case MOB_TRIGGER:
|
|
|
|
|
ch = (char_data *) go;
|
|
|
|
|
|
|
|
|
|
if ((o = get_object_in_equip(ch, name)));
|
|
|
|
|
else if ((o = get_obj_in_list(name, ch->carrying)));
|
|
|
|
|
else if (IN_ROOM(ch) != NOWHERE && (c = get_char_in_room(&world[IN_ROOM(ch)], name)));
|
|
|
|
|
else if ((o = get_obj_in_list(name,world[IN_ROOM(ch)].contents)));
|
|
|
|
|
else if ((c = get_char(name)));
|
|
|
|
|
else if ((o = get_obj(name)));
|
|
|
|
|
else if ((r = get_room(name))) {}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case OBJ_TRIGGER:
|
|
|
|
|
obj = (obj_data *) go;
|
|
|
|
|
|
|
|
|
|
if ((c = get_char_by_obj(obj, name)));
|
|
|
|
|
else if ((o = get_obj_by_obj(obj, name)));
|
|
|
|
|
else if ((r = get_room(name))) {}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case WLD_TRIGGER:
|
|
|
|
|
room = (struct room_data *) go;
|
|
|
|
|
|
|
|
|
|
if ((c = get_char_by_room(room, name)));
|
|
|
|
|
else if ((o = get_obj_by_room(room, name)));
|
|
|
|
|
else if ((r = get_room(name))) {}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
if (!str_cmp(var, "self")) {
|
|
|
|
|
switch (type) {
|
|
|
|
|
case MOB_TRIGGER:
|
|
|
|
|
c = (char_data *) go;
|
|
|
|
|
r = NULL;
|
2007-01-23 03:07:23 +00:00
|
|
|
o = NULL; /* NULL assignments added to avoid self to always be */
|
2006-12-19 22:56:18 +00:00
|
|
|
break; /* the room. - Welcor */
|
|
|
|
|
case OBJ_TRIGGER:
|
|
|
|
|
o = (obj_data *) go;
|
|
|
|
|
c = NULL;
|
|
|
|
|
r = NULL;
|
|
|
|
|
break;
|
|
|
|
|
case WLD_TRIGGER:
|
|
|
|
|
r = (struct room_data *) go;
|
|
|
|
|
c = NULL;
|
|
|
|
|
o = NULL;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(var, "global")) {
|
|
|
|
|
struct script_data *thescript = SCRIPT(&world[0]);
|
|
|
|
|
*str = '\0';
|
|
|
|
|
if (!thescript) {
|
|
|
|
|
script_log("Attempt to find global var. Apparently the void has no script.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (vd = thescript->global_vars; vd ; vd = vd->next)
|
|
|
|
|
if (!str_cmp(vd->name, field))
|
2007-01-23 03:07:23 +00:00
|
|
|
break;
|
|
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
if (vd)
|
|
|
|
|
snprintf(str, slen, "%s", vd->value);
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(var, "people")) {
|
2007-01-23 03:07:23 +00:00
|
|
|
snprintf(str, slen, "%d",((num = atoi(field)) > 0) ? trgvar_in_room(num) : 0);
|
2006-12-19 22:56:18 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2010-12-08 01:35:41 +00:00
|
|
|
else if (!str_cmp(var, "happyhour")) {
|
|
|
|
|
if (!str_cmp(field, "qp") && IS_HAPPYHOUR)
|
|
|
|
|
snprintf(str, slen, "%d", HAPPY_QP);
|
|
|
|
|
else if (!str_cmp(field, "exp") && IS_HAPPYHOUR)
|
|
|
|
|
snprintf(str, slen, "%d", HAPPY_EXP);
|
|
|
|
|
else if (!str_cmp(field, "gold") && IS_HAPPYHOUR)
|
|
|
|
|
snprintf(str, slen, "%d", HAPPY_GOLD);
|
|
|
|
|
else snprintf(str, slen, "%d", HAPPY_TIME);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(var, "time")) {
|
|
|
|
|
if (!str_cmp(field, "hour"))
|
|
|
|
|
snprintf(str, slen, "%d", time_info.hours);
|
|
|
|
|
else if (!str_cmp(field, "day"))
|
|
|
|
|
snprintf(str, slen, "%d", time_info.day + 1);
|
|
|
|
|
else if (!str_cmp(field, "month"))
|
|
|
|
|
snprintf(str, slen, "%d", time_info.month + 1);
|
|
|
|
|
else if (!str_cmp(field, "year"))
|
|
|
|
|
snprintf(str, slen, "%d", time_info.year);
|
|
|
|
|
else *str = '\0';
|
|
|
|
|
return;
|
|
|
|
|
}
|
2007-04-08 10:36:36 +00:00
|
|
|
/* %findobj.<room vnum X>(<object vnum/id/name>)%
|
|
|
|
|
* - count number of objects in room X with this name/id/vnum
|
|
|
|
|
* %findmob.<room vnum X>(<mob vnum Y>)%
|
|
|
|
|
* - count number of mobs in room X with vnum Y
|
2010-11-06 15:47:38 +00:00
|
|
|
* For example you want to check how many PC's are in room with vnum 1204. PC's
|
2007-04-08 10:36:36 +00:00
|
|
|
* have the vnum -1 so: %echo% players in room 1204: %findmob.1204(-1)%
|
2010-11-06 15:47:38 +00:00
|
|
|
* Or say you had a bank, and you want a script to check the number of bags of
|
|
|
|
|
* gold (vnum: 1234). In the vault (vnum: 453). Use: %findobj.453(1234)% and it
|
|
|
|
|
* will return the number of bags of gold.
|
2007-04-08 10:36:36 +00:00
|
|
|
* Addition inspired by Jamie Nelson */
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(var, "findmob")) {
|
|
|
|
|
if (!field || !*field || !subfield || !*subfield) {
|
|
|
|
|
script_log("findmob.vnum(mvnum) - illegal syntax");
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
} else {
|
|
|
|
|
room_rnum rrnum = real_room(atoi(field));
|
|
|
|
|
mob_vnum mvnum = atoi(subfield);
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
if (rrnum == NOWHERE) {
|
|
|
|
|
script_log("findmob.vnum(ovnum): No room with vnum %d", atoi(field));
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
} else {
|
|
|
|
|
for (i = 0, ch = world[rrnum].people; ch; ch = ch->next_in_room)
|
|
|
|
|
if (GET_MOB_VNUM(ch) == mvnum)
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
|
|
snprintf(str, slen, "%d", i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-04-08 10:36:36 +00:00
|
|
|
/* Addition inspired by Jamie Nelson. */
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(var, "findobj")) {
|
|
|
|
|
if (!field || !*field || !subfield || !*subfield) {
|
|
|
|
|
script_log("findobj.vnum(ovnum) - illegal syntax");
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
} else {
|
|
|
|
|
room_rnum rrnum = real_room(atoi(field));
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
if (rrnum == NOWHERE) {
|
|
|
|
|
script_log("findobj.vnum(ovnum): No room with vnum %d", atoi(field));
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
} else {
|
|
|
|
|
/* item_in_list looks within containers as well. */
|
|
|
|
|
snprintf(str, slen, "%d", item_in_list(subfield, world[rrnum].contents));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(var, "random")) {
|
|
|
|
|
if (!str_cmp(field, "char")) {
|
|
|
|
|
rndm = NULL;
|
|
|
|
|
count = 0;
|
|
|
|
|
|
|
|
|
|
if (type == MOB_TRIGGER) {
|
|
|
|
|
ch = (char_data *) go;
|
|
|
|
|
for (c = world[IN_ROOM(ch)].people; c; c = c->next_in_room)
|
|
|
|
|
if ((c != ch) && valid_dg_target(c, DG_ALLOW_GODS) &&
|
|
|
|
|
CAN_SEE(ch, c)) {
|
|
|
|
|
if (!rand_number(0, count))
|
|
|
|
|
rndm = c;
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (type == OBJ_TRIGGER) {
|
|
|
|
|
for (c = world[obj_room((obj_data *) go)].people; c;
|
|
|
|
|
c = c->next_in_room)
|
|
|
|
|
if (valid_dg_target(c, DG_ALLOW_GODS)) {
|
|
|
|
|
if (!rand_number(0, count))
|
|
|
|
|
rndm = c;
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (type == WLD_TRIGGER) {
|
|
|
|
|
for (c = ((struct room_data *) go)->people; c;
|
|
|
|
|
c = c->next_in_room)
|
|
|
|
|
if (valid_dg_target(c, DG_ALLOW_GODS)) {
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
if (!rand_number(0, count))
|
|
|
|
|
rndm = c;
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
if (rndm)
|
|
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(rndm));
|
|
|
|
|
else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (!str_cmp(field, "dir")) {
|
|
|
|
|
room_rnum in_room = NOWHERE;
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
switch (type) {
|
|
|
|
|
case WLD_TRIGGER:
|
|
|
|
|
in_room = real_room(((struct room_data *) go)->number);
|
|
|
|
|
break;
|
|
|
|
|
case OBJ_TRIGGER:
|
|
|
|
|
in_room = obj_room((struct obj_data *) go);
|
|
|
|
|
break;
|
|
|
|
|
case MOB_TRIGGER:
|
|
|
|
|
in_room = IN_ROOM((struct char_data *)go);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (in_room == NOWHERE) {
|
|
|
|
|
*str = '\0';
|
|
|
|
|
} else {
|
|
|
|
|
doors = 0;
|
|
|
|
|
room = &world[in_room];
|
2010-11-25 16:24:53 +00:00
|
|
|
for (i = 0; i < DIR_COUNT ; i++)
|
2006-12-19 22:56:18 +00:00
|
|
|
if (R_EXIT(room, i))
|
|
|
|
|
doors++;
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
if (!doors) {
|
|
|
|
|
*str = '\0';
|
|
|
|
|
} else {
|
|
|
|
|
for ( ; ; ) {
|
2010-11-25 16:24:53 +00:00
|
|
|
doors = rand_number(0, DIR_COUNT-1);
|
2006-12-19 22:56:18 +00:00
|
|
|
if (R_EXIT(room, doors))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%s", dirs[doors]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
snprintf(str, slen, "%d", ((num = atoi(field)) > 0) ? rand_number(1, num) : 0);
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
if (c) {
|
2010-11-06 15:47:38 +00:00
|
|
|
if (!str_cmp(field, "global")) { /* get global of something else */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (IS_NPC(c) && c->script) {
|
|
|
|
|
find_replacement(go, c->script, NULL, MOB_TRIGGER,
|
|
|
|
|
subfield, NULL, NULL, str, slen);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* set str to some 'non-text' first */
|
|
|
|
|
*str = '\x1';
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
switch (LOWER(*field)) {
|
|
|
|
|
case 'a':
|
2010-12-02 23:54:40 +00:00
|
|
|
if (!str_cmp(field, "admlevel")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int al;
|
|
|
|
|
if ((al = get_admin_level_by_string(subfield)) >= ADMLVL_MORTAL) {
|
|
|
|
|
if (IS_ADMIN(c, al))
|
|
|
|
|
strcpy(str, "1");
|
|
|
|
|
else
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
} else
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
} else
|
2010-12-01 18:27:19 +00:00
|
|
|
snprintf(str, slen, "%d", GET_ADMLEVEL(c));
|
|
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
if (!str_cmp(field, "affect")) {
|
2006-12-19 22:56:18 +00:00
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int spell = find_skill_num(subfield);
|
|
|
|
|
if (affected_by_spell(c, spell))
|
|
|
|
|
strcpy(str, "1");
|
2007-01-23 03:07:23 +00:00
|
|
|
else
|
2006-12-19 22:56:18 +00:00
|
|
|
strcpy(str, "0");
|
|
|
|
|
} else
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
else if (!str_cmp(field, "alias"))
|
|
|
|
|
snprintf(str, slen, "%s", GET_PC_NAME(c));
|
|
|
|
|
|
|
|
|
|
else if (!str_cmp(field, "align")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_ALIGNMENT(c) = MAX(-1000, MIN(addition, 1000));
|
|
|
|
|
}
|
2009-07-04 20:11:06 +00:00
|
|
|
snprintf(str, slen, "%d", GET_ALIGNMENT(c));
|
2008-08-31 22:36:07 +00:00
|
|
|
}
|
2009-07-04 20:11:06 +00:00
|
|
|
else if (!str_cmp(field, "armor"))
|
|
|
|
|
snprintf(str, slen, "%d", compute_armor_class(c));
|
2006-12-19 22:56:18 +00:00
|
|
|
break;
|
|
|
|
|
case 'c':
|
|
|
|
|
if (!str_cmp(field, "canbeseen")) {
|
|
|
|
|
if ((type == MOB_TRIGGER) && !CAN_SEE(((char_data *)go), c))
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
else
|
|
|
|
|
strcpy(str, "1");
|
|
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
else if (!str_cmp(field, "cha")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
2010-11-24 20:07:22 +00:00
|
|
|
int max = (IS_NPC(c) || IS_ADMIN(c, ADMLVL_GRGOD)) ? 25 : 18;
|
2008-08-31 22:36:07 +00:00
|
|
|
GET_CHA(c) += addition;
|
|
|
|
|
if (GET_CHA(c) > max) GET_CHA(c) = max;
|
|
|
|
|
if (GET_CHA(c) < 3) GET_CHA(c) = 3;
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_CHA(c));
|
|
|
|
|
}
|
2010-11-06 15:47:38 +00:00
|
|
|
else if (!str_cmp(field, "class")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int cl = get_class_by_name(subfield);
|
|
|
|
|
if (cl != -1) {
|
|
|
|
|
GET_CLASS(c) = cl;
|
|
|
|
|
snprintf(str, slen, "1");
|
|
|
|
|
} else {
|
|
|
|
|
snprintf(str, slen, "0");
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
sprinttype(GET_CLASS(c), pc_class_types, str, slen);
|
|
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "con")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
2010-11-24 20:07:22 +00:00
|
|
|
int max = (IS_NPC(c) || IS_ADMIN(c, ADMLVL_GRGOD)) ? 25 : 18;
|
2006-12-19 22:56:18 +00:00
|
|
|
GET_CON(c) += addition;
|
|
|
|
|
if (GET_CON(c) > max) GET_CON(c) = max;
|
|
|
|
|
if (GET_CON(c) < 3) GET_CON(c) = 3;
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_CON(c));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'd':
|
|
|
|
|
if (!str_cmp(field, "dex")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
2010-11-24 20:07:22 +00:00
|
|
|
int max = (IS_NPC(c) || IS_ADMIN(c, ADMLVL_GRGOD)) ? 25 : 18;
|
2006-12-19 22:56:18 +00:00
|
|
|
GET_DEX(c) += addition;
|
|
|
|
|
if (GET_DEX(c) > max) GET_DEX(c) = max;
|
|
|
|
|
if (GET_DEX(c) < 3) GET_DEX(c) = 3;
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_DEX(c));
|
|
|
|
|
}
|
2007-09-26 19:40:22 +00:00
|
|
|
else if (!str_cmp(field, "drunk")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_COND(c, DRUNK) = MAX(-1, MIN(addition, 24));
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_COND(c, DRUNK));
|
|
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
break;
|
|
|
|
|
case 'e':
|
2008-08-31 22:36:07 +00:00
|
|
|
if (!str_cmp(field, "eq")) {
|
2006-12-19 22:56:18 +00:00
|
|
|
int pos;
|
|
|
|
|
if (!subfield || !*subfield)
|
|
|
|
|
*str = '\0';
|
|
|
|
|
else if (*subfield == '*') {
|
|
|
|
|
for (i = 0, j = 0; i < NUM_WEARS; i++)
|
2007-01-23 03:07:23 +00:00
|
|
|
if (GET_EQ(c, i)) {
|
2006-12-19 22:56:18 +00:00
|
|
|
j++;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (j > 0)
|
|
|
|
|
strcpy(str,"1");
|
|
|
|
|
else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
} else if ((pos = find_eq_pos_script(subfield)) < 0 || !GET_EQ(c, pos))
|
|
|
|
|
*str = '\0';
|
|
|
|
|
else
|
|
|
|
|
snprintf(str, slen, "%c%ld",UID_CHAR, GET_ID(GET_EQ(c, pos)));
|
|
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
else if (!str_cmp(field, "exp")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = MIN(atoi(subfield), 1000);
|
|
|
|
|
|
|
|
|
|
gain_exp(c, addition);
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_EXP(c));
|
|
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
break;
|
|
|
|
|
case 'f':
|
|
|
|
|
if (!str_cmp(field, "fighting")) {
|
|
|
|
|
if (FIGHTING(c))
|
|
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(FIGHTING(c)));
|
2007-01-23 03:07:23 +00:00
|
|
|
else
|
2006-12-19 22:56:18 +00:00
|
|
|
*str = '\0';
|
2007-01-23 03:07:23 +00:00
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "follower")) {
|
|
|
|
|
if (!c->followers || !c->followers->follower)
|
|
|
|
|
*str = '\0';
|
|
|
|
|
else
|
|
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(c->followers->follower));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'g':
|
|
|
|
|
if (!str_cmp(field, "gold")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
2010-11-26 14:08:54 +00:00
|
|
|
increase_gold(c, addition);
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_GOLD(c));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'h':
|
|
|
|
|
if (!str_cmp(field, "has_item")) {
|
|
|
|
|
if (!(subfield && *subfield))
|
|
|
|
|
*str = '\0';
|
|
|
|
|
else
|
|
|
|
|
snprintf(str, slen, "%d", char_has_item(subfield, c));
|
|
|
|
|
}
|
2010-11-06 15:47:38 +00:00
|
|
|
else if (!str_cmp(field, "hasattached")) {
|
|
|
|
|
if (!(subfield && *subfield) || !IS_NPC(c))
|
|
|
|
|
*str = '\0';
|
|
|
|
|
else {
|
|
|
|
|
i = atoi(subfield);
|
|
|
|
|
snprintf(str, slen, "%d", trig_is_attached(SCRIPT(c), i));
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "heshe"))
|
|
|
|
|
snprintf(str, slen, "%s", HSSH(c));
|
|
|
|
|
else if (!str_cmp(field, "himher"))
|
|
|
|
|
snprintf(str, slen, "%s", HMHR(c));
|
2008-08-31 22:36:07 +00:00
|
|
|
else if (!str_cmp(field, "hisher"))
|
|
|
|
|
snprintf(str, slen, "%s", HSHR(c));
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "hitp")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_HIT(c) += addition;
|
|
|
|
|
update_pos(c);
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_HIT(c));
|
|
|
|
|
}
|
2007-09-26 19:40:22 +00:00
|
|
|
else if (!str_cmp(field, "hunger")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_COND(c, HUNGER) = MAX(-1, MIN(addition, 24));
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_COND(c, HUNGER));
|
|
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
break;
|
|
|
|
|
case 'i':
|
|
|
|
|
if (!str_cmp(field, "id"))
|
|
|
|
|
snprintf(str, slen, "%ld", GET_ID(c));
|
|
|
|
|
/* new check for pc/npc status */
|
|
|
|
|
else if (!str_cmp(field, "is_pc")) {
|
|
|
|
|
if (IS_NPC(c))
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
else
|
|
|
|
|
strcpy(str, "1");
|
|
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
else if (!str_cmp(field, "int")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
2010-11-24 20:07:22 +00:00
|
|
|
int max = (IS_NPC(c) || IS_ADMIN(c, ADMLVL_GRGOD)) ? 25 : 18;
|
2008-08-31 22:36:07 +00:00
|
|
|
GET_INT(c) += addition;
|
|
|
|
|
if (GET_INT(c) > max) GET_INT(c) = max;
|
|
|
|
|
if (GET_INT(c) < 3) GET_INT(c) = 3;
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_INT(c));
|
|
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "inventory")) {
|
|
|
|
|
if(subfield && *subfield) {
|
|
|
|
|
for (obj = c->carrying;obj;obj=obj->next_content) {
|
|
|
|
|
if(GET_OBJ_VNUM(obj)==atoi(subfield)) {
|
|
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(obj)); /* arg given, found */
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!obj)
|
|
|
|
|
*str = '\0'; /* arg given, not found */
|
|
|
|
|
} else { /* no arg given */
|
|
|
|
|
if (c->carrying) {
|
|
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(c->carrying));
|
|
|
|
|
} else {
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "is_killer")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
if (!str_cmp("on", subfield))
|
2007-05-08 15:20:59 +00:00
|
|
|
SET_BIT_AR(PLR_FLAGS(c), PLR_KILLER);
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp("off", subfield))
|
2007-05-08 15:20:59 +00:00
|
|
|
REMOVE_BIT_AR(PLR_FLAGS(c), PLR_KILLER);
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
|
|
|
|
if (PLR_FLAGGED(c, PLR_KILLER))
|
|
|
|
|
strcpy(str, "1");
|
|
|
|
|
else
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "is_thief")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
if (!str_cmp("on", subfield))
|
2007-05-08 15:20:59 +00:00
|
|
|
SET_BIT_AR(PLR_FLAGS(c), PLR_THIEF);
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp("off", subfield))
|
2007-05-08 15:20:59 +00:00
|
|
|
REMOVE_BIT_AR(PLR_FLAGS(c), PLR_THIEF);
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
|
|
|
|
if (PLR_FLAGGED(c, PLR_THIEF))
|
|
|
|
|
strcpy(str, "1");
|
|
|
|
|
else
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'l':
|
2010-11-06 15:47:38 +00:00
|
|
|
if (!str_cmp(field, "level")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int lev = atoi(subfield);
|
2010-11-24 20:07:22 +00:00
|
|
|
GET_LEVEL(c) = MIN(MAX(lev, 1), CONFIG_MAX_LEVEL);
|
2010-11-06 15:47:38 +00:00
|
|
|
} else
|
|
|
|
|
snprintf(str, slen, "%d", GET_LEVEL(c));
|
|
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
break;
|
|
|
|
|
case 'm':
|
2008-08-31 22:36:07 +00:00
|
|
|
if (!str_cmp(field, "mana")) {
|
2006-12-19 22:56:18 +00:00
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
2008-08-31 22:36:07 +00:00
|
|
|
GET_MANA(c) += addition;
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
snprintf(str, slen, "%d", GET_MANA(c));
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
else if (!str_cmp(field, "master")) {
|
|
|
|
|
if (!c->master)
|
|
|
|
|
*str = '\0';
|
|
|
|
|
else
|
|
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(c->master));
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "maxhitp")) {
|
2006-12-19 22:56:18 +00:00
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
2008-08-31 22:36:07 +00:00
|
|
|
GET_MAX_HIT(c) = MAX(GET_MAX_HIT(c) + addition, 1);
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
snprintf(str, slen, "%d", GET_MAX_HIT(c));
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "maxmana")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_MAX_MANA(c) = MAX(GET_MAX_MANA(c) + addition, 1);
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_MAX_MANA(c));
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "maxmove")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_MAX_MOVE(c) = MAX(GET_MAX_MOVE(c) + addition, 1);
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_MAX_MOVE(c));
|
|
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
else if (!str_cmp(field, "move")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_MOVE(c) += addition;
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_MOVE(c));
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'n':
|
|
|
|
|
if (!str_cmp(field, "name"))
|
|
|
|
|
snprintf(str, slen, "%s", GET_NAME(c));
|
|
|
|
|
|
|
|
|
|
else if (!str_cmp(field, "next_in_room")) {
|
|
|
|
|
if (c->next_in_room)
|
|
|
|
|
snprintf(str, slen,"%c%ld",UID_CHAR, GET_ID(c->next_in_room));
|
2007-01-23 03:07:23 +00:00
|
|
|
else
|
2006-12-19 22:56:18 +00:00
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'p':
|
2007-01-23 03:07:23 +00:00
|
|
|
/* Thanks to Christian Ejlertsen for this idea
|
2006-12-19 22:56:18 +00:00
|
|
|
And to Ken Ray for speeding the implementation up :)*/
|
|
|
|
|
if (!str_cmp(field, "pos")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
for (i = POS_SLEEPING; i <= POS_STANDING; i++) {
|
|
|
|
|
/* allows : Sleeping, Resting, Sitting, Fighting, Standing */
|
|
|
|
|
if (!strn_cmp(subfield, position_types[i], strlen(subfield))) {
|
|
|
|
|
GET_POS(c) = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%s", position_types[GET_POS(c)]);
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "prac")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_PRACTICES(c) = MAX(0, GET_PRACTICES(c) + addition);
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_PRACTICES(c));
|
|
|
|
|
}
|
2009-01-21 22:41:00 +00:00
|
|
|
else if (!str_cmp(field, "pref")) {
|
2010-11-06 15:47:38 +00:00
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int pref = get_flag_by_name(preference_bits, subfield);
|
|
|
|
|
if (!IS_NPC(c) && pref != NOFLAG && PRF_FLAGGED(c, pref))
|
|
|
|
|
strcpy(str, "1");
|
|
|
|
|
else
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
} else
|
|
|
|
|
strcpy(str, "0");
|
jeremyosborne | 2008-04-04 02:36:38 +0200 (Fri, 04 Apr 2008) | 1 line
Minor Bugfix: All game configuration settings now reference the world config
structure, not the individual config variables found in config.c.
------------------------------------------------------------------------
rumble | 2008-03-22 13:27:00 +0100 (Sat, 22 Mar 2008) | 1 line
Added lib/world/qst/ directory, index, index.mini, and 0.qst.
------------------------------------------------------------------------
jeremyosborne | 2008-03-08 03:27:51 +0100 (Sat, 08 Mar 2008) | 3 lines
Bugfix: the include directory (for .h files) is now referenced correctly in the
depend statement.
Deletion: listrent.c removed as a separate utility.
------------------------------------------------------------------------
jeremyosborne | 2008-03-08 03:08:51 +0100 (Sat, 08 Mar 2008) | 1 line
Enhancement: utils/ Makefile will now use a depends file, and looks for dependen
cies in the ../ directory (shrinks the necessary information to make each utilit
y).
------------------------------------------------------------------------
Rumble | 2008-03-06 23:39:35 +0100 (Thu, 06 Mar 2008) | 1 line
Made TBA specific changes. do_cheat, removed help level checking, and advance to
level 32.
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 18:37:12 +0100 (Thu, 06 Mar 2008) | 1 line
Minor Update: Changed header of Makefile.in to read 'tbaMUD' and also added in a
ttribution for the changes. (Thanks seqwith.)
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 18:31:07 +0100 (Thu, 06 Mar 2008) | 4 lines
Changed Makefile.in to use glob expressions when building the objects. This
translates into no longer a need to update Makefile.in whenever a new .c file
is added to the mud code. Other Makefile.* have not yet been changed (and
need review, anyway).
All CXREF cruft left in Makefile.in has been removed. tbaMUD is now using
Doxygen. Technically, CXREF provides a bit more auto-documentation than Doxygen
does, however the tbaMUD (and legacy circle code) has never been marked-up with
the special CXREF codes required to effectively use the program. Since Doxygen
is easier to use, and provides almost as much functionality as CXREF, CXREF
support has been dropped.
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 08:31:02 +0100 (Thu, 06 Mar 2008) | 1 line
Bug Fix: asciiflag_conv* functions now can handle a negative numeric value.
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 08:16:06 +0100 (Thu, 06 Mar 2008) | 1 line
Bug fix/enhancement: Charmed mobs (specifically charmed mobs with a ->master)
will no longer attempt to wander off.
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 08:13:38 +0100 (Thu, 06 Mar 2008) | 6 lines
Based on the compiler warning about mag_materials being an unused function, and
the clone spell being unused.
Bug fix: Clone can now be cast. It is an 'ignore' target spell.
Fix and Modification: Clone, being an effectively unused spell that is only used
by mortal Magic Users at level 30, is now implemented as very simple example of
how to use mag_materials(). The item required by mag_materials is vnum 161,
which in stock tbaMUD is some sacrificial entrails.
------------------------------------------------------------------------
jeremyosborne | 2008-03-05 01:43:09 +0100 (Wed, 05 Mar 2008) | 3 lines
Bug Fix for "Did you mean:" including DG commands.
------------------------------------------------------------------------
jeremyosborne | 2008-03-05 01:29:18 +0100 (Wed, 05 Mar 2008) | 3 lines
Bug Fix: do_simple_move slightly rewritten to handle Leave triggers that purge a
door.
Documentation: do_simple_move documented.
------------------------------------------------------------------------
Laoris | 2008-03-01 08:22:12 +0100 (Sat, 01 Mar 2008) | 1 line
Trial run of columnizer function on commands list to see how people like it.
------------------------------------------------------------------------
jeremyosborne | 2008-02-26 22:36:17 +0100 (Tue, 26 Feb 2008) | 1 line
asciimap, an in game automap, along with a couple of minor bug fixes to do with
the automap, patched in (Thanks Jamdog).
------------------------------------------------------------------------
jeremyosborne | 2008-02-22 04:08:05 +0100 (Fri, 22 Feb 2008) | 1 line
Minor update: Relocate local variable declaration to the top of ACMD(do_help)
------------------------------------------------------------------------
jeremyosborne | 2008-02-22 04:04:37 +0100 (Fri, 22 Feb 2008) | 6 lines
Checked in the following placeholders for do_gen_tog:
#define SCMD_AUTOLOOT 24
#define SCMD_AUTOGOLD 25
#define SCMD_AUTOSPLIT 26
#define SCMD_AUTOSAC 27
#define SCMD_AUTOASSIST 28
------------------------------------------------------------------------
jeremyosborne | 2008-02-22 03:57:06 +0100 (Fri, 22 Feb 2008) | 1 line
The Autoquest patch, along with a couple of minor bug fixes, has been integrated
into tbaMUD. (Thanks Jamdog, Kenneth Ray and Morgaelin.)
------------------------------------------------------------------------
jeremyosborne | 2008-02-18 21:46:45 +0100 (Mon, 18 Feb 2008) | 2 lines
Minor Fix:
Casted NOWHERE, NOTHING, NOBODY and NOFLAG as IDXTYPE for the signed short int
index types.
------------------------------------------------------------------------
jeremyosborne | 2008-02-18 03:36:16 +0100 (Mon, 18 Feb 2008) | 7 lines
Added a new atoidx() conversion function for dealing with string to IDXTYPE
conversions (in utils.c, prototype exported through utils.h).
Added IDXTYPE_MIN and IDXTYPE_MAX defines (in structs.h).
Replaced atoi references with atoidx in do_oasis_zedit (in zedit.c).
------------------------------------------------------------------------
Rumble | 2008-02-18 01:44:13 +0100 (Mon, 18 Feb 2008) | 1 line
Fixed direction mapping to give readable directions instead of sub commands.
------------------------------------------------------------------------
jeremyosborne | 2008-02-18 00:26:15 +0100 (Mon, 18 Feb 2008) | 5 lines
Since general olc editing are automatically saved to disk, 'shutdown reboot' has
been changed to not-autosave by default. (Small change made to do_shutdown in
act.wizard.c).
------------------------------------------------------------------------
jeremyosborne | 2008-02-18 00:12:12 +0100 (Mon, 18 Feb 2008) | 3 lines
Changed:
struct attack_hit_type moved to fight.h
attack_hit_text exported through fight.h
------------------------------------------------------------------------
jeremyosborne | 2008-02-17 22:32:51 +0100 (Sun, 17 Feb 2008) | 7 lines
- do_file heads or tails files correctly and has also been enhanced to return
file info (act.wizard.c)
- defines made for common log files created by autorun, and those used by
do_file (db.h)
- utility functions added: file_head(), file_tail(), file_sizeof(), and
file_numlines() (defined utils.c and exported through utils.h)
------------------------------------------------------------------------
Rumble | 2008-02-16 23:24:05 +0100 (Sat, 16 Feb 2008) | 1 line
Fixed export command. (thanks Kyle)
------------------------------------------------------------------------
jeremyosborne | 2008-02-16 22:42:46 +0100 (Sat, 16 Feb 2008) | 1 line
Files are now tagged as executable. Should be able to be checked out from subver
sion and executed without running chmod.
------------------------------------------------------------------------
Rumble | 2008-02-15 17:03:06 +0100 (Fri, 15 Feb 2008) | 1 line
Fixed strcat() writing out of bounds in cedit.c since strdup() only malloc()
strlen(str)+1 bytes. (thanks Buggo) and moved attack_hit_text back.
------------------------------------------------------------------------
jeremyosborne | 2008-02-13 20:41:02 +0100 (Wed, 13 Feb 2008) | 1 line
Event queue function definitions, global variables and defines doxygenated.
------------------------------------------------------------------------
Rumble | 2008-02-12 00:23:38 +0100 (Tue, 12 Feb 2008) | 1 line
Updated levels command to use an arg/range and added color parsing to greetings.
(thanks Jamdog)
------------------------------------------------------------------------
jeremyosborne | 2008-02-11 21:06:10 +0100 (Mon, 11 Feb 2008) | 1 line
Doxygen comments completed for weather.c
------------------------------------------------------------------------
Rumble | 2008-02-11 03:52:50 +0100 (Mon, 11 Feb 2008) | 1 line
Corrected several 64-bit warnings. (thanks Buggo)
------------------------------------------------------------------------
Rumble | 2008-02-10 22:56:56 +0100 (Sun, 10 Feb 2008) | 1 line
Added get_flag_by_name allowing for new trigedit variable checks like
%actor.pref(FLAG)% checks. (thanks Jamdog)
------------------------------------------------------------------------
jeremyosborne | 2008-02-08 21:22:26 +0100 (Fri, 08 Feb 2008) | 3 lines
COMPLETE: tbaMUD code re-org of global and local scope function and variable
declarations. There may be a few things that I did not catch (some non extern
keyword declarations of function prototypes within other functions, for
example).
BUG FIX: Unused functions encrypt_hex() and decrypt_hex() removed from mail.c.
------------------------------------------------------------------------
jeremyosborne | 2008-02-05 23:31:09 +0100 (Tue, 05 Feb 2008) | 2 lines
Continued clean-up of 'extern' references to functions and variables.
BUG UNCOVERED: set_title() in class.c incorrectly handles the const nature of
the char * returned from title_female and title_male.
------------------------------------------------------------------------
jeremyosborne | 2008-02-05 19:38:17 +0100 (Tue, 05 Feb 2008) | 3 lines
More work on mud clean-up.
New file: spec_procs.h
Created this file to house the legacy special procedures (spec_procs.c and
castle.c) and special feature assignment in general.
------------------------------------------------------------------------
jeremyosborne | 2008-02-05 00:59:44 +0100 (Tue, 05 Feb 2008) | 3 lines
- Minor Bugfix: Fixed parse error in mobact.c
- Minor Bugfix: act.h is now included in all of the act functions. Forgot to do
that the first time :(
- Additions: ban.h has been added as the external entry point into the ban.c
globals and functions. Files needing ban.h have been updated.
------------------------------------------------------------------------
jeremyosborne | 2008-02-04 20:02:11 +0100 (Mon, 04 Feb 2008) | 1 line
All act*.c functions, defines and globals have been prototyped/declared in
act.h. The file act.h does not contain every ACMD, only those ACMDs and
utility functions available within the act*.c files.
------------------------------------------------------------------------
Rumble | 2008-02-04 17:59:47 +0100 (Mon, 04 Feb 2008) | 1 line
Fixed the last few flags missed for the 128 bit conversion.
------------------------------------------------------------------------
Laoris | 2008-02-04 07:27:56 +0100 (Mon, 04 Feb 2008) | 3 lines
Adding a column formatter for lists. Accepts printf-like arguments.
Only used by medit right now.
------------------------------------------------------------------------
jeremyosborne | 2008-02-04 07:09:19 +0100 (Mon, 04 Feb 2008) | 2 lines
- Changed the 'struct queue' to 'struct dg_queue' to avoid namespace conflicts.
- Ongoing cleanup to mud project.
------------------------------------------------------------------------
Rumble | 2008-02-04 00:07:09 +0100 (Mon, 04 Feb 2008) | 1 line
Fixed run_autowiz which ran twice on advancement.
------------------------------------------------------------------------
jeremyosborne | 2008-02-03 03:46:22 +0100 (Sun, 03 Feb 2008) | 1 line
act.h created and added. This header will be the external entry point for the
functions, function subcommands and variables within the act*.c files. It is
not designed to be the entry point for all ACMD functions.
------------------------------------------------------------------------
jeremyosborne | 2008-02-03 02:44:29 +0100 (Sun, 03 Feb 2008) | 1 line
Merge of another part of the code cleanup, the dg script stuff.
------------------------------------------------------------------------
jeremyosborne | 2008-02-02 08:56:03 +0100 (Sat, 02 Feb 2008) | 1 line
Modularizing and organizing files continues. Committing comm.c and comm.h
because they are hairy, and I don't want to do them over if my hard drive
crashes.
------------------------------------------------------------------------
jeremyosborne | 2008-02-02 07:05:08 +0100 (Sat, 02 Feb 2008) | 4 lines
- Marking all file scope functions as 'static'
- Reorganization of the global variables and functions.
------------------------------------------------------------------------
jeremyosborne | 2008-01-31 10:20:47 +0100 (Thu, 31 Jan 2008) | 1 line
* Protected the conf.h.* system config files from multiple calls.
------------------------------------------------------------------------
jeremyosborne | 2008-01-31 09:56:18 +0100 (Thu, 31 Jan 2008) | 1 line
* Removed extraneous references to TRUE / FALSE and YES / NO defines.
------------------------------------------------------------------------
jeremyosborne | 2008-01-31 09:46:20 +0100 (Thu, 31 Jan 2008) | 2 lines
* BUGFIX: NUM_POSITIONS set to 8 (was incorrectly set to 15 before)
* Migrated NUM_* settings from oasis.h to more appropriate locations near where
they are defined. (For Example: NUM_POSITIONS moved to structs.h next to the
POSITION_* defines.)
------------------------------------------------------------------------
jeremyosborne | 2008-01-31 03:58:28 +0100 (Thu, 31 Jan 2008) | 1 line
Added Appendix A - Coder Support. Right now, it simply speaks to the fact that
we have included doxygen config files, are working to document the source code,
and provides a rudimentary "do this" guide to create the doxygen cross
references.
------------------------------------------------------------------------
jeremyosborne | 2008-01-30 07:12:07 +0100 (Wed, 30 Jan 2008) | 2 lines
- All .h files now have doxygen recognized headers, and the format is slightly
altered to ease editing of headers.
- Protected all .h files from multiple calls. (Standard format is #ifndef _HEADE
R_H_ #define _HEADER_H_ .... #endif)
------------------------------------------------------------------------
jeremyosborne | 2008-01-29 11:18:14 +0100 (Tue, 29 Jan 2008) | 1 line
constants.h, structs.h and utils.h now protected from multiple includes. This is
sometimes overkill, but good practice overall.
------------------------------------------------------------------------
jeremyosborne | 2008-01-29 10:38:18 +0100 (Tue, 29 Jan 2008) | 1 line
Updated documentation for constants.c and constants.h.
------------------------------------------------------------------------
jeremyosborne | 2008-01-29 10:15:25 +0100 (Tue, 29 Jan 2008) | 3 lines
The standard Doxygen configuration doxyfiles (config files) for tbaMUD. One is
to be used with the Graphviz DOT (dox_withGraphs), one is designed to be used if
Graphviz is not available.
Now just need a short document describing the usage of doxygen.
------------------------------------------------------------------------
jeremyosborne | 2008-01-29 10:11:36 +0100 (Tue, 29 Jan 2008) | 1 line
Minor document correction in struct dex_app_tpe.
------------------------------------------------------------------------
jeremyosborne | 2008-01-28 20:53:51 +0100 (Mon, 28 Jan 2008) | 1 line
*bugfix* do_drink command: When a container is empty, the correct, "It is
empty." message is now displayed.
------------------------------------------------------------------------
jeremyosborne | 2008-01-28 07:58:15 +0100 (Mon, 28 Jan 2008) | 3 lines
Merging changes to trunk for:
* utils.h, utils.c and structs.h doxygen comments
* adding file dox_withGraphs.doxyfile
2008-04-12 01:31:58 +00:00
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
break;
|
2007-04-02 00:32:54 +00:00
|
|
|
case 'q':
|
2010-11-06 15:47:38 +00:00
|
|
|
if (!IS_NPC(c) && (!str_cmp(field, "questpoints") ||
|
|
|
|
|
!str_cmp(field, "qp") || !str_cmp(field, "qpnts")))
|
jeremyosborne | 2008-04-04 02:36:38 +0200 (Fri, 04 Apr 2008) | 1 line
Minor Bugfix: All game configuration settings now reference the world config
structure, not the individual config variables found in config.c.
------------------------------------------------------------------------
rumble | 2008-03-22 13:27:00 +0100 (Sat, 22 Mar 2008) | 1 line
Added lib/world/qst/ directory, index, index.mini, and 0.qst.
------------------------------------------------------------------------
jeremyosborne | 2008-03-08 03:27:51 +0100 (Sat, 08 Mar 2008) | 3 lines
Bugfix: the include directory (for .h files) is now referenced correctly in the
depend statement.
Deletion: listrent.c removed as a separate utility.
------------------------------------------------------------------------
jeremyosborne | 2008-03-08 03:08:51 +0100 (Sat, 08 Mar 2008) | 1 line
Enhancement: utils/ Makefile will now use a depends file, and looks for dependen
cies in the ../ directory (shrinks the necessary information to make each utilit
y).
------------------------------------------------------------------------
Rumble | 2008-03-06 23:39:35 +0100 (Thu, 06 Mar 2008) | 1 line
Made TBA specific changes. do_cheat, removed help level checking, and advance to
level 32.
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 18:37:12 +0100 (Thu, 06 Mar 2008) | 1 line
Minor Update: Changed header of Makefile.in to read 'tbaMUD' and also added in a
ttribution for the changes. (Thanks seqwith.)
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 18:31:07 +0100 (Thu, 06 Mar 2008) | 4 lines
Changed Makefile.in to use glob expressions when building the objects. This
translates into no longer a need to update Makefile.in whenever a new .c file
is added to the mud code. Other Makefile.* have not yet been changed (and
need review, anyway).
All CXREF cruft left in Makefile.in has been removed. tbaMUD is now using
Doxygen. Technically, CXREF provides a bit more auto-documentation than Doxygen
does, however the tbaMUD (and legacy circle code) has never been marked-up with
the special CXREF codes required to effectively use the program. Since Doxygen
is easier to use, and provides almost as much functionality as CXREF, CXREF
support has been dropped.
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 08:31:02 +0100 (Thu, 06 Mar 2008) | 1 line
Bug Fix: asciiflag_conv* functions now can handle a negative numeric value.
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 08:16:06 +0100 (Thu, 06 Mar 2008) | 1 line
Bug fix/enhancement: Charmed mobs (specifically charmed mobs with a ->master)
will no longer attempt to wander off.
------------------------------------------------------------------------
jeremyosborne | 2008-03-06 08:13:38 +0100 (Thu, 06 Mar 2008) | 6 lines
Based on the compiler warning about mag_materials being an unused function, and
the clone spell being unused.
Bug fix: Clone can now be cast. It is an 'ignore' target spell.
Fix and Modification: Clone, being an effectively unused spell that is only used
by mortal Magic Users at level 30, is now implemented as very simple example of
how to use mag_materials(). The item required by mag_materials is vnum 161,
which in stock tbaMUD is some sacrificial entrails.
------------------------------------------------------------------------
jeremyosborne | 2008-03-05 01:43:09 +0100 (Wed, 05 Mar 2008) | 3 lines
Bug Fix for "Did you mean:" including DG commands.
------------------------------------------------------------------------
jeremyosborne | 2008-03-05 01:29:18 +0100 (Wed, 05 Mar 2008) | 3 lines
Bug Fix: do_simple_move slightly rewritten to handle Leave triggers that purge a
door.
Documentation: do_simple_move documented.
------------------------------------------------------------------------
Laoris | 2008-03-01 08:22:12 +0100 (Sat, 01 Mar 2008) | 1 line
Trial run of columnizer function on commands list to see how people like it.
------------------------------------------------------------------------
jeremyosborne | 2008-02-26 22:36:17 +0100 (Tue, 26 Feb 2008) | 1 line
asciimap, an in game automap, along with a couple of minor bug fixes to do with
the automap, patched in (Thanks Jamdog).
------------------------------------------------------------------------
jeremyosborne | 2008-02-22 04:08:05 +0100 (Fri, 22 Feb 2008) | 1 line
Minor update: Relocate local variable declaration to the top of ACMD(do_help)
------------------------------------------------------------------------
jeremyosborne | 2008-02-22 04:04:37 +0100 (Fri, 22 Feb 2008) | 6 lines
Checked in the following placeholders for do_gen_tog:
#define SCMD_AUTOLOOT 24
#define SCMD_AUTOGOLD 25
#define SCMD_AUTOSPLIT 26
#define SCMD_AUTOSAC 27
#define SCMD_AUTOASSIST 28
------------------------------------------------------------------------
jeremyosborne | 2008-02-22 03:57:06 +0100 (Fri, 22 Feb 2008) | 1 line
The Autoquest patch, along with a couple of minor bug fixes, has been integrated
into tbaMUD. (Thanks Jamdog, Kenneth Ray and Morgaelin.)
------------------------------------------------------------------------
jeremyosborne | 2008-02-18 21:46:45 +0100 (Mon, 18 Feb 2008) | 2 lines
Minor Fix:
Casted NOWHERE, NOTHING, NOBODY and NOFLAG as IDXTYPE for the signed short int
index types.
------------------------------------------------------------------------
jeremyosborne | 2008-02-18 03:36:16 +0100 (Mon, 18 Feb 2008) | 7 lines
Added a new atoidx() conversion function for dealing with string to IDXTYPE
conversions (in utils.c, prototype exported through utils.h).
Added IDXTYPE_MIN and IDXTYPE_MAX defines (in structs.h).
Replaced atoi references with atoidx in do_oasis_zedit (in zedit.c).
------------------------------------------------------------------------
Rumble | 2008-02-18 01:44:13 +0100 (Mon, 18 Feb 2008) | 1 line
Fixed direction mapping to give readable directions instead of sub commands.
------------------------------------------------------------------------
jeremyosborne | 2008-02-18 00:26:15 +0100 (Mon, 18 Feb 2008) | 5 lines
Since general olc editing are automatically saved to disk, 'shutdown reboot' has
been changed to not-autosave by default. (Small change made to do_shutdown in
act.wizard.c).
------------------------------------------------------------------------
jeremyosborne | 2008-02-18 00:12:12 +0100 (Mon, 18 Feb 2008) | 3 lines
Changed:
struct attack_hit_type moved to fight.h
attack_hit_text exported through fight.h
------------------------------------------------------------------------
jeremyosborne | 2008-02-17 22:32:51 +0100 (Sun, 17 Feb 2008) | 7 lines
- do_file heads or tails files correctly and has also been enhanced to return
file info (act.wizard.c)
- defines made for common log files created by autorun, and those used by
do_file (db.h)
- utility functions added: file_head(), file_tail(), file_sizeof(), and
file_numlines() (defined utils.c and exported through utils.h)
------------------------------------------------------------------------
Rumble | 2008-02-16 23:24:05 +0100 (Sat, 16 Feb 2008) | 1 line
Fixed export command. (thanks Kyle)
------------------------------------------------------------------------
jeremyosborne | 2008-02-16 22:42:46 +0100 (Sat, 16 Feb 2008) | 1 line
Files are now tagged as executable. Should be able to be checked out from subver
sion and executed without running chmod.
------------------------------------------------------------------------
Rumble | 2008-02-15 17:03:06 +0100 (Fri, 15 Feb 2008) | 1 line
Fixed strcat() writing out of bounds in cedit.c since strdup() only malloc()
strlen(str)+1 bytes. (thanks Buggo) and moved attack_hit_text back.
------------------------------------------------------------------------
jeremyosborne | 2008-02-13 20:41:02 +0100 (Wed, 13 Feb 2008) | 1 line
Event queue function definitions, global variables and defines doxygenated.
------------------------------------------------------------------------
Rumble | 2008-02-12 00:23:38 +0100 (Tue, 12 Feb 2008) | 1 line
Updated levels command to use an arg/range and added color parsing to greetings.
(thanks Jamdog)
------------------------------------------------------------------------
jeremyosborne | 2008-02-11 21:06:10 +0100 (Mon, 11 Feb 2008) | 1 line
Doxygen comments completed for weather.c
------------------------------------------------------------------------
Rumble | 2008-02-11 03:52:50 +0100 (Mon, 11 Feb 2008) | 1 line
Corrected several 64-bit warnings. (thanks Buggo)
------------------------------------------------------------------------
Rumble | 2008-02-10 22:56:56 +0100 (Sun, 10 Feb 2008) | 1 line
Added get_flag_by_name allowing for new trigedit variable checks like
%actor.pref(FLAG)% checks. (thanks Jamdog)
------------------------------------------------------------------------
jeremyosborne | 2008-02-08 21:22:26 +0100 (Fri, 08 Feb 2008) | 3 lines
COMPLETE: tbaMUD code re-org of global and local scope function and variable
declarations. There may be a few things that I did not catch (some non extern
keyword declarations of function prototypes within other functions, for
example).
BUG FIX: Unused functions encrypt_hex() and decrypt_hex() removed from mail.c.
------------------------------------------------------------------------
jeremyosborne | 2008-02-05 23:31:09 +0100 (Tue, 05 Feb 2008) | 2 lines
Continued clean-up of 'extern' references to functions and variables.
BUG UNCOVERED: set_title() in class.c incorrectly handles the const nature of
the char * returned from title_female and title_male.
------------------------------------------------------------------------
jeremyosborne | 2008-02-05 19:38:17 +0100 (Tue, 05 Feb 2008) | 3 lines
More work on mud clean-up.
New file: spec_procs.h
Created this file to house the legacy special procedures (spec_procs.c and
castle.c) and special feature assignment in general.
------------------------------------------------------------------------
jeremyosborne | 2008-02-05 00:59:44 +0100 (Tue, 05 Feb 2008) | 3 lines
- Minor Bugfix: Fixed parse error in mobact.c
- Minor Bugfix: act.h is now included in all of the act functions. Forgot to do
that the first time :(
- Additions: ban.h has been added as the external entry point into the ban.c
globals and functions. Files needing ban.h have been updated.
------------------------------------------------------------------------
jeremyosborne | 2008-02-04 20:02:11 +0100 (Mon, 04 Feb 2008) | 1 line
All act*.c functions, defines and globals have been prototyped/declared in
act.h. The file act.h does not contain every ACMD, only those ACMDs and
utility functions available within the act*.c files.
------------------------------------------------------------------------
Rumble | 2008-02-04 17:59:47 +0100 (Mon, 04 Feb 2008) | 1 line
Fixed the last few flags missed for the 128 bit conversion.
------------------------------------------------------------------------
Laoris | 2008-02-04 07:27:56 +0100 (Mon, 04 Feb 2008) | 3 lines
Adding a column formatter for lists. Accepts printf-like arguments.
Only used by medit right now.
------------------------------------------------------------------------
jeremyosborne | 2008-02-04 07:09:19 +0100 (Mon, 04 Feb 2008) | 2 lines
- Changed the 'struct queue' to 'struct dg_queue' to avoid namespace conflicts.
- Ongoing cleanup to mud project.
------------------------------------------------------------------------
Rumble | 2008-02-04 00:07:09 +0100 (Mon, 04 Feb 2008) | 1 line
Fixed run_autowiz which ran twice on advancement.
------------------------------------------------------------------------
jeremyosborne | 2008-02-03 03:46:22 +0100 (Sun, 03 Feb 2008) | 1 line
act.h created and added. This header will be the external entry point for the
functions, function subcommands and variables within the act*.c files. It is
not designed to be the entry point for all ACMD functions.
------------------------------------------------------------------------
jeremyosborne | 2008-02-03 02:44:29 +0100 (Sun, 03 Feb 2008) | 1 line
Merge of another part of the code cleanup, the dg script stuff.
------------------------------------------------------------------------
jeremyosborne | 2008-02-02 08:56:03 +0100 (Sat, 02 Feb 2008) | 1 line
Modularizing and organizing files continues. Committing comm.c and comm.h
because they are hairy, and I don't want to do them over if my hard drive
crashes.
------------------------------------------------------------------------
jeremyosborne | 2008-02-02 07:05:08 +0100 (Sat, 02 Feb 2008) | 4 lines
- Marking all file scope functions as 'static'
- Reorganization of the global variables and functions.
------------------------------------------------------------------------
jeremyosborne | 2008-01-31 10:20:47 +0100 (Thu, 31 Jan 2008) | 1 line
* Protected the conf.h.* system config files from multiple calls.
------------------------------------------------------------------------
jeremyosborne | 2008-01-31 09:56:18 +0100 (Thu, 31 Jan 2008) | 1 line
* Removed extraneous references to TRUE / FALSE and YES / NO defines.
------------------------------------------------------------------------
jeremyosborne | 2008-01-31 09:46:20 +0100 (Thu, 31 Jan 2008) | 2 lines
* BUGFIX: NUM_POSITIONS set to 8 (was incorrectly set to 15 before)
* Migrated NUM_* settings from oasis.h to more appropriate locations near where
they are defined. (For Example: NUM_POSITIONS moved to structs.h next to the
POSITION_* defines.)
------------------------------------------------------------------------
jeremyosborne | 2008-01-31 03:58:28 +0100 (Thu, 31 Jan 2008) | 1 line
Added Appendix A - Coder Support. Right now, it simply speaks to the fact that
we have included doxygen config files, are working to document the source code,
and provides a rudimentary "do this" guide to create the doxygen cross
references.
------------------------------------------------------------------------
jeremyosborne | 2008-01-30 07:12:07 +0100 (Wed, 30 Jan 2008) | 2 lines
- All .h files now have doxygen recognized headers, and the format is slightly
altered to ease editing of headers.
- Protected all .h files from multiple calls. (Standard format is #ifndef _HEADE
R_H_ #define _HEADER_H_ .... #endif)
------------------------------------------------------------------------
jeremyosborne | 2008-01-29 11:18:14 +0100 (Tue, 29 Jan 2008) | 1 line
constants.h, structs.h and utils.h now protected from multiple includes. This is
sometimes overkill, but good practice overall.
------------------------------------------------------------------------
jeremyosborne | 2008-01-29 10:38:18 +0100 (Tue, 29 Jan 2008) | 1 line
Updated documentation for constants.c and constants.h.
------------------------------------------------------------------------
jeremyosborne | 2008-01-29 10:15:25 +0100 (Tue, 29 Jan 2008) | 3 lines
The standard Doxygen configuration doxyfiles (config files) for tbaMUD. One is
to be used with the Graphviz DOT (dox_withGraphs), one is designed to be used if
Graphviz is not available.
Now just need a short document describing the usage of doxygen.
------------------------------------------------------------------------
jeremyosborne | 2008-01-29 10:11:36 +0100 (Tue, 29 Jan 2008) | 1 line
Minor document correction in struct dex_app_tpe.
------------------------------------------------------------------------
jeremyosborne | 2008-01-28 20:53:51 +0100 (Mon, 28 Jan 2008) | 1 line
*bugfix* do_drink command: When a container is empty, the correct, "It is
empty." message is now displayed.
------------------------------------------------------------------------
jeremyosborne | 2008-01-28 07:58:15 +0100 (Mon, 28 Jan 2008) | 3 lines
Merging changes to trunk for:
* utils.h, utils.c and structs.h doxygen comments
* adding file dox_withGraphs.doxyfile
2008-04-12 01:31:58 +00:00
|
|
|
{
|
2007-04-02 00:32:54 +00:00
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_QUESTPOINTS(c) += addition;
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_QUESTPOINTS(c));
|
|
|
|
|
}
|
2010-11-06 15:47:38 +00:00
|
|
|
else if (!str_cmp(field, "quest"))
|
|
|
|
|
{
|
2009-01-21 22:41:00 +00:00
|
|
|
if (!IS_NPC(c) && (GET_QUEST(c) != NOTHING) && (real_quest(GET_QUEST(c)) != NOTHING))
|
2010-11-06 15:47:38 +00:00
|
|
|
snprintf(str, slen, "%d", GET_QUEST(c));
|
|
|
|
|
else
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "questdone"))
|
|
|
|
|
{
|
|
|
|
|
if (!IS_NPC(c) && subfield && *subfield) {
|
|
|
|
|
int q_num = atoi(subfield);
|
|
|
|
|
if (is_complete(c, q_num))
|
|
|
|
|
strcpy(str, "1");
|
|
|
|
|
else
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
}
|
2007-04-02 00:32:54 +00:00
|
|
|
break;
|
2008-09-02 01:48:44 +00:00
|
|
|
case 'r':
|
2006-12-19 22:56:18 +00:00
|
|
|
if (!str_cmp(field, "room")) { /* in NOWHERE, return the void */
|
|
|
|
|
/* see note in dg_scripts.h */
|
|
|
|
|
#ifdef ACTOR_ROOM_IS_UID
|
2007-01-23 03:07:23 +00:00
|
|
|
snprintf(str, slen, "%c%ld",UID_CHAR,
|
|
|
|
|
(IN_ROOM(c)!= NOWHERE) ? (long) world[IN_ROOM(c)].number + ROOM_ID_BASE : ROOM_ID_BASE);
|
|
|
|
|
#else
|
2006-12-19 22:56:18 +00:00
|
|
|
snprintf(str, slen, "%d", (IN_ROOM(c)!= NOWHERE) ? world[IN_ROOM(c)].number : 0);
|
2007-01-23 03:07:23 +00:00
|
|
|
#endif
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
2008-09-02 01:48:44 +00:00
|
|
|
break;
|
2006-12-19 22:56:18 +00:00
|
|
|
case 's':
|
2008-08-31 22:36:07 +00:00
|
|
|
if (!str_cmp(field, "saving_breath")) {
|
2006-12-19 22:56:18 +00:00
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
2008-08-31 22:36:07 +00:00
|
|
|
GET_SAVE(c, SAVING_SPELL) += addition;
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
snprintf(str, slen, "%d", GET_SAVE(c, SAVING_BREATH));
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
else if (!str_cmp(field, "saving_para")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_SAVE(c, SAVING_PARA) += addition;
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
snprintf(str, slen, "%d", GET_SAVE(c, SAVING_PARA));
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
else if (!str_cmp(field, "saving_petri")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_SAVE(c, SAVING_PETRI) += addition;
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_SAVE(c, SAVING_PETRI));
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "saving_rod")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_SAVE(c, SAVING_ROD) += addition;
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_SAVE(c, SAVING_ROD));
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "saving_spell")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_SAVE(c, SAVING_SPELL) += addition;
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_SAVE(c, SAVING_SPELL));
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "sex"))
|
|
|
|
|
snprintf(str, slen, "%s", genders[(int)GET_SEX(c)]);
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "skill"))
|
|
|
|
|
snprintf(str, slen, "%s", skill_percent(c, subfield));
|
|
|
|
|
else if (!str_cmp(field, "skillset")) {
|
|
|
|
|
if (!IS_NPC(c) && subfield && *subfield) {
|
|
|
|
|
char skillname[MAX_INPUT_LENGTH], *amount;
|
|
|
|
|
amount = one_word(subfield, skillname);
|
|
|
|
|
skip_spaces(&amount);
|
|
|
|
|
if (amount && *amount && is_number(amount)) {
|
|
|
|
|
int skillnum = find_skill_num(skillname);
|
|
|
|
|
if (skillnum > 0) {
|
|
|
|
|
int new_value = MAX(0, MIN(100, atoi(amount)));
|
|
|
|
|
SET_SKILL(c, skillnum, new_value);
|
2007-01-23 03:07:23 +00:00
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*str = '\0'; /* so the parser know we recognize 'skillset' as a field */
|
|
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
else if (!str_cmp(field, "str")) {
|
2006-12-19 22:56:18 +00:00
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
2010-11-24 20:07:22 +00:00
|
|
|
int max = (IS_NPC(c) || IS_ADMIN(c, ADMLVL_GRGOD)) ? 25 : 18;
|
2008-08-31 22:36:07 +00:00
|
|
|
GET_STR(c) += addition;
|
|
|
|
|
if (GET_STR(c) > max) GET_STR(c) = max;
|
|
|
|
|
if (GET_STR(c) < 3) GET_STR(c) = 3;
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
snprintf(str, slen, "%d", GET_STR(c));
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
else if (!str_cmp(field, "stradd")) {
|
|
|
|
|
if (GET_STR(c) >= 18) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_ADD(c) += addition;
|
|
|
|
|
if (GET_ADD(c) > 100) GET_ADD(c) = 100;
|
|
|
|
|
if (GET_ADD(c) < 0) GET_ADD(c) = 0;
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_ADD(c));
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
|
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
break;
|
|
|
|
|
case 't':
|
|
|
|
|
if (!str_cmp(field, "thirst")) {
|
2006-12-19 22:56:18 +00:00
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
2008-08-31 22:36:07 +00:00
|
|
|
GET_COND(c, THIRST) = MAX(-1, MIN(addition, 24));
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
snprintf(str, slen, "%d", GET_COND(c, THIRST));
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
else if (!str_cmp(field, "title")) {
|
2006-12-19 22:56:18 +00:00
|
|
|
if (!IS_NPC(c) && subfield && *subfield && valid_dg_target(c, DG_ALLOW_GODS)) {
|
|
|
|
|
if (GET_TITLE(c)) free(GET_TITLE(c));
|
2007-01-23 03:07:23 +00:00
|
|
|
GET_TITLE(c) = strdup(subfield);
|
|
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
snprintf(str, slen, "%s", IS_NPC(c) ? "" : GET_TITLE(c));
|
|
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
break;
|
|
|
|
|
case 'v':
|
|
|
|
|
if (!str_cmp(field, "varexists")) {
|
|
|
|
|
struct trig_var_data *remote_vd;
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
if (SCRIPT(c)) {
|
|
|
|
|
for (remote_vd = SCRIPT(c)->global_vars; remote_vd; remote_vd = remote_vd->next) {
|
|
|
|
|
if (!str_cmp(remote_vd->name, subfield)) break;
|
|
|
|
|
}
|
|
|
|
|
if (remote_vd) strcpy(str, "1");
|
2007-09-26 19:40:22 +00:00
|
|
|
}
|
|
|
|
|
}
|
2008-08-31 22:36:07 +00:00
|
|
|
else if (!str_cmp(field, "vnum")) {
|
2006-12-19 22:56:18 +00:00
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
snprintf(str, slen, "%d", IS_NPC(c) ? (int)(GET_MOB_VNUM(c) == atoi(subfield)) : -1 );
|
|
|
|
|
} else {
|
|
|
|
|
if (IS_NPC(c))
|
|
|
|
|
snprintf(str, slen, "%d", GET_MOB_VNUM(c));
|
|
|
|
|
else
|
2007-01-23 03:07:23 +00:00
|
|
|
/*
|
|
|
|
|
* for compatibility with unsigned indexes
|
|
|
|
|
* - this is deprecated - use %actor.is_pc% to check
|
2006-12-19 22:56:18 +00:00
|
|
|
* instead of %actor.vnum% == -1 --Welcor 09/03
|
|
|
|
|
*/
|
|
|
|
|
strcpy(str, "-1");
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
break;
|
|
|
|
|
case 'w':
|
|
|
|
|
if (!str_cmp(field, "weight"))
|
|
|
|
|
snprintf(str, slen, "%d", GET_WEIGHT(c));
|
|
|
|
|
else if (!str_cmp(field, "wis")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
2010-11-24 20:07:22 +00:00
|
|
|
int max = (IS_NPC(c) || IS_ADMIN(c, ADMLVL_GRGOD)) ? 25 : 18;
|
2006-12-19 22:56:18 +00:00
|
|
|
GET_WIS(c) += addition;
|
|
|
|
|
if (GET_WIS(c) > max) GET_WIS(c) = max;
|
|
|
|
|
if (GET_WIS(c) < 3) GET_WIS(c) = 3;
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_WIS(c));
|
|
|
|
|
}
|
|
|
|
|
break;
|
2007-01-23 03:07:23 +00:00
|
|
|
} /* switch *field */
|
|
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
if (*str == '\x1') { /* no match found in switch */
|
|
|
|
|
if (SCRIPT(c)) {
|
|
|
|
|
for (vd = (SCRIPT(c))->global_vars; vd; vd = vd->next)
|
|
|
|
|
if (!str_cmp(vd->name, field))
|
|
|
|
|
break;
|
|
|
|
|
if (vd)
|
|
|
|
|
snprintf(str, slen, "%s", vd->value);
|
|
|
|
|
else {
|
|
|
|
|
*str = '\0';
|
|
|
|
|
script_log("Trigger: %s, VNum %d. unknown char field: '%s'",
|
|
|
|
|
GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), field);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
*str = '\0';
|
|
|
|
|
script_log("Trigger: %s, VNum %d. unknown char field: '%s'",
|
|
|
|
|
GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), field);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} /* if (c) ...*/
|
|
|
|
|
|
|
|
|
|
else if (o) {
|
|
|
|
|
|
|
|
|
|
*str = '\x1';
|
|
|
|
|
switch (LOWER(*field)) {
|
2007-10-04 18:37:07 +00:00
|
|
|
case 'a':
|
2010-11-06 15:47:38 +00:00
|
|
|
if (!str_cmp(field, "affects")) {
|
|
|
|
|
if (subfield && *subfield) {
|
2007-10-04 18:37:07 +00:00
|
|
|
if (check_flags_by_name_ar(GET_OBJ_AFFECT(o), NUM_AFF_FLAGS, subfield, affected_bits) == TRUE)
|
2010-11-06 15:47:38 +00:00
|
|
|
snprintf(str, slen, "1");
|
|
|
|
|
else
|
|
|
|
|
snprintf(str, slen, "0");
|
2007-10-04 18:37:07 +00:00
|
|
|
} else
|
2010-11-06 15:47:38 +00:00
|
|
|
snprintf(str, slen, "0");
|
|
|
|
|
}
|
2007-10-04 18:37:07 +00:00
|
|
|
case 'c':
|
2006-12-19 22:56:18 +00:00
|
|
|
if (!str_cmp(field, "cost")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_OBJ_COST(o) = MAX(1, addition + GET_OBJ_COST(o));
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_OBJ_COST(o));
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "cost_per_day")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_OBJ_RENT(o) = MAX(1, addition + GET_OBJ_RENT(o));
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_OBJ_RENT(o));
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "carried_by")) {
|
|
|
|
|
if (o->carried_by)
|
|
|
|
|
snprintf(str, slen,"%c%ld",UID_CHAR, GET_ID(o->carried_by));
|
2007-01-23 03:07:23 +00:00
|
|
|
else
|
2006-12-19 22:56:18 +00:00
|
|
|
*str = '\0';
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "contents")) {
|
|
|
|
|
if (o->contains)
|
|
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(o->contains));
|
2007-01-23 03:07:23 +00:00
|
|
|
else
|
2006-12-19 22:56:18 +00:00
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
/* thanks to Jamie Nelson (Mordecai of 4 Dimensions MUD) */
|
|
|
|
|
else if (!str_cmp(field, "count")) {
|
2007-01-23 03:07:23 +00:00
|
|
|
if (GET_OBJ_TYPE(o) == ITEM_CONTAINER)
|
|
|
|
|
snprintf(str, slen, "%d", item_in_list(subfield,
|
2006-12-19 22:56:18 +00:00
|
|
|
o->contains));
|
|
|
|
|
else
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
}
|
|
|
|
|
break;
|
2007-11-23 22:24:38 +00:00
|
|
|
case 'e':
|
|
|
|
|
if (!str_cmp(field, "extra")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
if (check_flags_by_name_ar(GET_OBJ_EXTRA(o), NUM_ITEM_FLAGS, subfield, extra_bits) > 0)
|
|
|
|
|
snprintf(str, slen, "1");
|
|
|
|
|
else
|
|
|
|
|
snprintf(str, slen, "0");
|
2009-02-17 16:04:07 +00:00
|
|
|
} else {
|
|
|
|
|
sprintbitarray(GET_OBJ_EXTRA(o), extra_bits, EF_ARRAY_MAX, str);
|
|
|
|
|
}
|
2007-11-23 22:24:38 +00:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'h':
|
2006-12-19 22:56:18 +00:00
|
|
|
/* thanks to Jamie Nelson (Mordecai of 4 Dimensions MUD) */
|
2007-01-23 03:07:23 +00:00
|
|
|
if (!str_cmp(field, "has_in")) {
|
|
|
|
|
if (GET_OBJ_TYPE(o) == ITEM_CONTAINER)
|
|
|
|
|
snprintf(str, slen, "%s", (item_in_list(subfield,
|
2006-12-19 22:56:18 +00:00
|
|
|
o->contains) ? "1" : "0"));
|
|
|
|
|
else
|
|
|
|
|
strcpy(str, "0");
|
|
|
|
|
}
|
2010-11-06 15:47:38 +00:00
|
|
|
else if (!str_cmp(field, "hasattached")) {
|
|
|
|
|
if (!(subfield && *subfield))
|
|
|
|
|
*str = '\0';
|
|
|
|
|
else {
|
|
|
|
|
i = atoi(subfield);
|
|
|
|
|
snprintf(str, slen, "%d", trig_is_attached(SCRIPT(o), i));
|
|
|
|
|
}
|
2008-06-11 00:34:08 +00:00
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
break;
|
|
|
|
|
case 'i':
|
|
|
|
|
if (!str_cmp(field, "id"))
|
|
|
|
|
snprintf(str, slen, "%ld", GET_ID(o));
|
|
|
|
|
|
|
|
|
|
else if (!str_cmp(field, "is_inroom")) {
|
|
|
|
|
if (IN_ROOM(o) != NOWHERE)
|
2007-01-23 03:07:23 +00:00
|
|
|
snprintf(str, slen,"%c%ld",UID_CHAR, (long) world[IN_ROOM(o)].number + ROOM_ID_BASE);
|
2006-12-19 22:56:18 +00:00
|
|
|
else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
2010-11-06 15:47:38 +00:00
|
|
|
else if (!str_cmp(field, "is_pc")) {
|
|
|
|
|
strcpy(str, "-1");
|
|
|
|
|
}
|
2007-09-26 19:40:22 +00:00
|
|
|
break;
|
2006-12-19 22:56:18 +00:00
|
|
|
case 'n':
|
|
|
|
|
if (!str_cmp(field, "name"))
|
|
|
|
|
snprintf(str, slen, "%s", o->name);
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "next_in_list")) {
|
|
|
|
|
if (o->next_content)
|
|
|
|
|
snprintf(str, slen,"%c%ld",UID_CHAR, GET_ID(o->next_content));
|
2007-01-23 03:07:23 +00:00
|
|
|
else
|
2006-12-19 22:56:18 +00:00
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'r':
|
|
|
|
|
if (!str_cmp(field, "room")) {
|
|
|
|
|
if (obj_room(o) != NOWHERE)
|
|
|
|
|
snprintf(str, slen,"%c%ld",UID_CHAR, (long)world[obj_room(o)].number + ROOM_ID_BASE);
|
2007-01-23 03:07:23 +00:00
|
|
|
else
|
2006-12-19 22:56:18 +00:00
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 's':
|
|
|
|
|
if (!str_cmp(field, "shortdesc"))
|
|
|
|
|
snprintf(str, slen, "%s", o->short_description);
|
|
|
|
|
break;
|
|
|
|
|
case 't':
|
|
|
|
|
if (!str_cmp(field, "type"))
|
|
|
|
|
sprinttype(GET_OBJ_TYPE(o), item_types, str, slen);
|
|
|
|
|
|
|
|
|
|
else if (!str_cmp(field, "timer"))
|
|
|
|
|
snprintf(str, slen, "%d", GET_OBJ_TIMER(o));
|
|
|
|
|
break;
|
|
|
|
|
case 'v':
|
|
|
|
|
if (!str_cmp(field, "vnum"))
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
snprintf(str, slen, "%d", (int)(GET_OBJ_VNUM(o) == atoi(subfield)));
|
|
|
|
|
} else {
|
|
|
|
|
snprintf(str, slen, "%d", GET_OBJ_VNUM(o));
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "val0"))
|
|
|
|
|
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 0));
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "val1"))
|
|
|
|
|
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 1));
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "val2"))
|
|
|
|
|
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 2));
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "val3"))
|
|
|
|
|
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 3));
|
|
|
|
|
break;
|
|
|
|
|
case 'w':
|
2010-11-06 15:47:38 +00:00
|
|
|
if (!str_cmp(field, "wearflag")) {
|
2007-06-30 09:47:54 +00:00
|
|
|
if (subfield && *subfield) {
|
2010-11-06 15:47:38 +00:00
|
|
|
if (can_wear_on_pos(o, find_eq_pos_script(subfield)))
|
|
|
|
|
snprintf(str, slen, "1");
|
|
|
|
|
else
|
|
|
|
|
snprintf(str, slen, "0");
|
2007-07-02 13:52:06 +00:00
|
|
|
} else
|
|
|
|
|
snprintf(str, slen, "0");
|
2007-06-30 09:47:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (!str_cmp(field, "weight")){
|
2006-12-19 22:56:18 +00:00
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
int addition = atoi(subfield);
|
|
|
|
|
GET_OBJ_WEIGHT(o) = MAX(1, addition + GET_OBJ_WEIGHT(o));
|
|
|
|
|
}
|
|
|
|
|
snprintf(str, slen, "%d", GET_OBJ_WEIGHT(o));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (!str_cmp(field, "worn_by")) {
|
|
|
|
|
if (o->worn_by)
|
|
|
|
|
snprintf(str, slen,"%c%ld",UID_CHAR, GET_ID(o->worn_by));
|
2007-01-23 03:07:23 +00:00
|
|
|
else
|
2006-12-19 22:56:18 +00:00
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
} /* switch *field */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (*str == '\x1') { /* no match in switch */
|
|
|
|
|
if (SCRIPT(o)) { /* check for global var */
|
|
|
|
|
for (vd = (SCRIPT(o))->global_vars; vd; vd = vd->next)
|
|
|
|
|
if (!str_cmp(vd->name, field))
|
|
|
|
|
break;
|
|
|
|
|
if (vd)
|
|
|
|
|
snprintf(str, slen, "%s", vd->value);
|
|
|
|
|
else {
|
|
|
|
|
*str = '\0';
|
|
|
|
|
script_log("Trigger: %s, VNum %d, type: %d. unknown object field: '%s'",
|
|
|
|
|
GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), type, field);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
*str = '\0';
|
|
|
|
|
script_log("Trigger: %s, VNum %d, type: %d. unknown object field: '%s'",
|
|
|
|
|
GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), type, field);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} /* if (o) ... */
|
|
|
|
|
|
|
|
|
|
else if (r) {
|
|
|
|
|
|
|
|
|
|
/* special handling of the void, as it stores all 'full global' variables */
|
|
|
|
|
if (r->number == 0) {
|
|
|
|
|
if (!SCRIPT(r)) {
|
|
|
|
|
*str = '\0';
|
|
|
|
|
script_log("Trigger: %s, Vnum %d, type %d. Trying to access Global var list of void. Apparently this has not been set up!",
|
|
|
|
|
GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), type);
|
|
|
|
|
} else {
|
|
|
|
|
for (vd = (SCRIPT(r))->global_vars; vd; vd = vd->next)
|
|
|
|
|
if (!str_cmp(vd->name, field))
|
|
|
|
|
break;
|
|
|
|
|
if (vd)
|
|
|
|
|
snprintf(str, slen, "%s", vd->value);
|
2007-01-23 03:07:23 +00:00
|
|
|
else
|
2006-12-19 22:56:18 +00:00
|
|
|
*str = '\0';
|
2007-01-23 03:07:23 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "name"))
|
|
|
|
|
snprintf(str, slen, "%s", r->name);
|
|
|
|
|
|
|
|
|
|
else if (!str_cmp(field, "sector"))
|
|
|
|
|
sprinttype(r->sector_type, sector_types, str, slen);
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "vnum")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
snprintf(str, slen, "%d", (int)(r->number == atoi(subfield)));
|
|
|
|
|
} else {
|
2007-01-23 03:07:23 +00:00
|
|
|
snprintf(str, slen,"%d",r->number);
|
|
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
} else if (!str_cmp(field, "contents")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
for (obj = r->contents; obj; obj = obj->next_content) {
|
|
|
|
|
if (GET_OBJ_VNUM(obj) == atoi(subfield)) {
|
|
|
|
|
/* arg given, found */
|
2007-01-23 03:07:23 +00:00
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(obj));
|
2006-12-19 22:56:18 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!obj)
|
|
|
|
|
*str = '\0'; /* arg given, not found */
|
|
|
|
|
} else { /* no arg given */
|
|
|
|
|
if (r->contents) {
|
|
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(r->contents));
|
|
|
|
|
} else {
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "people")) {
|
|
|
|
|
if (r->people)
|
|
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(r->people));
|
|
|
|
|
else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "id")) {
|
|
|
|
|
room_rnum rnum = real_room(r->number);
|
|
|
|
|
if (rnum != NOWHERE)
|
2007-01-23 03:07:23 +00:00
|
|
|
snprintf(str, slen, "%ld", (long) world[rnum].number + ROOM_ID_BASE);
|
2006-12-19 22:56:18 +00:00
|
|
|
else
|
|
|
|
|
*str = '\0';
|
2007-01-23 03:07:23 +00:00
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "weather")) {
|
|
|
|
|
const char *sky_look[] = {
|
|
|
|
|
"sunny",
|
|
|
|
|
"cloudy",
|
|
|
|
|
"rainy",
|
|
|
|
|
"lightning"
|
|
|
|
|
};
|
|
|
|
|
|
2007-05-08 15:20:59 +00:00
|
|
|
if (!IS_SET_AR(r->room_flags, ROOM_INDOORS))
|
2006-12-19 22:56:18 +00:00
|
|
|
snprintf(str, slen, "%s", sky_look[weather_info.sky]);
|
|
|
|
|
else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
2010-11-06 15:47:38 +00:00
|
|
|
else if (!str_cmp(field, "hasattached")) {
|
|
|
|
|
if (!(subfield && *subfield))
|
|
|
|
|
*str = '\0';
|
|
|
|
|
else {
|
|
|
|
|
i = atoi(subfield);
|
|
|
|
|
snprintf(str, slen, "%d", trig_is_attached(SCRIPT(r), i));
|
|
|
|
|
}
|
2008-06-11 00:34:08 +00:00
|
|
|
}
|
2010-11-06 15:47:38 +00:00
|
|
|
else if (!str_cmp(field, "zonenumber"))
|
|
|
|
|
snprintf(str, slen, "%d", zone_table[r->zone].number);
|
|
|
|
|
else if (!str_cmp(field, "zonename"))
|
2007-10-04 18:37:07 +00:00
|
|
|
snprintf(str, slen, "%s", zone_table[r->zone].name);
|
2010-11-06 15:47:38 +00:00
|
|
|
else if (!str_cmp(field, "roomflag")) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
room_rnum thisroom = real_room(r->number);
|
|
|
|
|
if (check_flags_by_name_ar(ROOM_FLAGS(thisroom), NUM_ROOM_FLAGS, subfield, room_bits) == TRUE)
|
|
|
|
|
snprintf(str, slen, "1");
|
|
|
|
|
else
|
|
|
|
|
snprintf(str, slen, "0");
|
2007-10-04 18:37:07 +00:00
|
|
|
} else
|
2010-11-06 15:47:38 +00:00
|
|
|
snprintf(str, slen, "0");
|
2007-10-04 18:37:07 +00:00
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
else if (!str_cmp(field, "north")) {
|
|
|
|
|
if (R_EXIT(r, NORTH)) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
if (!str_cmp(subfield, "vnum"))
|
|
|
|
|
snprintf(str, slen, "%d", GET_ROOM_VNUM(R_EXIT(r, NORTH)->to_room));
|
|
|
|
|
else if (!str_cmp(subfield, "key"))
|
|
|
|
|
snprintf(str, slen, "%d", R_EXIT(r, NORTH)->key);
|
|
|
|
|
else if (!str_cmp(subfield, "bits"))
|
|
|
|
|
sprintbit(R_EXIT(r, NORTH)->exit_info ,exit_bits, str, slen);
|
|
|
|
|
else if (!str_cmp(subfield, "room")) {
|
|
|
|
|
if (R_EXIT(r, NORTH)->to_room != NOWHERE)
|
2007-01-23 03:07:23 +00:00
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, NORTH)->to_room].number + ROOM_ID_BASE);
|
2006-12-19 22:56:18 +00:00
|
|
|
else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
} else /* no subfield - default to bits */
|
|
|
|
|
sprintbit(R_EXIT(r, NORTH)->exit_info ,exit_bits, str, slen);
|
|
|
|
|
} else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "east")) {
|
|
|
|
|
if (R_EXIT(r, EAST)) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
if (!str_cmp(subfield, "vnum"))
|
|
|
|
|
snprintf(str, slen, "%d", GET_ROOM_VNUM(R_EXIT(r, EAST)->to_room));
|
|
|
|
|
else if (!str_cmp(subfield, "key"))
|
|
|
|
|
snprintf(str, slen, "%d", R_EXIT(r, EAST)->key);
|
|
|
|
|
else if (!str_cmp(subfield, "bits"))
|
|
|
|
|
sprintbit(R_EXIT(r, EAST)->exit_info ,exit_bits, str, slen);
|
|
|
|
|
else if (!str_cmp(subfield, "room")) {
|
|
|
|
|
if (R_EXIT(r, EAST)->to_room != NOWHERE)
|
2007-01-23 03:07:23 +00:00
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, EAST)->to_room].number + ROOM_ID_BASE);
|
2006-12-19 22:56:18 +00:00
|
|
|
else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
} else /* no subfield - default to bits */
|
|
|
|
|
sprintbit(R_EXIT(r, EAST)->exit_info ,exit_bits, str, slen);
|
|
|
|
|
} else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "south")) {
|
|
|
|
|
if (R_EXIT(r, SOUTH)) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
if (!str_cmp(subfield, "vnum"))
|
|
|
|
|
snprintf(str, slen, "%d", GET_ROOM_VNUM(R_EXIT(r, SOUTH)->to_room));
|
|
|
|
|
else if (!str_cmp(subfield, "key"))
|
|
|
|
|
snprintf(str, slen, "%d", R_EXIT(r, SOUTH)->key);
|
|
|
|
|
else if (!str_cmp(subfield, "bits"))
|
|
|
|
|
sprintbit(R_EXIT(r, SOUTH)->exit_info ,exit_bits, str, slen);
|
|
|
|
|
else if (!str_cmp(subfield, "room")) {
|
|
|
|
|
if (R_EXIT(r, SOUTH)->to_room != NOWHERE)
|
2007-01-23 03:07:23 +00:00
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, SOUTH)->to_room].number + ROOM_ID_BASE);
|
2006-12-19 22:56:18 +00:00
|
|
|
else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
} else /* no subfield - default to bits */
|
|
|
|
|
sprintbit(R_EXIT(r, SOUTH)->exit_info ,exit_bits, str, slen);
|
|
|
|
|
} else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "west")) {
|
|
|
|
|
if (R_EXIT(r, WEST)) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
if (!str_cmp(subfield, "vnum"))
|
|
|
|
|
snprintf(str, slen, "%d", GET_ROOM_VNUM(R_EXIT(r, WEST)->to_room));
|
|
|
|
|
else if (!str_cmp(subfield, "key"))
|
|
|
|
|
snprintf(str, slen, "%d", R_EXIT(r, WEST)->key);
|
|
|
|
|
else if (!str_cmp(subfield, "bits"))
|
|
|
|
|
sprintbit(R_EXIT(r, WEST)->exit_info ,exit_bits, str, slen);
|
|
|
|
|
else if (!str_cmp(subfield, "room")) {
|
|
|
|
|
if (R_EXIT(r, WEST)->to_room != NOWHERE)
|
2007-01-23 03:07:23 +00:00
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, WEST)->to_room].number + ROOM_ID_BASE);
|
2006-12-19 22:56:18 +00:00
|
|
|
else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
} else /* no subfield - default to bits */
|
|
|
|
|
sprintbit(R_EXIT(r, WEST)->exit_info ,exit_bits, str, slen);
|
|
|
|
|
} else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "up")) {
|
|
|
|
|
if (R_EXIT(r, UP)) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
if (!str_cmp(subfield, "vnum"))
|
|
|
|
|
snprintf(str, slen, "%d", GET_ROOM_VNUM(R_EXIT(r, UP)->to_room));
|
|
|
|
|
else if (!str_cmp(subfield, "key"))
|
|
|
|
|
snprintf(str, slen, "%d", R_EXIT(r, UP)->key);
|
|
|
|
|
else if (!str_cmp(subfield, "bits"))
|
|
|
|
|
sprintbit(R_EXIT(r, UP)->exit_info ,exit_bits, str, slen);
|
|
|
|
|
else if (!str_cmp(subfield, "room")) {
|
|
|
|
|
if (R_EXIT(r, UP)->to_room != NOWHERE)
|
2007-01-23 03:07:23 +00:00
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, UP)->to_room].number + ROOM_ID_BASE);
|
2006-12-19 22:56:18 +00:00
|
|
|
else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
} else /* no subfield - default to bits */
|
|
|
|
|
sprintbit(R_EXIT(r, UP)->exit_info ,exit_bits, str, slen);
|
|
|
|
|
} else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
else if (!str_cmp(field, "down")) {
|
|
|
|
|
if (R_EXIT(r, DOWN)) {
|
|
|
|
|
if (subfield && *subfield) {
|
|
|
|
|
if (!str_cmp(subfield, "vnum"))
|
|
|
|
|
snprintf(str, slen, "%d", GET_ROOM_VNUM(R_EXIT(r, DOWN)->to_room));
|
|
|
|
|
else if (!str_cmp(subfield, "key"))
|
|
|
|
|
snprintf(str, slen, "%d", R_EXIT(r, DOWN)->key);
|
|
|
|
|
else if (!str_cmp(subfield, "bits"))
|
|
|
|
|
sprintbit(R_EXIT(r, DOWN)->exit_info ,exit_bits, str, slen);
|
|
|
|
|
else if (!str_cmp(subfield, "room")) {
|
|
|
|
|
if (R_EXIT(r, DOWN)->to_room != NOWHERE)
|
2007-01-23 03:07:23 +00:00
|
|
|
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, DOWN)->to_room].number + ROOM_ID_BASE);
|
2006-12-19 22:56:18 +00:00
|
|
|
else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
} else /* no subfield - default to bits */
|
|
|
|
|
sprintbit(R_EXIT(r, DOWN)->exit_info ,exit_bits, str, slen);
|
|
|
|
|
} else
|
|
|
|
|
*str = '\0';
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (SCRIPT(r)) { /* check for global var */
|
|
|
|
|
for (vd = (SCRIPT(r))->global_vars; vd; vd = vd->next)
|
|
|
|
|
if (!str_cmp(vd->name, field))
|
|
|
|
|
break;
|
|
|
|
|
if (vd)
|
|
|
|
|
snprintf(str, slen, "%s", vd->value);
|
|
|
|
|
else {
|
|
|
|
|
*str = '\0';
|
|
|
|
|
script_log("Trigger: %s, VNum %d, type: %d. unknown room field: '%s'",
|
|
|
|
|
GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), type, field);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
*str = '\0';
|
|
|
|
|
script_log("Trigger: %s, VNum %d, type: %d. unknown room field: '%s'",
|
|
|
|
|
GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), type, field);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} /* if (r).. */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-06 15:47:38 +00:00
|
|
|
/* Now automatically checks if the variable has more then one field in it. And
|
|
|
|
|
* if the field returns a name or a script UID or the like it can recurse. If
|
|
|
|
|
* you supply a value like, %actor.int.str% it wont blow up on you either. Now
|
|
|
|
|
* also lets subfields have variables parsed inside of them so that: %echo%
|
2007-04-08 10:36:36 +00:00
|
|
|
* %actor.gold(%actor.gold%)% will double the actors gold every time its called.
|
|
|
|
|
* - Jamie Nelson */
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
/* substitutes any variables into line and returns it as buf */
|
|
|
|
|
void var_subst(void *go, struct script_data *sc, trig_data *trig,
|
|
|
|
|
int type, char *line, char *buf)
|
|
|
|
|
{
|
|
|
|
|
char tmp[MAX_INPUT_LENGTH], repl_str[MAX_INPUT_LENGTH];
|
|
|
|
|
char *var = NULL, *field = NULL, *p = NULL;
|
|
|
|
|
char tmp2[MAX_INPUT_LENGTH];
|
|
|
|
|
char *subfield_p, subfield[MAX_INPUT_LENGTH];
|
|
|
|
|
int left, len;
|
|
|
|
|
int paren_count = 0;
|
|
|
|
|
int dots = 0;
|
|
|
|
|
|
|
|
|
|
/* skip out if no %'s */
|
|
|
|
|
if (!strchr(line, '%')) {
|
|
|
|
|
strcpy(buf, line);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/*lets just empty these to start with*/
|
|
|
|
|
*repl_str = *tmp = *tmp2 = '\0';
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
p = strcpy(tmp, line);
|
|
|
|
|
subfield_p = subfield;
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
left = MAX_INPUT_LENGTH - 1;
|
|
|
|
|
|
|
|
|
|
while (*p && (left > 0)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* copy until we find the first % */
|
|
|
|
|
while (*p && (*p != '%') && (left > 0)) {
|
|
|
|
|
*(buf++) = *(p++);
|
|
|
|
|
left--;
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
*buf = '\0';
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
/* double % */
|
|
|
|
|
if (*p && (*(++p) == '%') && (left > 0)) {
|
|
|
|
|
*(buf++) = *(p++);
|
|
|
|
|
*buf = '\0';
|
|
|
|
|
left--;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* so it wasn't double %'s */
|
|
|
|
|
else if (*p && (left > 0)) {
|
2007-01-23 03:07:23 +00:00
|
|
|
|
|
|
|
|
/* search until end of var or beginning of field */
|
2006-12-19 22:56:18 +00:00
|
|
|
for (var = p; *p && (*p != '%') && (*p != '.'); p++);
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
field = p;
|
|
|
|
|
if (*p == '.') {
|
|
|
|
|
*(p++) = '\0';
|
|
|
|
|
dots = 0;
|
|
|
|
|
for (field = p; *p && ((*p != '%')||(paren_count > 0) || (dots)); p++) {
|
|
|
|
|
if (dots > 0) {
|
|
|
|
|
*subfield_p = '\0';
|
|
|
|
|
find_replacement(go, sc, trig, type, var, field, subfield, repl_str, sizeof(repl_str));
|
2007-01-23 03:07:23 +00:00
|
|
|
if (*repl_str) {
|
2006-12-19 22:56:18 +00:00
|
|
|
snprintf(tmp2, sizeof(tmp2), "eval tmpvr %s", repl_str); //temp var
|
|
|
|
|
process_eval(go, sc, trig, type, tmp2);
|
|
|
|
|
strcpy(var, "tmpvr");
|
|
|
|
|
field = p;
|
|
|
|
|
dots = 0;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
dots = 0;
|
|
|
|
|
} else if (*p=='(') {
|
|
|
|
|
*p = '\0';
|
|
|
|
|
paren_count++;
|
|
|
|
|
} else if (*p==')') {
|
|
|
|
|
*p = '\0';
|
|
|
|
|
paren_count--;
|
|
|
|
|
} else if (paren_count > 0) {
|
|
|
|
|
*subfield_p++ = *p;
|
|
|
|
|
} else if (*p=='.') {
|
|
|
|
|
*p = '\0';
|
|
|
|
|
dots++;
|
2007-01-23 03:07:23 +00:00
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
} /* for (field.. */
|
|
|
|
|
} /* if *p == '.' */
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
*(p++) = '\0';
|
|
|
|
|
*subfield_p = '\0';
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
if (*subfield) {
|
|
|
|
|
var_subst(go, sc, trig, type, subfield, tmp2);
|
|
|
|
|
strcpy(subfield, tmp2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
find_replacement(go, sc, trig, type, var, field, subfield, repl_str, sizeof(repl_str));
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
strncat(buf, repl_str, left);
|
|
|
|
|
len = strlen(repl_str);
|
|
|
|
|
buf += len;
|
|
|
|
|
left -= len;
|
|
|
|
|
} /* else if *p .. */
|
2007-01-23 03:07:23 +00:00
|
|
|
} /* while *p .. */
|
2006-12-19 22:56:18 +00:00
|
|
|
}
|