summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-28 22:25:58 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-28 22:25:58 +0000
commitf3edaa82a300e9d397337b8f815c7903c239497b (patch)
treeefbdc7106203ac69f5fd6e02ef8c0fb39010c582 /src/map/pc.c
parent4099749d598460b1614d1e94dfd6e951a9649955 (diff)
downloadhercules-f3edaa82a300e9d397337b8f815c7903c239497b.tar.gz
hercules-f3edaa82a300e9d397337b8f815c7903c239497b.tar.bz2
hercules-f3edaa82a300e9d397337b8f815c7903c239497b.tar.xz
hercules-f3edaa82a300e9d397337b8f815c7903c239497b.zip
- Added cash shop support. (i need to add documentation, working on it).
- An charcommand is still required to add/remove points. - Scripts command only requires to work on #CASHPOINTS and #KAFRAPOINTS. - I called it "Kafra Points" just because it's how comes in the translation. I allready know this changes between Oficial servers. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12264 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 0dbc8c076..551fa9c55 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -792,6 +792,10 @@ int pc_reg_received(struct map_session_data *sd)
sd->change_level = pc_readglobalreg(sd,"jobchange_level");
sd->die_counter = pc_readglobalreg(sd,"PC_DIE_COUNTER");
+ // Cash shop
+ sd->cashPoints = pc_readaccountreg(sd,"#CASHPOINTS");
+ sd->kafraPoints = pc_readaccountreg(sd,"#KAFRAPOINTS");
+
if ((sd->class_&MAPID_BASEMASK)==MAPID_TAEKWON)
{ //Better check for class rather than skill to prevent "skill resets" from unsetting this
sd->mission_mobid = pc_readglobalreg(sd,"TK_MISSION_ID");
@@ -2694,6 +2698,65 @@ int pc_payzeny(struct map_session_data *sd,int zeny)
return 0;
}
+/*==========================================
+ * Cash Shop
+ *------------------------------------------*/
+
+void pc_paycash(struct map_session_data *sd, int prize, int points)
+{
+ char output[128];
+ int cash = prize - points;
+ nullpo_retv(sd);
+
+ sd->cashPoints -= cash;
+ sd->kafraPoints -= points;
+
+ pc_setaccountreg(sd,"#CASHPOINTS",sd->cashPoints);
+ pc_setaccountreg(sd,"#KAFRAPOINTS",sd->kafraPoints);
+
+ if( points )
+ {
+ sprintf(output, "Used %d kafra points. %d points remaining.", points, sd->kafraPoints);
+ clif_disp_onlyself(sd, output, strlen(output));
+ }
+
+ if( cash )
+ {
+ sprintf(output, "Used %d cash points. %d points remaining.", cash, sd->cashPoints);
+ clif_disp_onlyself(sd, output, strlen(output));
+ }
+}
+
+void pc_getcash(struct map_session_data *sd, int cash, int points)
+{
+ char output[128];
+ nullpo_retv(sd);
+
+ if( cash > MAX_ZENY - sd->cashPoints )
+ cash = MAX_ZENY - sd->cashPoints;
+
+ sd->cashPoints += cash;
+
+ if( points > MAX_ZENY - sd->kafraPoints )
+ points = MAX_ZENY - sd->kafraPoints;
+
+ sd->kafraPoints += points;
+
+ pc_setaccountreg(sd,"#CASHPOINTS",sd->cashPoints);
+ pc_setaccountreg(sd,"#KAFRAPOINTS",sd->kafraPoints);
+
+ if( cash > 0 )
+ {
+ sprintf(output, "Gained %d cash points. Total %d points", points, sd->cashPoints);
+ clif_disp_onlyself(sd, output, strlen(output));
+ }
+
+ if( points > 0 )
+ {
+ sprintf(output, "Gained %d kafra points. Total %d points", points, sd->kafraPoints);
+ clif_disp_onlyself(sd, output, strlen(output));
+ }
+}
/*==========================================
* お金を得る