Ind 945 Posted April 9, 2013 (edited) Cash Shop SupportHello~! - What?! 1st, getting this together has only been possible thanks to Yommy 2nd, really, without Yommy's help this wouldn't have worked 3rd, did I already mention Yommy made this possible? screenHercules006.jpg cashshop_db.conf format //==================================================== //= _ _ _ //= | | | | | | //= | |_| | ___ _ __ ___ _ _| | ___ ___ //= | _ |/ _ \ '__/ __| | | | |/ _ \/ __| //= | | | | __/ | | (__| |_| | | __/\__ \ //= \_| |_/\___|_| \___|\__,_|_|\___||___/ //= //= http://herc.ws/board/ //==================================================== //= http://herc.ws/board/topic/367-introducing-cash-shop-support/ cash_shop: ( { cat_0: { //New Apple:100 ID531:250 } cat_1: { //Popular ID513:100 Banana_Juice:250 } cat_2: { //Limited Grape:100 ID533:250 } cat_3: { //Rental ID515:100 Carrot_Juice:250 } cat_4: { //Permanent Green_Herb:100 ID510:250 } cat_5: { //Scroll ID501:100 ID502:250 } cat_6: { //Usable White_Potion:150 Blue_Potion:500 } cat_7: { //Other ID909:400 ID907:500 } } ) Is it ready?! The packets work, you can buy, list, etc. BUUUUT I wouldn't bet it is 100% complete -- I'm not very aware of how the cashpoint stuff works, I'd guess the behavior is not 100% -- BUUUT getting the packets to work was the toughest part, just drop us a bug report and we sure will fix any broken formulas instantly. I'm not aware of what the official servers have in it being sold either, I've put random garbage with absurdly high prices in the db (so we all can debug). BTW This only works on ragexe (not ragexere!) clients, e.g. : http://herc.ws/board/topic/289-2013-ragexe-area/ Special Thanks Yommy Yommy ...Yommy! malufett Judas Beret kLabMouse And everyone whos helped us get the 2013 client to work, Thank you All! to Beret and Yommy for the new file format suggestion! Links~! Commit cashshop_db.conf file Edited February 7, 2017 by Ridley 10 EriNa_KillerSoul, JulioCF, mkbu95 and 7 others reacted to this Quote Share this post Link to post Share on other sites
Judas 100 Posted April 9, 2013 woohoooo thank you Ind, and all those contributed, and Yommy too!! Quote Share this post Link to post Share on other sites
Napster 5 Posted April 9, 2013 @Ind if posible command for reload shop for test Quote Share this post Link to post Share on other sites
Beret 50 Posted April 9, 2013 (edited) Thanks ind knew that you were able to. I have a suggestion couldn't use a conf file example. New: ({ /* new itens cash shop */ New_itens: { Item_name1 Item_name2 Item_name3 Item_name4 Item_name5 } Edited April 9, 2013 by Beret Quote Share this post Link to post Share on other sites
Guest unleashed Posted April 9, 2013 Oh man this is too good to be true! Awesome work Ind and special thanks to Yommy for releasing it! Quote Share this post Link to post Share on other sites
Ryuuzaki 9 Posted April 9, 2013 good job, finally made me switching my heavily customized ra to hercules xD the pain of applying every change i made >.< Quote Share this post Link to post Share on other sites
Mystery 594 Posted April 9, 2013 Thanks ind knew that you were able to. I have a suggestion couldn't use a conf file example. New: ({ /* new itens cash shop */ New_itens: { Item_name1 Item_name2 Item_name3 Item_name4 Item_name5 } whats wrong with the one we have now? o_O The file will have less lines and is less crowded. With this new one, you're just crowding the file with un-needed lines and space. Quote Share this post Link to post Share on other sites
Beret 50 Posted April 9, 2013 Thanks ind knew that you were able to. I have a suggestion couldn't use a conf file example. New: ({ /* new itens cash shop */ New_itens: { Item_name1 Item_name2 Item_name3 Item_name4 Item_name5 } whats wrong with the one we have now? o_O The file will have less lines and is less crowded. With this new one, you're just crowding the file with un-needed lines and space. Only a segment of the aegis. t_shop_type={ SIMPLE_CASH_NEW = 0, SIMPLE_CASH_POPULAR = 1, SIMPLE_CASH_LIMITED = 2, SIMPLE_CASH_RENTAL = 3, SIMPLE_CASH_PERPETUITY = 4, SIMPLE_CASH_BUFF = 5, SIMPLE_CASH_RECOVERY = 6, SIMPLE_CASH_ETC = 7,};t_item_price ={ {t_shop_type.SIMPLE_CASH_NEW, "Boarding_Halter_Box",39}, {t_shop_type.SIMPLE_CASH_POPULAR, "Boarding_Halter_Box",39}, {t_shop_type.SIMPLE_CASH_LIMITED, "Token_Of_Siegfried_Box",25}, {t_shop_type.SIMPLE_CASH_RENTAL, "Boarding_Halter_Box",39}, {t_shop_type.SIMPLE_CASH_PERPETUITY, "Leaf_Cat_Box",159}, {t_shop_type.SIMPLE_CASH_BUFF, "Str_Dish_Box",10}, {t_shop_type.SIMPLE_CASH_BUFF, "Agi_Dish_Box",10}, {t_shop_type.SIMPLE_CASH_BUFF, "Int_Dish_Box",10}, {t_shop_type.SIMPLE_CASH_BUFF, "Dex_Dish_Box",10}, {t_shop_type.SIMPLE_CASH_BUFF, "Luk_Dish_Box",10}, {t_shop_type.SIMPLE_CASH_BUFF, "Vit_Dish_Box",10}, {t_shop_type.SIMPLE_CASH_RECOVERY, "Small_Life_Potion_Box50",129}, {t_shop_type.SIMPLE_CASH_ETC, "Enriched_Elunium_Box",15}, {t_shop_type.SIMPLE_CASH_ETC, "Enriched_Oridecon_Box",15},}; Quote Share this post Link to post Share on other sites
Arzzae 0 Posted April 9, 2013 I think the text format should be enough. Another suggestion, @reloadshopdb or w/e reload name for simplier reload of the cash shop feature. Also, thanks for the update! I'm also glad and surprised that Yommy shared his knowledge about this feature since only his server has a 100% working cash shop feature. Quote Share this post Link to post Share on other sites
Neo-Mind 264 Posted April 9, 2013 Sweet !!! Yommy thanks for the care and share & share & share and thanks Judas and Ind and Beret and everyone else who worked on this feature and the client . Quote Share this post Link to post Share on other sites
Yommy 265 Posted April 9, 2013 @Mysterious - lines and space are not some rare commodity that are running out and need to be saved, simplicity shoud be more important @Beret , @Ind - very good idea, but i would suggest like cash_shop { cat_0 { // New category Pr_Reset_Stone_Box,79; Fire_Type_Scroll,79; } cat_1 { // Popular category etc; etc; }} remove the hardcoded category names, servers should edit the images to create there own category setup @Arzzae - i only gave Ind the related packet structures, i doubt this cash shop is what players look for in a server. @reloadcashshop is a good idea though also, i would suggest you use the item_name instead of itemid, it makes it so much more readable when editing your shop unless you know every itemid in your head, or comment them <3 Quote Share this post Link to post Share on other sites
malufett 247 Posted April 9, 2013 remove the hardcoded category names, servers should edit the images to create there own category setup +1 since all international servers don't have the same category in their cash shops... Quote Share this post Link to post Share on other sites
frenzmu06 5 Posted April 9, 2013 (edited) Yommy finally! now i can also use your Cash Shop on my server! MUAHAHAHAHAHA! thanks YOMNOMNOM ofcourse for Ind & 3v3ryb0d3y Edited April 9, 2013 by frenzmu06 Quote Share this post Link to post Share on other sites
Michi 101 Posted April 9, 2013 OMG thanks a lot, now missing battleground queue system. -> http://herc.ws/board/topic/262-implement-new-battleground-queue-system/ Quote Share this post Link to post Share on other sites
JulioCF 105 Posted April 9, 2013 Very Nice, thanks. Quote Share this post Link to post Share on other sites
Fanfare 0 Posted April 9, 2013 (edited) Good news! Thanks But hey, I think you should thank Yommy, dude. You didn't even mention Yommy. remove the hardcoded category names, servers should edit the images to create there own category setup +2 Edited April 9, 2013 by Fanfare Quote Share this post Link to post Share on other sites
Eurydice 8 Posted April 9, 2013 Thanks Ind and Master Yommy! o/ Quote Share this post Link to post Share on other sites
Mystery 594 Posted April 9, 2013 @Mysterious - lines and space are not some rare commodity that are running out and need to be saved, simplicity shoud be more important Yup, I understand that Yommy, but creating more unnecessary lines in the document increases its size. I know that putty it into categories and breaking the items down in lines is good and organized but it's not necessary to really have since you can just categorize the item by commenting the line out. // Grape, New Item something like that. Instead of New: {- Item list- Item List- Item List},Rental: {- Item List- Item List- Item List} Dunno. It could really go both ways depending how people see it. For me, I just find it fine the way it's organized now. Quote Share this post Link to post Share on other sites
Ind 945 Posted April 9, 2013 @Mysterious - lines and space are not some rare commodity that are running out and need to be saved, simplicity shoud be more important @Beret , @Ind - very good idea, but i would suggest like cash_shop { cat_0 { // New category Pr_Reset_Stone_Box,79; Fire_Type_Scroll,79; } cat_1 { // Popular category etc; etc; }}remove the hardcoded category names, servers should edit the images to create there own category setup @Arzzae - i only gave Ind the related packet structures, i doubt this cash shop is what players look for in a server. @reloadcashshop is a good idea though also, i would suggest you use the item_name instead of itemid, it makes it so much more readable when editing your shop unless you know every itemid in your head, or comment them <3 remove the hardcoded category names, servers should edit the images to create there own category setup+1 since all international servers don't have the same category in their cash shops... alright, will put it on my list. Quote Share this post Link to post Share on other sites
REKT 10 Posted April 9, 2013 +1 i've been waiting for this. Quote Share this post Link to post Share on other sites
Ryuuzaki 9 Posted April 10, 2013 (edited) Hi hercules devs, here is the code for working kafra & free cash points. void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { WFIFOHEAD(fd, 10); WFIFOW(fd, 0) = 0x845; WFIFOL(fd, 2) = sd->cashPoints; //[Ryuuzaki] - switched positions to reflect proper values WFIFOL(fd, 6) = sd->kafraPoints; WFIFOSET(fd, 10); } 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); }} 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. Edited April 10, 2013 by Ryuuzaki Quote Share this post Link to post Share on other sites
Yommy 265 Posted April 10, 2013 anyone who is testing this. i remember in my server was some bugs, like purchasing items to make the cashpoints go over int limit caused the items for free. or using a negative value in free cash. just some wisdom <3 Quote Share this post Link to post Share on other sites
Ryuuzaki 9 Posted April 10, 2013 (edited) My client refuses to allow negative cash, will also state that you don't have enough kafra points. Thanks for the warning though ^^ Edit: But yeah, you can also spoof packets to skip the client checks.. Edited April 10, 2013 by Ryuuzaki Quote Share this post Link to post Share on other sites
Ind 945 Posted April 10, 2013 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. 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) Quote Share this post Link to post Share on other sites
Ryuuzaki 9 Posted April 10, 2013 The 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^^ Quote Share this post Link to post Share on other sites