summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsketchyphoenix <sketchyphoenix@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-06-18 10:39:20 +0000
committersketchyphoenix <sketchyphoenix@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-06-18 10:39:20 +0000
commitab859094455fd375d0cb42523b13cf8367315be1 (patch)
tree684a6f660c9499bce38aff4ea3abcf468d4eb48f /src
parent16d5b76a69ea16dce3460dcf3fc6d196bb628163 (diff)
downloadhercules-ab859094455fd375d0cb42523b13cf8367315be1.tar.gz
hercules-ab859094455fd375d0cb42523b13cf8367315be1.tar.bz2
hercules-ab859094455fd375d0cb42523b13cf8367315be1.tar.xz
hercules-ab859094455fd375d0cb42523b13cf8367315be1.zip
Fixed cash shop not using points to make up the cash difference when purchasing an item.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12853 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/npc.c4
-rw-r--r--src/map/pc.c19
2 files changed, 5 insertions, 18 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 1a888cd24..52adadf29 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1091,9 +1091,7 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po
if( points > price )
points = price;
- if( sd->cashPoints < price - points )
- return 6;
- if( sd->kafraPoints < points )
+ if( (sd->kafraPoints < points) || (sd->cashPoints < price - points) )
return 6;
pc_paycash(sd, price, points);
diff --git a/src/map/pc.c b/src/map/pc.c
index 643863ea6..2b2ef3a83 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2816,21 +2816,10 @@ void pc_paycash(struct map_session_data *sd, int price, int points)
int cash = price - points;
nullpo_retv(sd);
- if( cash > 0 )
- {
- pc_setaccountreg(sd,"#CASHPOINTS",sd->cashPoints - cash);
-
- sprintf(output, "Used %d cash points. %d points remaining.", cash, sd->cashPoints);
- clif_disp_onlyself(sd, output, strlen(output));
- }
-
- if( points > 0 )
- {
- pc_setaccountreg(sd,"#KAFRAPOINTS",sd->kafraPoints - points);
-
- sprintf(output, "Used %d kafra points. %d points remaining.", points, sd->kafraPoints);
- clif_disp_onlyself(sd, output, strlen(output));
- }
+ pc_setaccountreg(sd,"#CASHPOINTS",sd->cashPoints - cash);
+ pc_setaccountreg(sd,"#KAFRAPOINTS",sd->kafraPoints - points);
+ sprintf(output, "Used %d kafra points and %d cash points. %d kafra and %d cash points remaining.", points, cash, sd->kafraPoints, sd->cashPoints);
+ clif_disp_onlyself(sd, output, strlen(output));
}
void pc_getcash(struct map_session_data *sd, int cash, int points)