summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorhemagx <hemagx2@gmail.com>2016-03-09 20:59:10 +0200
committerHaru <haru@dotalux.com>2016-03-11 12:30:26 +0100
commit98c1de6a66535311491899db52dc5aed52d98484 (patch)
tree32374a96daad9c79498c656824cd783115617405 /src/map
parent548a5616f3080cfb260b8cdac7d5d2d168b462ca (diff)
downloadhercules-98c1de6a66535311491899db52dc5aed52d98484.tar.gz
hercules-98c1de6a66535311491899db52dc5aed52d98484.tar.bz2
hercules-98c1de6a66535311491899db52dc5aed52d98484.tar.xz
hercules-98c1de6a66535311491899db52dc5aed52d98484.zip
Hardcore Parameters from constant database to avoid synchronize issues with source
now defining new parameters in the constants.conf database is deprecated and should be defined in source instead
Diffstat (limited to 'src/map')
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/script.c47
-rw-r--r--src/map/script.h1
3 files changed, 49 insertions, 1 deletions
diff --git a/src/map/map.h b/src/map/map.h
index ff7ca2d38..54b0c3575 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -398,7 +398,7 @@ struct flooritem_data {
struct item item_data;
};
-enum status_point_types {
+enum status_point_types { //we better clean up this enum and change it name [Hemagx]
SP_SPEED,SP_BASEEXP,SP_JOBEXP,SP_KARMA,SP_MANNER,SP_HP,SP_MAXHP,SP_SP, // 0-7
SP_MAXSP,SP_STATUSPOINT,SP_0a,SP_BASELEVEL,SP_SKILLPOINT,SP_STR,SP_AGI,SP_VIT, // 8-15
SP_INT,SP_DEX,SP_LUK,SP_CLASS,SP_ZENY,SP_SEX,SP_NEXTBASEEXP,SP_NEXTJOBEXP, // 16-23
diff --git a/src/map/script.c b/src/map/script.c
index 7d5ce7d43..67413669b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2349,6 +2349,8 @@ void read_constdb(void)
} else {
value = libconfig->setting_get_int(t);
}
+ if (is_parameter)
+ ShowWarning("read_constdb: Defining parameters in the constants configuration is deprecated and will no longer be possible in a future version. Parameters should be defined in source. (parameter = '%s')\n", name);
script->set_constant(name, value, is_parameter, is_deprecated);
}
script->constdb_comment(NULL);
@@ -2367,6 +2369,49 @@ void script_constdb_comment(const char *comment)
(void)comment;
}
+void script_load_parameters(void)
+{
+ int i = 0;
+ struct {
+ char *name;
+ enum status_point_types type;
+ } parameters[] = {
+ {"BaseExp", SP_BASEEXP},
+ {"JobExp", SP_JOBEXP},
+ {"Karma", SP_KARMA},
+ {"Manner", SP_MANNER},
+ {"Hp", SP_HP},
+ {"MaxHp", SP_MAXHP},
+ {"Sp", SP_SP},
+ {"MaxSp", SP_MAXSP},
+ {"StatusPoint", SP_STATUSPOINT},
+ {"BaseLevel", SP_BASELEVEL},
+ {"SkillPoint", SP_SKILLPOINT},
+ {"Class", SP_CLASS},
+ {"Zeny", SP_ZENY},
+ {"Sex", SP_SEX},
+ {"NextBaseExp", SP_NEXTBASEEXP},
+ {"NextJobExp", SP_NEXTJOBEXP},
+ {"Weight", SP_WEIGHT},
+ {"MaxWeight", SP_MAXWEIGHT},
+ {"JobLevel", SP_JOBLEVEL},
+ {"Upper", SP_UPPER},
+ {"BaseJob", SP_BASEJOB},
+ {"BaseClass", SP_BASECLASS},
+ {"killerrid", SP_KILLERRID},
+ {"killedrid", SP_KILLEDRID},
+ {"SlotChange", SP_SLOTCHANGE},
+ {"CharRename", SP_CHARRENAME},
+ {"ModExp", SP_MOD_EXP},
+ {"ModDrop", SP_MOD_DROP},
+ {"ModDeath", SP_MOD_DEATH},
+ };
+
+ script->constdb_comment("Parameters");
+ for (i=0; i < ARRAYLENGTH(parameters); ++i)
+ script->set_constant(parameters[i].name, parameters[i].type, true, false);
+ script->constdb_comment(NULL);
+}
// Standard UNIX tab size is 8
#define TAB_SIZE 8
#define update_tabstop(tabstop,chars) \
@@ -5141,6 +5186,7 @@ void do_init_script(bool minimal) {
script->parse_builtin();
script->read_constdb();
+ script->load_parameters();
script->hardcoded_constants();
if (minimal)
@@ -21161,6 +21207,7 @@ void script_defaults(void) {
script->parse_line = parse_line;
script->read_constdb = read_constdb;
script->constdb_comment = script_constdb_comment;
+ script->load_parameters = script_load_parameters;
script->print_line = script_print_line;
script->errorwarning_sub = script_errorwarning_sub;
script->set_reg = set_reg;
diff --git a/src/map/script.h b/src/map/script.h
index 351ccd02a..fffe1fb1c 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -725,6 +725,7 @@ struct script_interface {
const char* (*parse_line) (const char *p);
void (*read_constdb) (void);
void (*constdb_comment) (const char *comment);
+ void (*load_parameters) (void);
const char* (*print_line) (StringBuf *buf, const char *p, const char *mark, int line);
void (*errorwarning_sub) (StringBuf *buf, const char *src, const char *file, int start_line, const char *error_msg, const char *error_pos);
int (*set_reg) (struct script_state *st, struct map_session_data *sd, int64 num, const char *name, const void *value, struct reg_db *ref);