From 369f7b3a44b0838e168ef7dcdc36d182845e8874 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 26 Nov 2014 16:58:56 +0300 Subject: Replace script function misceffect2 to misceffect. --- src/map/init.c | 3 +-- src/map/script.c | 30 ++++++++++++++++++++++++++++++ src/map/script.h | 1 + 3 files changed, 32 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/map/init.c b/src/map/init.c index 910b5df..03e6320 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -74,8 +74,7 @@ HPExport void plugin_init (void) addScriptCommand("setnpcdir", "*", setNpcDir); addScriptCommand("rif", "is*", rif); addScriptCommand("countitemcolor", "v*", countItemColor); - // must be replaced to misceffect - addScriptCommand("misceffect2", "i*", dummy); + addScriptCommand("misceffect", "i*", miscEffect); do_init_langs(); diff --git a/src/map/script.c b/src/map/script.c index bdf8bb2..618f89c 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -401,3 +401,33 @@ BUILDIN(countItemColor) script_pushint(st, count); return true; } + +BUILDIN(miscEffect) +{ + int type = script_getnum(st, 2); + struct block_list *bl = NULL; + + if (script_hasdata(st, 3)) + { + if (script_isstring(st, 3)) + { + TBL_PC *sd = map->nick2sd(script_getstr(st, 3)); + if (sd) + bl = &sd->bl; + } + else if (script_isint(st, 3)) + { + bl = map->id2bl(script_getnum(st, 3)); + } + } + + if (!bl) + { + TBL_PC *sd = script->rid2sd (st); + if (sd) + bl = &sd->bl; + } + if (bl) + clif->specialeffect(bl, type, AREA); + return true; +} diff --git a/src/map/script.h b/src/map/script.h index a58b071..15efc00 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -19,5 +19,6 @@ BUILDIN(getNpcDir); BUILDIN(setNpcDir); BUILDIN(rif); BUILDIN(countItemColor); +BUILDIN(miscEffect); #endif // EVOL_MAP_SCRIPT -- cgit v1.2.3-70-g09d2