diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-01-17 18:04:18 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-01-17 18:05:57 +0300 |
commit | b6ae6ce8496bcfd50b45110da63e1954d4bbec65 (patch) | |
tree | aa443691aa913caa652f4d783b3a013db16e05ef | |
parent | ca394780592681df18d39c914f26e23e51c8dde2 (diff) | |
download | evol-hercules-b6ae6ce8496bcfd50b45110da63e1954d4bbec65.tar.gz evol-hercules-b6ae6ce8496bcfd50b45110da63e1954d4bbec65.tar.bz2 evol-hercules-b6ae6ce8496bcfd50b45110da63e1954d4bbec65.tar.xz evol-hercules-b6ae6ce8496bcfd50b45110da63e1954d4bbec65.zip |
Add script command for show emotes.
Copy from hercules with removing emote id check.
Script command: emotion e[, flag, name]
-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 |