summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaruna <haru@dotalux.com>2014-11-15 17:33:46 +0100
committerHaruna <haru@dotalux.com>2014-11-15 17:33:46 +0100
commit27cd926dd2f41e008da738e8d9259cd0c33a2f77 (patch)
treefc62c34bea003f6d5839996474485d51ddf98ad6 /src
parent47565d423f40f4fbbbb032dcc6fa2f6670bfafab (diff)
parent35d190c1927d4405507490ac1a34c3e324d47762 (diff)
downloadhercules-27cd926dd2f41e008da738e8d9259cd0c33a2f77.tar.gz
hercules-27cd926dd2f41e008da738e8d9259cd0c33a2f77.tar.bz2
hercules-27cd926dd2f41e008da738e8d9259cd0c33a2f77.tar.xz
hercules-27cd926dd2f41e008da738e8d9259cd0c33a2f77.zip
Merge pull request #389 from 4144/confplugins
Add support for plugin parameters in different config files (before was only battle config)
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c5
-rw-r--r--src/common/HPMi.h20
-rw-r--r--src/login/login.c3
-rw-r--r--src/map/log.c3
-rw-r--r--src/map/map.c2
-rw-r--r--src/map/script.c5
6 files changed, 34 insertions, 4 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 0dd7aaa79..d358a02e8 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -5604,10 +5604,11 @@ void char_sql_config_read(const char* cfgName)
safestrncpy(acc_reg_str_db, w2, sizeof(acc_reg_str_db));
else if(!strcmpi(w1,"acc_reg_num_db"))
safestrncpy(acc_reg_num_db, w2, sizeof(acc_reg_num_db));
-
//support the import command, just like any other config
else if(!strcmpi(w1,"import"))
chr->sql_config_read(w2);
+ else
+ HPM->parseConf(w1, w2, HPCT_CHAR_INTER);
}
fclose(fp);
ShowInfo("Done reading %s.\n", cfgName);
@@ -5623,6 +5624,8 @@ void char_config_dispatch(char *w1, char *w2) {
if( (*dispatch_to[i])(w1,w2) )
break;/* we found who this belongs to, can stop */
}
+ if (i == len)
+ HPM->parseConf(w1, w2, HPCT_CHAR);
}
int char_config_read(const char* cfgName)
diff --git a/src/common/HPMi.h b/src/common/HPMi.h
index a7435b437..0f2bed10d 100644
--- a/src/common/HPMi.h
+++ b/src/common/HPMi.h
@@ -84,7 +84,13 @@ enum HPluginDataTypes {
/* used in macros and conf storage */
enum HPluginConfType {
- HPCT_BATTLE, /* battle-conf (map-server */
+ HPCT_BATTLE, /* battle-conf (map-server */
+ HPCT_LOGIN, /* login-server.conf (login-server) */
+ HPCT_CHAR, /* char-server.conf (char-server) */
+ HPCT_CHAR_INTER, /* inter-server.conf (char-server) */
+ HPCT_MAP_INTER, /* inter-server.conf (map-server) */
+ HPCT_LOG, /* logs.conf (map-server) */
+ HPCT_SCRIPT, /* script.conf (map-server) */
HPCT_MAX,
};
@@ -157,6 +163,18 @@ enum HPluginConfType {
#define addPacket(cmd,len,receive,point) HPMi->addPacket(cmd,len,receive,point,HPMi->pid)
/* HPMi->addBattleConf */
#define addBattleConf(bcname,funcname) HPMi->addConf(HPMi->pid,HPCT_BATTLE,bcname,funcname)
+/* HPMi->addLogin */
+#define addLoginConf(bcname,funcname) HPMi->addConf(HPMi->pid,HPCT_LOGIN,bcname,funcname)
+/* HPMi->addChar */
+#define addCharConf(bcname,funcname) HPMi->addConf(HPMi->pid,HPCT_CHAR,bcname,funcname)
+/* HPMi->addCharInter */
+#define addCharInterConf(bcname,funcname) HPMi->addConf(HPMi->pid,HPCT_CHAR_INTER,bcname,funcname)
+/* HPMi->addMapInter */
+#define addMapInterConf(bcname,funcname) HPMi->addConf(HPMi->pid,HPCT_MAP_INTER,bcname,funcname)
+/* HPMi->addLog */
+#define addLogConf(bcname,funcname) HPMi->addConf(HPMi->pid,HPCT_LOG,bcname,funcname)
+/* HPMi->addScript */
+#define addScriptConf(bcname,funcname) HPMi->addConf(HPMi->pid,HPCT_SCRIPT,bcname,funcname)
/* HPMi->addPCGPermission */
#define addGroupPermission(pcgname,maskptr) HPMi->addPCGPermission(HPMi->pid,pcgname,&maskptr)
diff --git a/src/login/login.c b/src/login/login.c
index b9de09fcd..2a322ba40 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -1843,10 +1843,11 @@ int login_config_read(const char* cfgName)
else
{
AccountDB* db = account_engine[0].db;
- if( db )
+ if (db)
db->set_property(db, w1, w2);
ipban_config_read(w1, w2);
loginlog_config_read(w1, w2);
+ HPM->parseConf(w1, w2, HPCT_LOGIN);
}
}
fclose(fp);
diff --git a/src/map/log.c b/src/map/log.c
index 3efcd09df..f0fd6795c 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -20,6 +20,7 @@
#include "../common/showmsg.h"
#include "../common/sql.h" // SQL_INNODB
#include "../common/strlib.h"
+#include "../common/HPM.h"
struct log_interface log_s;
@@ -453,6 +454,8 @@ int log_config_read(const char* cfgName) {
//support the import command, just like any other config
else if( strcmpi(w1,"import") == 0 )
logs->config_read(w2);
+ else if (HPM->parseConf(w1, w2, HPCT_LOG))
+ ; // handled by plugins
else
ShowWarning("Unknown setting '%s' in file %s\n", w1, cfgName);
}
diff --git a/src/map/map.c b/src/map/map.c
index 5c0f5d65e..9e2727b07 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3780,6 +3780,8 @@ int inter_config_read(char *cfgName) {
/* import */
else if(strcmpi(w1,"import")==0)
map->inter_config_read(w2);
+ else
+ HPM->parseConf(w1, w2, HPCT_MAP_INTER);
}
fclose(fp);
diff --git a/src/map/script.c b/src/map/script.c
index 56bccbdec..aa90a5b1c 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -55,6 +55,7 @@
#include "../common/sysinfo.h"
#include "../common/timer.h"
#include "../common/utils.h"
+#include "../common/HPM.h"
#ifndef WIN32
#include <sys/time.h>
@@ -4141,7 +4142,9 @@ int script_config_read(char *cfgName) {
else if(strcmpi(w1,"import")==0) {
script->config_read(w2);
}
- else {
+ else if(HPM->parseConf(w1, w2, HPCT_SCRIPT)) {
+ ; // handled by plugin
+ } else {
ShowWarning("Unknown setting '%s' in file %s\n", w1, cfgName);
}
}