diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-02-26 03:11:34 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-02-26 03:11:34 -0300 |
commit | 6ccdbae7b9a7d417c428122e8f2bbbdeae9e86c6 (patch) | |
tree | 9cfe51bb3a1e2873765c12a74ce05ea10292abd0 | |
parent | 5e50f368b069132dd76b9e1e37cf2bec4139a3fd (diff) | |
download | evol-hercules-6ccdbae7b9a7d417c428122e8f2bbbdeae9e86c6.tar.gz evol-hercules-6ccdbae7b9a7d417c428122e8f2bbbdeae9e86c6.tar.bz2 evol-hercules-6ccdbae7b9a7d417c428122e8f2bbbdeae9e86c6.tar.xz evol-hercules-6ccdbae7b9a7d417c428122e8f2bbbdeae9e86c6.zip |
New utility function: instanceowner.
Will return the ID of the instance owner. "0" means global instance or invalid.
Party and Guilds share IDs, so be careful when not using account IDs for this.
-rw-r--r-- | src/emap/init.c | 1 | ||||
-rw-r--r-- | src/emap/script_buildins.c | 18 | ||||
-rw-r--r-- | src/emap/script_buildins.h | 1 |
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); |