From 729fa55b9d7b7f29c6a152ad6846eac1bc43cdee Mon Sep 17 00:00:00 2001 From: remoitnane Date: Sun, 29 Aug 2010 21:56:24 -0700 Subject: Expand script function "misceffect" and clean up documentation --- src/map/script.c | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index d36334e..58c4b33 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -4104,10 +4104,11 @@ int buildin_savepoint (struct script_state *st) /*========================================== * gettimetick(type) * - * type: - * 0 system tick (default) - * 1 seconds elapsed today - * 2 seconds since Unix epoch + * type The type of time measurement. + * Specify 0 for the system tick, 1 for + * seconds elapsed today, or 2 for seconds + * since Unix epoch. Defaults to 0 for any + * other value. *------------------------------------------ */ int buildin_gettimetick (struct script_state *st) /* Asgard Version */ @@ -6671,31 +6672,56 @@ int buildin_classchange (struct script_state *st) } /*========================================== - * NPC���甭�������G�t�F�N�g + * misceffect(effect, [target]) + * + * effect The effect type/ID. + * target The player name or being ID on + * which to display the effect. If not + * specified, it attempts to default to + * the current NPC or invoking PC. *------------------------------------------ */ int buildin_misceffect (struct script_state *st) { int type; + int id = 0; char *name = NULL; + struct block_list *bl = NULL; type = conv_num (st, &(st->stack->stack_data[st->start + 2])); + if (st->end > st->start + 3) - name = conv_str (st, &(st->stack->stack_data[st->start + 3])); + { + struct script_data *sdata = &(st->stack->stack_data[st->start + 3]); + + get_val (st, sdata); + + if (sdata->type == C_STR || sdata->type == C_CONSTSTR) + name = conv_str (st, sdata); + else + id = conv_num (st, sdata); + } + if (name) { struct map_session_data *sd = map_nick2sd (name); if (sd) - clif_misceffect (&sd->bl, type); + bl = &sd->bl; } + else if (id) + bl = map_id2bl (id); else if (st->oid) - clif_misceffect (map_id2bl (st->oid), type); + bl = map_id2bl (st->oid); else { struct map_session_data *sd = script_rid2sd (st); if (sd) - clif_misceffect (&sd->bl, type); + bl = &sd->bl; } + + if (bl) + clif_misceffect (bl, type); + return 0; } -- cgit v1.2.3-60-g2f50