diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-04-26 09:36:34 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-04-26 09:36:34 -0300 |
commit | 701717b0610e9b6b12cf145408e07081f7b215b0 (patch) | |
tree | e79995c21afe642fc0084787c6580efeaec5480c /src/emap/script_buildins.c | |
parent | 6ccdbae7b9a7d417c428122e8f2bbbdeae9e86c6 (diff) | |
download | evol-hercules-701717b0610e9b6b12cf145408e07081f7b215b0.tar.gz evol-hercules-701717b0610e9b6b12cf145408e07081f7b215b0.tar.bz2 evol-hercules-701717b0610e9b6b12cf145408e07081f7b215b0.tar.xz evol-hercules-701717b0610e9b6b12cf145408e07081f7b215b0.zip |
New builtin script command: aggravate
Does what Provoke and Mass Provoke should do, but 10x better. And 40x more hackish.
Diffstat (limited to 'src/emap/script_buildins.c')
-rw-r--r-- | src/emap/script_buildins.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index f0b06a5..1dce4da 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -18,6 +18,7 @@ #include "map/homunculus.h" #include "map/instance.h" #include "map/mapreg.h" +#include "map/mob.h" #include "map/npc.h" #include "map/pc.h" #include "map/refine.h" @@ -3002,3 +3003,45 @@ BUILDIN(InstanceOwner) return true; } + +// Advanced monster data overrider +// aggravate(guid) +BUILDIN(aggravate) +{ + struct block_list *bl; + struct map_session_data *sd = NULL; + + bl = map->id2bl(script_getnum(st, 2)); + + // We only work with mobs + if (bl == NULL) { + ShowWarning("buildin_aggravate: Error in finding object with given GID %d!\n", script_getnum(st, 2)); + script_pushint(st, -1); + return false; + } + + if (bl->type != BL_MOB) { + ShowWarning("buildin_aggravate: GID %d is not a monster!\n", script_getnum(st, 2)); + script_pushint(st, -1); + return false; + } + + // Player must be attached + sd = script->rid2sd(st); + if (sd == NULL) { + ShowWarning("buildin_aggravate: Ran without player attached!"); + return true; + } + + // Create monster structure + struct mob_data *md = BL_UCAST(BL_MOB, bl); + + // Override the provoke flag + md->state.provoke_flag = sd->status.account_id; + // We could use mob->target() + // But I want aggravate to apply without any checks + // Skipping chase checks + md->target_id = sd->status.account_id; + return true; +} + |