summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/script_buildins.c18
-rw-r--r--src/emap/script_buildins.h1
3 files changed, 20 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index 5c5bf27..d351985 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -233,6 +233,7 @@ HPExport void plugin_init (void)
addScriptCommand("homstatus","",homstatus);
addScriptCommand("readparam2","i?",readparam2);
addScriptCommand("npcshopattach","s?",npcshopattach);
+ addScriptCommand("instanceowner", "i", InstanceOwner);
// Overrides
addScriptCommand("debugmes","v*",debugmes);
diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c
index 65ac653..f0b06a5 100644
--- a/src/emap/script_buildins.c
+++ b/src/emap/script_buildins.c
@@ -2984,3 +2984,21 @@ BUILDIN(countitem)
}
+// Returns the Acc. ID of the owner of an instance
+BUILDIN(InstanceOwner)
+{
+ const int instance_id = script_getnum(st, 2);
+
+ // Do instance exists?
+ if (!instance->valid(instance_id)) {
+ script_pushint(st, false);
+ return true;
+ }
+
+ // Note: This does not returns type!
+ // using this against party/guilds instances not advised.
+ // returns 0 if either instance doesn't exists or is global
+ script_pushint(st, (int)instance->list[instance_id].owner_id);
+ return true;
+}
+
diff --git a/src/emap/script_buildins.h b/src/emap/script_buildins.h
index 53907bd..2343b12 100644
--- a/src/emap/script_buildins.h
+++ b/src/emap/script_buildins.h
@@ -118,6 +118,7 @@ BUILDIN(deployhomunculus);
BUILDIN(recallhomunculus);
BUILDIN(homstatus);
BUILDIN(readparam2);
+BUILDIN(InstanceOwner);
// Overrides
BUILDIN(countitem);