summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <mekolat@users.noreply.github.com>2017-04-25 20:40:37 -0400
committergumi <mekolat@users.noreply.github.com>2017-05-04 09:47:09 -0400
commitd4f43bca9115ce5e9daa305498f411e3a53c3830 (patch)
treedee6de5cc4f2a9d543f8cc05b6f5a95e55fa0e95
parentb3d381396ad924675459e0b525a614655ad63f3f (diff)
downloadhercules-s20170510.tar.gz
hercules-s20170510.tar.bz2
hercules-s20170510.tar.xz
hercules-s20170510.zip
expose bank vault to the script engines20170510
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/pc.c15
-rw-r--r--src/map/script.c2
3 files changed, 18 insertions, 0 deletions
diff --git a/src/map/map.h b/src/map/map.h
index 8c5372093..d4284b3f7 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -553,6 +553,7 @@ enum status_point_types { //we better clean up this enum and change it name [Hem
SP_MOD_EXP=125,
SP_MOD_DROP=126,
SP_MOD_DEATH=127,
+ SP_BANKVAULT=128,
// Mercenaries
SP_MERCFLEE=165, SP_MERCKILLS=189, SP_MERCFAITH=190,
diff --git a/src/map/pc.c b/src/map/pc.c
index 6da0bf035..51da40668 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -8110,6 +8110,7 @@ int pc_readparam(const struct map_session_data *sd, int type)
case SP_SKILLPOINT: val = sd->status.skill_point; break;
case SP_STATUSPOINT: val = sd->status.status_point; break;
case SP_ZENY: val = sd->status.zeny; break;
+ case SP_BANKVAULT: val = sd->status.bank_vault; break;
case SP_BASELEVEL: val = sd->status.base_level; break;
case SP_JOBLEVEL: val = sd->status.job_level; break;
case SP_CLASS: val = sd->status.class; break;
@@ -8254,6 +8255,7 @@ int pc_readparam(const struct map_session_data *sd, int type)
*------------------------------------------*/
int pc_setparam(struct map_session_data *sd,int type,int val)
{
+ int delta;
nullpo_ret(sd);
switch(type){
@@ -8304,6 +8306,19 @@ int pc_setparam(struct map_session_data *sd,int type,int val)
logs->zeny(sd, LOG_TYPE_SCRIPT, sd, -(sd->status.zeny - cap_value(val, 0, MAX_ZENY)));
sd->status.zeny = cap_value(val, 0, MAX_ZENY);
break;
+ case SP_BANKVAULT:
+ val = cap_value(val, 0, MAX_BANK_ZENY);
+ delta = (val - sd->status.bank_vault);
+ sd->status.bank_vault = val;
+ if (map->save_settings & 256) {
+ chrif->save(sd, 0); // send to char server
+ }
+ if (delta > 0) {
+ clif->bank_deposit(sd, BDA_SUCCESS);
+ } else if (delta < 0) {
+ clif->bank_withdraw(sd, BWA_SUCCESS);
+ }
+ return 1; // the vault uses a different packet
case SP_BASEEXP:
if(pc->nextbaseexp(sd) > 0) {
sd->status.base_exp = val;
diff --git a/src/map/script.c b/src/map/script.c
index 677cd0ce1..4c4c4ca80 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2384,6 +2384,7 @@ void script_load_parameters(void)
{"SkillPoint", SP_SKILLPOINT},
{"Class", SP_CLASS},
{"Zeny", SP_ZENY},
+ {"BankVault", SP_BANKVAULT},
{"Sex", SP_SEX},
{"NextBaseExp", SP_NEXTBASEEXP},
{"NextJobExp", SP_NEXTJOBEXP},
@@ -23759,6 +23760,7 @@ void script_hardcoded_constants(void)
script->set_constant("MAX_CART",MAX_INVENTORY,false, false);
script->set_constant("MAX_INVENTORY",MAX_INVENTORY,false, false);
script->set_constant("MAX_ZENY",MAX_ZENY,false, false);
+ script->set_constant("MAX_BANK_ZENY", MAX_BANK_ZENY, false, false);
script->set_constant("MAX_BG_MEMBERS",MAX_BG_MEMBERS,false, false);
script->set_constant("MAX_CHAT_USERS",MAX_CHAT_USERS,false, false);
script->set_constant("MAX_REFINE",MAX_REFINE,false, false);