summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2017-05-04 10:40:21 +0200
committerGitHub <noreply@github.com>2017-05-04 10:40:21 +0200
commit1e46267cac131fa0e829886b9ccd534522ab0ddb (patch)
tree04eab25f64a566dec905afb7de1a8b112c95c225 /src/map/pc.c
parentff8429634673855a1dc6e2924d4534aec8de6507 (diff)
parentaa1c480aa0140098ae32958bbf165c2829d2f9bf (diff)
downloadhercules-1e46267cac131fa0e829886b9ccd534522ab0ddb.tar.gz
hercules-1e46267cac131fa0e829886b9ccd534522ab0ddb.tar.bz2
hercules-1e46267cac131fa0e829886b9ccd534522ab0ddb.tar.xz
hercules-1e46267cac131fa0e829886b9ccd534522ab0ddb.zip
Merge pull request #1717 from mekolat/vault2
expose the bank vault to the script engine
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 724b48c03..c1339b0de 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -8134,6 +8134,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;
@@ -8278,6 +8279,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){
@@ -8328,6 +8330,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;