summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/constants.conf118
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/script.c47
-rw-r--r--src/map/script.h1
-rw-r--r--src/plugins/constdb2doc.c4
5 files changed, 53 insertions, 119 deletions
diff --git a/db/constants.conf b/db/constants.conf
index ee78cf32e..59cbc431c 100644
--- a/db/constants.conf
+++ b/db/constants.conf
@@ -451,124 +451,6 @@ constants_db: {
cell_chknovending: 12
cell_chknochat: 13
- comment__: "Parameters"
- BaseExp: {
- Value: 1
- Parameter: true
- }
- JobExp: {
- Value: 2
- Parameter: true
- }
- Karma: {
- Value: 3
- Parameter: true
- }
- Manner: {
- Value: 4
- Parameter: true
- }
- Hp: {
- Value: 5
- Parameter: true
- }
- MaxHp: {
- Value: 6
- Parameter: true
- }
- Sp: {
- Value: 7
- Parameter: true
- }
- MaxSp: {
- Value: 8
- Parameter: true
- }
- StatusPoint: {
- Value: 9
- Parameter: true
- }
- BaseLevel: {
- Value: 11
- Parameter: true
- }
- SkillPoint: {
- Value: 12
- Parameter: true
- }
- Class: {
- Value: 19
- Parameter: true
- }
- Zeny: {
- Value: 20
- Parameter: true
- }
- Sex: {
- Value: 21
- Parameter: true
- }
- NextBaseExp: {
- Value: 22
- Parameter: true
- }
- NextJobExp: {
- Value: 23
- Parameter: true
- }
- Weight: {
- Value: 24
- Parameter: true
- }
- MaxWeight: {
- Value: 25
- Parameter: true
- }
- JobLevel: {
- Value: 55
- Parameter: true
- }
- Upper: {
- Value: 56
- Parameter: true
- }
- BaseJob: {
- Value: 119
- Parameter: true
- }
- BaseClass: {
- Value: 120
- Parameter: true
- }
- killerrid: {
- Value: 121
- Parameter: true
- }
- killedrid: {
- Value: 122
- Parameter: true
- }
- SlotChange: {
- Value: 123
- Parameter: true
- }
- CharRename: {
- Value: 124
- Parameter: true
- }
- ModExp: {
- Value: 125
- Parameter: true
- }
- ModDrop: {
- Value: 126
- Parameter: true
- }
- ModDeath: {
- Value: 127
- Parameter: true
- }
-
comment__: "Bonuses / Parameter IDs"
bMaxHP: 6
bMaxSP: 8
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);
diff --git a/src/plugins/constdb2doc.c b/src/plugins/constdb2doc.c
index 1d5f37ad5..cb0b82278 100644
--- a/src/plugins/constdb2doc.c
+++ b/src/plugins/constdb2doc.c
@@ -93,6 +93,10 @@ void constdb2doc_constdb(void)
script->hardcoded_constants();
fprintf(out_fp, "\n");
+ fprintf(out_fp, "## Parameters (source)\n\n");
+ script->load_parameters();
+ fprintf(out_fp, "\n");
+
/* Unlink */
script->set_constant = script_set_constant;
script->constdb_comment = script_constdb_comment;