diff options
author | Jesusaves <cpntb1@ymail.com> | 2022-05-06 22:40:10 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2022-05-06 22:40:10 -0300 |
commit | dd18ef8db4336b323ed8d77c315a76829c2e7ce9 (patch) | |
tree | 2d46d6a7b41f6c9e077ca28a194fcae11e4164e5 | |
parent | 6af862b9b807afec3c55ecd9f57db218717faf68 (diff) | |
download | evol-hercules-dd18ef8db4336b323ed8d77c315a76829c2e7ce9.tar.gz evol-hercules-dd18ef8db4336b323ed8d77c315a76829c2e7ce9.tar.bz2 evol-hercules-dd18ef8db4336b323ed8d77c315a76829c2e7ce9.tar.xz evol-hercules-dd18ef8db4336b323ed8d77c315a76829c2e7ce9.zip |
Add support to make API updates with PYTHON_LOGS if set.
-rw-r--r-- | src/emap/init.c | 1 | ||||
-rw-r--r-- | src/emap/script_buildins.c | 23 | ||||
-rw-r--r-- | src/emap/script_buildins.h | 1 |
3 files changed, 25 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c index af4c22e..834f3ae 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -245,6 +245,7 @@ HPExport void plugin_init (void) addScriptCommand("getskillname", "i", getskillname); addScriptCommand("bgnew", "siiss", bgnew); addScriptCommand("bgjoin", "isii?", bgjoin); + addScriptCommand("apicall", "is", apicall); // Overrides addScriptCommand("debugmes","v*",debugmes); diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index dd8666b..5c91301 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -23,6 +23,9 @@ #include "map/guild.h" #include "map/homunculus.h" #include "map/instance.h" +#ifdef PYTHON_LOGS +#include "map/log.h" +#endif #include "map/mapreg.h" #include "map/mob.h" #include "map/npc.h" @@ -3593,6 +3596,26 @@ BUILDIN(bgjoin) return true; } + +/*========================================== + * Sends something over PyLog + *------------------------------------------*/ +BUILDIN(apicall) +{ +#ifdef PYTHON_LOGS + char bf1[1024], bf3[2048], bf4[16]; + sprintf(bf1,"SQL→INSERT INTO `api_export` (`type`, `data`) VALUES ('%d', '?1')", script_getnum(st, 2)); + logs->pylog(bf1); + sprintf(bf3, "SAD1→%s", script_getstr(st, 3)); + logs->pylog(bf3); + sprintf(bf4, "SQLRUN→"); + logs->pylog(bf4); + script_pushint(st, 1); +#else + script_pushint(st, 0); +#endif + return true; +} ////////////////////////////////////////////////////////// /* switch (bl->type) { diff --git a/src/emap/script_buildins.h b/src/emap/script_buildins.h index 3253da3..957bd2b 100644 --- a/src/emap/script_buildins.h +++ b/src/emap/script_buildins.h @@ -129,6 +129,7 @@ BUILDIN(resetrng); BUILDIN(getskillname); BUILDIN(bgnew); BUILDIN(bgjoin); +BUILDIN(apicall); // Overrides BUILDIN(countitem); |