From 14faa4b22f37a7c7b75b3937efd1da71ce1ef5cb Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 19 Oct 2019 22:49:18 -0300 Subject: Add a function to retrieve EXP tax for a certain guild role. There's a prototype (WIP) to retrieve the configured role name. That would allow us in a future to allow guild role name customization --- src/emap/init.c | 2 ++ src/emap/script_buildins.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++ src/emap/script_buildins.h | 2 ++ 3 files changed, 58 insertions(+) diff --git a/src/emap/init.c b/src/emap/init.c index 1d21149..c04b764 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -221,6 +221,8 @@ HPExport void plugin_init (void) addScriptCommand("getguildavg","i",getguildavg); addScriptCommand("getguildexp","i",getguildexp); addScriptCommand("getguildnxp","i",getguildnxp); + addScriptCommand("getguildpostax","ii",getguildpostax); + addScriptCommand("getguildpostitle","ii",getguildpostitle); addScriptCommand("setguildrole","iiiis",setguildrole); addScriptCommand("getguildmember","i?",getguildmember); addScriptCommand("gethomunexp","i",gethomunexp); diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index 89c2aab..23de383 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -2613,6 +2613,60 @@ BUILDIN(getguildnxp) } +/*========================================== + * 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) +{ + ShowError("getguildpostitle is NOT working - Or rather, it is, but with a free error. So DO NOT USE.\n"); + script_pushstr(st,"NotYetImplemented"); + return true; + + int guild_id, gpos; + struct guild* g; + char* pname; + + guild_id = script_getnum(st,2); + gpos = script_getnum(st,3); + + if( ( g = guild->search(guild_id) ) != NULL ) + { + pname=g->position[gpos].name; + script_pushstr(st, pname); + } + else + { + script_pushstr(st,""); + } + return true; +} + + /*========================================== * Change a position for the @guild_id * -1 if not found diff --git a/src/emap/script_buildins.h b/src/emap/script_buildins.h index cca24cd..5abcb68 100644 --- a/src/emap/script_buildins.h +++ b/src/emap/script_buildins.h @@ -108,6 +108,8 @@ BUILDIN(getguildlvl); BUILDIN(getguildavg); BUILDIN(getguildexp); BUILDIN(getguildnxp); +BUILDIN(getguildpostax); +BUILDIN(getguildpostitle); BUILDIN(setguildrole); BUILDIN(getguildmember); BUILDIN(gethomunexp); -- cgit v1.2.3-70-g09d2