diff options
Diffstat (limited to 'src/emap')
-rw-r--r-- | src/emap/init.c | 1 | ||||
-rw-r--r-- | src/emap/script.c | 37 | ||||
-rw-r--r-- | src/emap/script.h | 1 |
3 files changed, 39 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c index 558bf48..f9070b1 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -144,6 +144,7 @@ HPExport void plugin_init (void) addScriptCommand("delcells", "s", delCells); addScriptCommand("setmount", "i", setMount); addScriptCommand("setskin", "s", setSkin); + addScriptCommand("emotion", "i??", emotion); do_init_langs(); do_init_craft(); diff --git a/src/emap/script.c b/src/emap/script.c index c2099fa..6ee42df 100644 --- a/src/emap/script.c +++ b/src/emap/script.c @@ -2031,3 +2031,40 @@ BUILDIN(getInvIndexLink) return true; } + +/*========================================== + * Shows an emoticon on top of the player/npc + * emotion emotion#, <target: 0 - NPC, 1 - PC>, <NPC/PC name> + *------------------------------------------*/ +//Optional second parameter added by [Skotlex] +BUILDIN(emotion) +{ + int player = 0; + + int type = script_getnum(st, 2); + + if (script_hasdata(st, 3)) + player = script_getnum(st, 3); + + if (player != 0) + { + struct map_session_data *sd = NULL; + if (script_hasdata(st, 4)) + sd = script->nick2sd(st, script_getstr(st, 4)); + else + sd = script->rid2sd(st); + if (sd != NULL) + clif->emotion(&sd->bl, type); + } + else if (script_hasdata(st, 4)) + { + struct npc_data *nd = npc->name2id(script_getstr(st, 4)); + if (nd == NULL) + clif->emotion(&nd->bl,type); + } + else + { + clif->emotion(map->id2bl(st->oid), type); + } + return true; +} diff --git a/src/emap/script.h b/src/emap/script.h index be6324a..41164d2 100644 --- a/src/emap/script.h +++ b/src/emap/script.h @@ -72,5 +72,6 @@ BUILDIN(getCraftSlotId); BUILDIN(getCraftSlotAmount); BUILDIN(validateCraft); BUILDIN(getInvIndexLink); +BUILDIN(emotion); #endif // EVOL_MAP_SCRIPT |