void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { unsigned short limit = RFIFOW(fd, 4), i, j; int kafra_pay = RFIFOL(fd, 6); // [Ryuuzaki] - These are free cash points (strangely #CASH = main cash curreny for us, confusing) /* no idea what data is on 6-10 */ for(i = 0; i < limit; i++) { int qty = RFIFOL(fd, 14 + ( i * 10 )); int id = RFIFOL(fd, 10 + ( i * 10 )); short tab = RFIFOW(fd, 18 + ( i * 10 )); enum CASH_SHOP_BUY_RESULT result = CSBR_UNKNOWN; if( tab < 0 || tab > CASHSHOP_TAB_MAX ) continue; for( j = 0; j < clif->cs.item_count[tab]; j++ ) { if( clif->cs.data[tab][j]->id == id ) break; } if( j < clif->cs.item_count[tab] ) { struct item_data *data; if( (sd->cashPoints+kafra_pay) < (clif->cs.data[tab][j]->price * qty) ) { // [Ryuuzaki] - Add freecash to your cash points (might need a check? client checks if you have enough free cash, better safe than sorry right?) result = CSBR_SHORTTAGE_CASH; } else if ( !( data = itemdb_exists(clif->cs.data[tab][j]->id) ) ) { result = CSBR_UNKONWN_ITEM; } else { struct item item_tmp; int k, get_count; get_count = qty; if (!itemdb_isstackable2(data)) get_count = 1; pc_paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay);// [Ryuuzaki] - Pay cash & kafrapoints for (k = 0; k < qty; k += get_count) { if (!pet_create_egg(sd, data->nameid)) { memset(&item_tmp, 0, sizeof(item_tmp)); item_tmp.nameid = data->nameid; item_tmp.identify = 1; switch (pc_additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) { case 0: result = CSBR_SUCCESS; break; case 1: result = CSBR_EACHITEM_OVERCOUNT; break; case 2: result = CSBR_INVENTORY_WEIGHT; break; case 4: result = CSBR_INVENTORY_ITEMCNT; break; case 5: result = CSBR_EACHITEM_OVERCOUNT; break; case 7: result = CSBR_RUNE_OVERCOUNT; break; } if( result != CSBR_SUCCESS ) pc_getcash(sd, clif->cs.data[tab][j]->price * get_count, kafra_pay); //[Ryuuzaki] - Return also free cash if it failed. } } } } else { result = CSBR_UNKONWN_ITEM; } WFIFOHEAD(fd, 16); WFIFOW(fd, 0) = 0x849; WFIFOL(fd, 2) = id; WFIFOW(fd, 6) = result;/* result */ WFIFOL(fd, 8) = sd->cashPoints;/* current cash point */ WFIFOL(fd, 12) = sd->kafraPoints;/* current kafra points */ WFIFOSET(fd, 16); }}
I thank you for pointing out what the unknown field was (6-10), but now that I know it I don't think we'll be using it (i wouldn't trust the packet/client to tell us the kafra value -- would rather measure it ourselves on the server end)Hi hercules devs, here is the code for working kafra & free cash points.
Hope this will help you out, thanks for the release again.
I added //[Ryuuzaki] with a comment next to it so you can see what exactly i changed.
ooh my bad I didn't think that was what the value was XDThe packet only tells the server what number you've put into the box, we still need the check if the amount is valid, that's what i pointed out^^
yup its in our todo (a new log type for cash shops), if you could provide us with one it'd be even betterI would love to have some sort of log of:
Who bought what, how many, when, previous amount of cash points, new amount.
Guess it would be good to keep track of donators, or maybe see which item is most popular. Maybe i'll code one later.
please fill us a bug reportWhen I buy some items my cash value is changed to 0, I have to close and open the cash button again.
I did indeed forget about your reply, sorry for that. as for it not being yet fixed we share blame on that XD <3 I, because I forgot and you, for you didn't make the bug report which would have made other developers aware of the issue.Forgot to fix ind ?
2013 very unstablehttp://herc.ws/board/topic/289-2013-ragexe-area/Where to get 2012 ragexe for this? )
Oh sorry, I thought there were some 2012 as well.2013 very unstablehttp://herc.ws/board/topic/289-2013-ragexe-area/Where to get 2012 ragexe for this? )
We use essential cookies to make this site work, and optional cookies to enhance your experience.