diff options
author | Dastgir <dastgirp@gmail.com> | 2018-02-07 13:46:54 +0530 |
---|---|---|
committer | Dastgir <dastgirp@gmail.com> | 2018-02-09 21:54:42 +0530 |
commit | 132cc722fa490310b6e08a5cfe17625c8cf8baf1 (patch) | |
tree | 99f960c62aeca1233850dfa4e38f164e75ff2a69 /src/map/script.c | |
parent | 19c94017a31d86f7848085162ffb741770975128 (diff) | |
download | hercules-132cc722fa490310b6e08a5cfe17625c8cf8baf1.tar.gz hercules-132cc722fa490310b6e08a5cfe17625c8cf8baf1.tar.bz2 hercules-132cc722fa490310b6e08a5cfe17625c8cf8baf1.tar.xz hercules-132cc722fa490310b6e08a5cfe17625c8cf8baf1.zip |
Implemented hatEffect.
Allows the player to have hatEffect specialeffects.
Base taken from rAthena
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c index 36f37abb9..58083a3a2 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -23965,6 +23965,42 @@ BUILDIN(clan_master) } /** + * hateffect(EffectID, Enable_State) + */ +BUILDIN(hateffect) +{ +#if PACKETVER >= 20150422 + struct map_session_data *sd = script_rid2sd(st); + int effectId, enabled = 0; + int i; + + if (sd == NULL) + return false; + + effectId = script_getnum(st, 2); + enabled = script_getnum(st, 3); + + for (i = 0; i < VECTOR_LENGTH(sd->hatEffectId); ++i) { + if (VECTOR_INDEX(sd->hatEffectId, i) == effectId) { + if (enabled == 1) { // Already Enabled + return true; + } else { // Remove + VECTOR_ERASE(sd->hatEffectId, i); + clif->hat_effect_single(&sd->bl, effectId, enabled); + return true; + } + } + } + + VECTOR_ENSURE(sd->hatEffectId, 1, 1); + VECTOR_PUSH(sd->hatEffectId, effectId); + + clif->hat_effect_single(&sd->bl, effectId, enabled); +#endif + return true; +} + +/** * Adds a built-in script function. * * @param buildin Script function data @@ -24679,6 +24715,9 @@ void script_parse_builtin(void) { BUILDIN_DEF2(rodex_sendmail2, "rodex_sendmail_acc2", "isss?????????????????????????????????????????"), BUILDIN_DEF(_,"s"), BUILDIN_DEF2(_, "_$", "s"), + + // -- HatEffect + BUILDIN_DEF(hateffect, "ii"), }; int i, len = ARRAYLENGTH(BUILDIN); RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up |