summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2008-12-28 14:34:51 +0000
committerJared Adams <jaxad0127@gmail.com>2008-12-28 14:34:51 +0000
commite22cc45c0dfffa33b981f8674743cacd9915d6e0 (patch)
tree6befa28eab0e75ff79b0cdd9e4ec004bcca155e7 /src/map/script.c
parent995325503acbdeb8b767c9c28b9d4209211ed23d (diff)
downloadtmwa-e22cc45c0dfffa33b981f8674743cacd9915d6e0.tar.gz
tmwa-e22cc45c0dfffa33b981f8674743cacd9915d6e0.tar.bz2
tmwa-e22cc45c0dfffa33b981f8674743cacd9915d6e0.tar.xz
tmwa-e22cc45c0dfffa33b981f8674743cacd9915d6e0.zip
Add a fuction to add a timer to all PCs in an area
This can be used to easily perform an action on all the PCs in the area. All script facilities are available to such functions.
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 11bfdc0..57d78f6 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -286,7 +286,7 @@ int buildin_hasitems(struct script_state *st); // [Valaris]
int buildin_getlook(struct script_state *st); //Lorky [Lupus]
int buildin_getsavepoint(struct script_state *st); //Lorky [Lupus]
int buildin_getpartnerid(struct script_state *st); // [Fate]
-
+int buildin_areatimer(struct script_state *st); // [Jaxad0127]
void push_val(struct script_stack *stack,int type,int val);
int run_func(struct script_state *st);
@@ -493,7 +493,8 @@ struct {
{buildin_hasitems,"hasitems","*"}, // [Valaris]
{buildin_mobcount,"mobcount","ss"},
{buildin_getlook,"getlook","i"},
- {buildin_getsavepoint,"getsavepoint","i"}, // End Additions
+ {buildin_getsavepoint,"getsavepoint","i"},
+ {buildin_areatimer,"areatimer","siiiiis"}, // End Additions
{NULL,NULL,NULL},
};
int buildin_message(struct script_state *st); // [MouseJstr]
@@ -5980,6 +5981,43 @@ int buildin_getsavepoint(struct script_state *st)
return 0;
}
+/*==========================================
+ * areatimer
+ *------------------------------------------
+ */
+int buildin_areatimer_sub(struct block_list *bl,va_list ap)
+{
+ int tick;
+ char *event;
+ tick=va_arg(ap,int);
+ event=va_arg(ap, char *);
+ pc_addeventtimer((struct map_session_data *) bl,tick,event);
+ return 0;
+}
+int buildin_areatimer(struct script_state *st)
+{
+ int tick,m;
+ char *event;
+ char *mapname;
+ int x0,y0,x1,y1;
+
+ mapname=conv_str(st,& (st->stack->stack_data[st->start+2]));
+ x0=conv_num(st,& (st->stack->stack_data[st->start+3]));
+ y0=conv_num(st,& (st->stack->stack_data[st->start+4]));
+ x1=conv_num(st,& (st->stack->stack_data[st->start+5]));
+ y1=conv_num(st,& (st->stack->stack_data[st->start+6]));
+ tick=conv_num(st,& (st->stack->stack_data[st->start+7]));
+ event=conv_str(st,& (st->stack->stack_data[st->start+8]));
+
+ if( (m=map_mapname2mapid(mapname))< 0)
+ return 0;
+
+ map_foreachinarea(buildin_areatimer_sub,
+ m,x0,y0,x1,y1,BL_PC, tick,event );
+ return 0;
+}
+
+
//
// ŽÀs•”main