Added room login trig types --Jamdog

This commit is contained in:
JamDog 2009-01-31 13:24:41 +00:00
parent e9373bb849
commit ca675fdb67
6 changed files with 178 additions and 151 deletions

View file

@ -35,6 +35,8 @@ export (QQ's a zone into a tarball)t
Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist) Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist)
(lots of major bugfixes too) (lots of major bugfixes too)
tbaMUD 3.59 tbaMUD 3.59
[Jan 31 2009] - Jamdog
Added room login trig types, to catch players logging in to a particular room
[Jan 29 2009] - Rumble [Jan 29 2009] - Rumble
Corrected zcheck MAX_OBJ_GOLD_ALLOWED to compare against Val 0, not Val 1. (thanks Tails) Corrected zcheck MAX_OBJ_GOLD_ALLOWED to compare against Val 0, not Val 1. (thanks Tails)
Created new MAX_OBJ_GOLD_ALLOWED define for zcheck. (thanks Tails) Created new MAX_OBJ_GOLD_ALLOWED define for zcheck. (thanks Tails)

Binary file not shown.

View file

@ -877,7 +877,7 @@ const char *wtrig_types[] = {
"Cast", "Cast",
"Leave", "Leave",
"Door", "Door",
"UNUSED", "Login",
"Time", "Time",
"\n" "\n"
}; };

View file

@ -105,8 +105,9 @@
#define WTRIG_CAST (1 << 15) /* spell cast in room */ #define WTRIG_CAST (1 << 15) /* spell cast in room */
#define WTRIG_LEAVE (1 << 16) /* character leaves the room */ #define WTRIG_LEAVE (1 << 16) /* character leaves the room */
#define WTRIG_DOOR (1 << 17) /* door manipulated in room */ #define WTRIG_DOOR (1 << 17) /* door manipulated in room */
#define WTRIG_LOGIN (1 << 18) /* character logs into MUD */
#define WTRIG_TIME (1 << 19) /* trigger based on game hour */ #define WTRIG_TIME (1 << 19) /* trigger based on game hour */
/* obj command trigger types */ /* obj command trigger types */
#define OCMD_EQUIP (1 << 0) /* obj must be in char's equip */ #define OCMD_EQUIP (1 << 0) /* obj must be in char's equip */
#define OCMD_INVEN (1 << 1) /* obj must be in char's inven */ #define OCMD_INVEN (1 << 1) /* obj must be in char's inven */
@ -260,6 +261,8 @@ void time_mtrigger(char_data *ch);
void time_otrigger(obj_data *obj); void time_otrigger(obj_data *obj);
void time_wtrigger(room_data *room); void time_wtrigger(room_data *room);
int login_wtrigger(struct room_data *room, char_data *actor);
/* function prototypes from dg_scripts.c */ /* function prototypes from dg_scripts.c */
ACMD(do_attach) ; ACMD(do_attach) ;
ACMD(do_detach); ACMD(do_detach);

View file

@ -1237,3 +1237,22 @@ void time_wtrigger(struct room_data *room)
} }
} }
} }
int login_wtrigger(struct room_data *room, char_data *actor)
{
trig_data *t;
char buf[MAX_INPUT_LENGTH];
if (!SCRIPT_CHECK(room, WTRIG_LOGIN))
return 1;
for (t = TRIGGERS(SCRIPT(room)); t; t = t->next) {
if (TRIGGER_CHECK(t, WTRIG_LOGIN) &&
(rand_number(1, 100) <= GET_TRIG_NARG(t))) {
ADD_UID_VAR(buf, t, actor, "actor", 0);
return script_driver(&room, t, WLD_TRIGGER, TRIG_NEW);
}
}
return 1;
}

View file

@ -1181,6 +1181,9 @@ int enter_player_game (struct descriptor_data *d)
load_result = Crash_load(d->character); load_result = Crash_load(d->character);
save_char(d->character); save_char(d->character);
/* Check for a login trigger in the players' start room */
login_wtrigger(&world[IN_ROOM(d->character)], d->character);
return load_result; return load_result;
} }