summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-04-26 09:36:34 -0300
committerJesusaves <cpntb1@ymail.com>2020-04-26 09:36:34 -0300
commit701717b0610e9b6b12cf145408e07081f7b215b0 (patch)
treee79995c21afe642fc0084787c6580efeaec5480c
parent6ccdbae7b9a7d417c428122e8f2bbbdeae9e86c6 (diff)
downloadevol-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.
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/script_buildins.c43
-rw-r--r--src/emap/script_buildins.h1
3 files changed, 45 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index d351985..60658db 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -234,6 +234,7 @@ HPExport void plugin_init (void)
addScriptCommand("readparam2","i?",readparam2);
addScriptCommand("npcshopattach","s?",npcshopattach);
addScriptCommand("instanceowner", "i", InstanceOwner);
+ addScriptCommand("aggravate", "i", aggravate);
// Overrides
addScriptCommand("debugmes","v*",debugmes);
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;
+}
+
diff --git a/src/emap/script_buildins.h b/src/emap/script_buildins.h
index 2343b12..bf437c2 100644
--- a/src/emap/script_buildins.h
+++ b/src/emap/script_buildins.h
@@ -119,6 +119,7 @@ BUILDIN(recallhomunculus);
BUILDIN(homstatus);
BUILDIN(readparam2);
BUILDIN(InstanceOwner);
+BUILDIN(aggravate);
// Overrides
BUILDIN(countitem);