summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2018-04-03 00:04:17 +0200
committerGitHub <noreply@github.com>2018-04-03 00:04:17 +0200
commit237fd6d094d698f22dceccfb87e7957cdcf1af3d (patch)
treef967ad604e6e9ba91cc084fe4336c3dda1487ba9 /src/map/script.c
parent112c34e0e1b92397f0df7eea459fcbac946d340b (diff)
parent1f5fc491881f1a75c261e6c2321c6b92eb2d01bc (diff)
downloadhercules-237fd6d094d698f22dceccfb87e7957cdcf1af3d.tar.gz
hercules-237fd6d094d698f22dceccfb87e7957cdcf1af3d.tar.bz2
hercules-237fd6d094d698f22dceccfb87e7957cdcf1af3d.tar.xz
hercules-237fd6d094d698f22dceccfb87e7957cdcf1af3d.zip
Merge pull request #1965 from dastgir/2018/3-hateffect
Implemented HatEffect
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 45bf076fb..275601dcc 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