db/const.txt | 5 +++++
src/map/map.h | 2 ++
src/map/pc.c | 5 +++++
src/map/script.c | 23 ++++++++++++++++++-----
4 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/db/const.txt b/db/const.txt
index 3f0fbdb..6acaa1a 100644
--- a/db/const.txt
+++ b/db/const.txt
@@ -415,6 +415,8 @@ CharRename 124 1
ModExp 125 1
ModDrop 126 1
ModDeath 127 1
+BankVault 128 1
+MaxStatus 129 1
bMaxHP 6
bMaxSP 8
@@ -3523,3 +3525,6 @@ SEPTEMBER 9
OCTOBER 10
NOVEMBER 11
DECEMBER 12
+
+abcd 1234
+abcde 4321 1
\ No newline at end of file
diff --git a/src/map/map.h b/src/map/map.h
index 974fbc4..0e919e9 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -381,6 +381,8 @@ enum status_point_types {
SP_MOD_EXP=125,
SP_MOD_DROP=126,
SP_MOD_DEATH=127,
+ SP_BANK_VAULT=128,
+ SP_MAXSTATUS=129,
// Mercenaries
SP_MERCFLEE=165, SP_MERCKILLS=189, SP_MERCFAITH=190,
diff --git a/src/map/pc.c b/src/map/pc.c
index 43adf33..5e4debf 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -7995,6 +7995,8 @@ int pc_readparam(struct map_session_data* sd,int type)
case SP_MOD_EXP: val = sd->status.mod_exp; break;
case SP_MOD_DROP: val = sd->status.mod_drop; break;
case SP_MOD_DEATH: val = sd->status.mod_death; break;
+ case SP_BANK_VAULT: val = sd->status.bank_vault; break;
+ case SP_MAXSTATUS: val = pc_maxparameter(sd); break;
case SP_CRITICAL: val = sd->battle_status.cri/10; break;
case SP_ASPD: val = (2000-sd->battle_status.amotion)/10; break;
case SP_BASE_ATK: val = sd->battle_status.batk; break;
@@ -8096,6 +8098,9 @@ int pc_readparam(struct map_session_data* sd,int type)
case SP_VARCASTRATE: val = sd->bonus.varcastrate; break;
case SP_ADD_VARIABLECAST:val = sd->bonus.add_varcast; break;
#endif
+ default:
+ ShowError("pc_readparam: Attempt to read unknown parameter '%d'.\n", type);
+ return -1;
}
return val;
diff --git a/src/map/script.c b/src/map/script.c
index cfc7ed0..ccffdf3 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2223,6 +2223,7 @@ void script_set_constant(const char* name, int value, bool isparameter) {
if( script->str_data[n].type == C_NOP ) {// new
script->str_data[n].type = isparameter ? C_PARAM : C_INT;
script->str_data[n].val = value;
+ ShowDebug("%d %d %d\n",isparameter, value, script->str_data[n].type);
} else if( script->str_data[n].type == C_PARAM || script->str_data[n].type == C_INT ) {// existing parameter or constant
ShowError("script_set_constant: Attempted to overwrite existing %s '%s' (old value=%d, new value=%d).\n", ( script->str_data[n].type == C_PARAM ) ? "parameter" : "constant", name, script->str_data[n].val, value);
} else {// existing name
@@ -2279,6 +2280,7 @@ void read_constdb(void) {
type = 0;
if (sscanf(line, "%1023[A-Za-z0-9_],%1023[-0-9xXA-Fa-f],%d", name, val, &type) >=2
|| sscanf(line, "%1023[A-Za-z0-9_] %1023[-0-9xXA-Fa-f] %d", name, val, &type) >=2
+ || sscanf(line, "%1023[A-Za-z0-9_] %1023[-0-9xXA-Fa-f] %d", name, val, &type) >=2
) {
script->set_constant(name, (int)strtol(val, NULL, 0), (bool)type);
}
@@ -7705,19 +7707,30 @@ BUILDIN(disableitemuse)
*------------------------------------------*/
BUILDIN(readparam) {
int type;
+ struct script_data *data = script_getdata(st,2);
TBL_PC *sd;
- type=script_getnum(st,2);
- if( script_hasdata(st,3) )
- sd=map->nick2sd(script_getstr(st,3));
+ type = script_getnum(st,2);
+ if (script_hasdata(st,3)) {
+ if (script_isstringtype(st,3))
+ sd = map->nick2sd(script_getstr(st,3));
+ else
+ sd = map->id2sd(script_getnum(st,3));
+ }
else
- sd=script->rid2sd(st);
+ sd = script->rid2sd(st);
- if(sd==NULL) {
+ if (sd == NULL) {
script_pushint(st,-1);
return true;
}
+ ShowDebug( "%d %d %d %d %d %d\n", type, data->type, C_INT, C_PARAM, reference_toparam(data), reference_toconstant(data));
+ if (data->type == C_INT && !reference_toconstant(data)) {
+ script_pushint(st, (int)data->u.num);
+ return true;
+ }
+
script_pushint(st,pc->readparam(sd,type));
return true;