summaryrefslogtreecommitdiff
path: root/src/map/clif.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/clif.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/clif.c')
-rw-r--r--src/map/clif.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index c51e2b0df..4ce9ff3c4 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -11702,6 +11702,57 @@ void clif_parse_Mail_send(int fd, struct map_session_data *sd)
#endif
/*==========================================
+ * CASH/POINT SHOP
+ *==========================================*/
+void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd)
+{
+ int fd,i;
+
+ nullpo_retv(sd);
+ nullpo_retv(nd);
+
+ fd = sd->fd;
+ sd->npc_shopid = nd->bl.id;
+ WFIFOHEAD(fd, 200 * 11 + 12);
+ WFIFOW(fd,0) = 0x287;
+ WFIFOW(fd,2) = 12 + nd->u.shop.count*11;
+ WFIFOL(fd,4) = sd->cashPoints; // Cash Points
+ WFIFOL(fd,8) = sd->kafraPoints; // Kafra Points
+
+ for( i = 0; i < nd->u.shop.count; i++ )
+ {
+ struct item_data* id = itemdb_search(nd->u.shop.shop_item[i].nameid);
+ WFIFOL(fd,12+i*11) = nd->u.shop.shop_item[i].value;
+ WFIFOL(fd,16+i*11) = nd->u.shop.shop_item[i].value; // Discount Prize? Maybe a Discount item
+ WFIFOB(fd,20+i*11) = itemtype(id->type);
+ WFIFOW(fd,21+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid;
+ }
+ WFIFOSET(fd,WFIFOW(fd,2));
+}
+
+void clif_parse_cashshop_buy(int fd, struct map_session_data *sd)
+{
+ int fail = 0, amount, points;
+ short nameid;
+ struct npc_data *nd;
+ nullpo_retv(sd);
+
+ nd = (struct npc_data *)map_id2bl(sd->npc_shopid);
+ nameid = RFIFOW(fd,2);
+ amount = RFIFOW(fd,4);
+ points = RFIFOL(fd,6); // Not Implemented. Should be 0
+
+ fail = npc_cashshop_buy(sd, nameid, amount, points);
+
+ WFIFOHEAD(fd,12);
+ WFIFOW(fd,0) = 0x289;
+ WFIFOL(fd,2) = sd->cashPoints;
+ WFIFOL(fd,6) = sd->kafraPoints;
+ WFIFOW(fd,10) = fail;
+ WFIFOSET(fd,12);
+}
+
+/*==========================================
* Requesting equip of a player
*------------------------------------------*/
void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd)
@@ -12161,6 +12212,7 @@ static int packetdb_readdb(void)
{clif_parse_Mail_winopen,"mailwinopen"},
{clif_parse_Mail_send,"mailsend"},
#endif
+ {clif_parse_cashshop_buy,"cashshopbuy"},
{clif_parse_ViewPlayerEquip,"viewplayerequip"},
{clif_parse_EquipTick,"equiptickbox"},
{NULL,NULL}