diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-10-20 18:29:10 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-10-20 18:29:10 -0300 |
commit | 3216025edc23a371baa596c23288ac3467630282 (patch) | |
tree | b14f43b4cab69031103acbd28f19a1c632116a48 /src/emap | |
parent | 7b7ff83feaef6e5a94889e3dc506f1518733c2ca (diff) | |
download | evol-hercules-3216025edc23a371baa596c23288ac3467630282.tar.gz evol-hercules-3216025edc23a371baa596c23288ac3467630282.tar.bz2 evol-hercules-3216025edc23a371baa596c23288ac3467630282.tar.xz evol-hercules-3216025edc23a371baa596c23288ac3467630282.zip |
Add a function to retrieve EXP tax for a certain guild role,
and another function to retrieve the role title. (I think the role title function
may be used more times, as it makes prettier scripts)
Diffstat (limited to 'src/emap')
-rw-r--r-- | src/emap/init.c | 2 | ||||
-rw-r--r-- | src/emap/script_buildins.c | 48 | ||||
-rw-r--r-- | src/emap/script_buildins.h | 2 |
3 files changed, 52 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c index 0e83b9a..0837489 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -210,6 +210,8 @@ HPExport void plugin_init (void) addScriptCommand("getitemoptionparambyindex", "ii", getItemOptionParamByIndex); addScriptCommand("setitemoptionbyindex", "iii*", setItemOptionByIndex); addScriptCommand("isinstance", "i", isInstance); + addScriptCommand("getguildpostax","ii",getguildpostax); + addScriptCommand("getguildpostitle","ii",getguildpostitle); do_init_langs(); diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index c0a7e1b..a47049a 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -2348,3 +2348,51 @@ BUILDIN(isInstance) script_pushint(st, instance->valid(instance_id) ? 1 : 0); return true; } + + +/*========================================== + * Return the EXP tax for (guild, position) + * -1 if not found + *------------------------------------------*/ +BUILDIN(getguildpostax) +{ + int guild_id, gpos; + struct guild* g; + + guild_id = script_getnum(st,2); + gpos = script_getnum(st,3); + + if( ( g = guild->search(guild_id) ) != NULL ) + { + script_pushint(st,g->position[gpos].exp_mode); + } + else + { + script_pushint(st,-1); + } + return true; +} + + +/*========================================== + * Return the title (guild, position) + * "" if not found + *------------------------------------------*/ +BUILDIN(getguildpostitle) +{ + int guild_id, gpos; + struct guild* g; + + guild_id = script_getnum(st,2); + gpos = script_getnum(st,3); + + if( ( g = guild->search(guild_id) ) != NULL ) + { + script_pushstrcopy(st, g->position[gpos].name); + } + else + { + script_pushstr(st,""); + } + return true; +} diff --git a/src/emap/script_buildins.h b/src/emap/script_buildins.h index fab271e..87d63f8 100644 --- a/src/emap/script_buildins.h +++ b/src/emap/script_buildins.h @@ -99,5 +99,7 @@ BUILDIN(getItemOptionValueByIndex); BUILDIN(getItemOptionParamByIndex); BUILDIN(setItemOptionByIndex); BUILDIN(isInstance); +BUILDIN(getguildpostax); +BUILDIN(getguildpostitle); #endif // EVOL_MAP_SCRIPT_BUILDINS |