Mistique Posted May 14, 2019 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 53 Reputation: 1 Joined: 09/15/12 Last Seen: December 10, 2019 Share Posted May 14, 2019 Hi everyone. Not quite sure if this belongs into requests or support, but I'm trying to get the cash shop system to accept an item currency rather than regular cash points, let's say item ID 501. Does anyone know how that can be achieved? Thank you very much in advance! Quote Link to comment Share on other sites More sharing options...
0 anacondaq Posted May 14, 2019 Group: Members Topic Count: 42 Topics Per Day: 0.01 Content Count: 1096 Reputation: 348 Joined: 02/26/12 Last Seen: May 30, 2023 Share Posted May 14, 2019 cashshop UI? (cash shop button?) If yes - almost not possible. But there is itemshop https://github.com/rathena/rathena/blob/21a5854c167399afe2c0d0c93fae474db88b3f88/doc/script_commands.txt#L286 Quote Link to comment Share on other sites More sharing options...
0 Mistique Posted May 14, 2019 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 53 Reputation: 1 Joined: 09/15/12 Last Seen: December 10, 2019 Author Share Posted May 14, 2019 3 hours ago, anacondaq said: cashshop UI? (cash shop button?) If yes - almost not possible. But there is itemshop https://github.com/rathena/rathena/blob/21a5854c167399afe2c0d0c93fae474db88b3f88/doc/script_commands.txt#L286 Thanks! Yes, the UI aka button cash shop, I am aware of the itemshop but would prefer the button interface. So almost not possible? I've seen servers do it though. Quote Link to comment Share on other sites More sharing options...
0 anacondaq Posted May 15, 2019 Group: Members Topic Count: 42 Topics Per Day: 0.01 Content Count: 1096 Reputation: 348 Joined: 02/26/12 Last Seen: May 30, 2023 Share Posted May 15, 2019 (edited) 15 hours ago, Mistique said: So almost not possible? I've seen servers do it though. Try this https://gist.github.com/anacondaq/3479caee38df5738d81ea1ab5454c512 Not tested, I just wrote the code while doing something else, it can not work at all, or can have dozens of bugs, or even critical problems or even crashes. Use it on your own risk. cashshop_ui_itemid_as_currency.diff Edited May 15, 2019 by anacondaq 1 Quote Link to comment Share on other sites More sharing options...
0 Mistique Posted May 16, 2019 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 53 Reputation: 1 Joined: 09/15/12 Last Seen: December 10, 2019 Author Share Posted May 16, 2019 On 5/15/2019 at 10:49 AM, anacondaq said: Try this https://gist.github.com/anacondaq/3479caee38df5738d81ea1ab5454c512 Not tested, I just wrote the code while doing something else, it can not work at all, or can have dozens of bugs, or even critical problems or even crashes. Use it on your own risk. cashshop_ui_itemid_as_currency.diff 2.99 kB · 3 downloads Cool! Thanks I will give this a go later today. Hi @anacondaq I tried it, but it's returning this error message when compiling: Not declared... but I put it in items.conf like it said in the diff. Quote Link to comment Share on other sites More sharing options...
0 anacondaq Posted May 18, 2019 Group: Members Topic Count: 42 Topics Per Day: 0.01 Content Count: 1096 Reputation: 348 Joined: 02/26/12 Last Seen: May 30, 2023 Share Posted May 18, 2019 Hi, maybe you did not applied properly the diff? Make sure that you have edited next files: src/custom/battle_config_init.inc // Cashshop UI item currency shop: { "cashshop_currency_itemid", &battle_config.cashshop_currency_itemid, 0, 0, MAX_ITEMID, }, src/custom/battle_config_struct.inc // Cashshop currency ItemID shop int cashshop_currency_itemid; conf/battle/items.conf // Instead of Cashpoints in Cashshop UI (interface) // Use ITEMID with ID below. The item must exists in the game // The item must have tradable flags, etc like a normal item // Instead of cashpoints will be consumed the item from players inventory // Set it to 0 if you wish completely disable the system. // Max ID = 65k cashshop_currency_itemid: 505 src/map/cashshop.cpp Find (inside function cashshop_buylist): if(pc_paycash( sd, totalcash, kafrapoints, LOG_TYPE_CASH ) <= 0){ clif_cashshop_result( sd, 0, CASHSHOP_RESULT_ERROR_SHORTTAGE_CASH ); return false; Replace to: // Custom code for using instead of cashpoints itemID as a currency in cashshop UI shop. if(battle_config.cashshop_currency_itemid) { struct item_data *id_cash_currency = itemdb_search(battle_config.cashshop_currency_itemid); if (!id_cash_currency) { clif_cashshop_result(sd, 0, CASHSHOP_RESULT_ERROR_SHORTTAGE_CASH); ShowError("cashshop_currency_itemid: %d itemID not exists in the game, try another one.\n", battle_config.cashshop_currency_itemid); return false; } int item_idx = pc_search_inventory(sd, battle_config.cashshop_currency_itemid); if (item_idx < 0 || pc_delitem(sd, item_idx, totalcash, 0, 0, LOG_TYPE_CONSUME)) { clif_cashshop_result(sd, 0, CASHSHOP_RESULT_ERROR_SHORTTAGE_CASH); return false; } } else // Original Function { if (pc_paycash(sd, totalcash, kafrapoints, LOG_TYPE_CASH) <= 0) { clif_cashshop_result(sd, 0, CASHSHOP_RESULT_ERROR_SHORTTAGE_CASH); return false; } Recompile. Tested with latest github hash 1 Quote Link to comment Share on other sites More sharing options...
0 Mistique Posted September 8, 2019 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 53 Reputation: 1 Joined: 09/15/12 Last Seen: December 10, 2019 Author Share Posted September 8, 2019 On 5/18/2019 at 5:16 AM, anacondaq said: Recompile. Hi anacondaq, sorry for the super delayed reply. Completely forgot this thread was here. I went through the steps you pointed out above once more but it still gives the same error message. battle_conf was not declared. I can't/prefer not to update my rA. Do you happen to have any suggestion how I could fix this error manually? Thanks. Quote Link to comment Share on other sites More sharing options...
0 ScarrFace Posted August 21, 2021 Group: Members Topic Count: 17 Topics Per Day: 0.01 Content Count: 66 Reputation: 0 Joined: 10/23/19 Last Seen: August 28, 2024 Share Posted August 21, 2021 On 5/18/2019 at 11:16 AM, anacondaq said: Hi, maybe you did not applied properly the diff? Make sure that you have edited next files: src/custom/battle_config_init.inc // Cashshop UI item currency shop: { "cashshop_currency_itemid", &battle_config.cashshop_currency_itemid, 0, 0, MAX_ITEMID, }, src/custom/battle_config_struct.inc // Cashshop currency ItemID shop int cashshop_currency_itemid; conf/battle/items.conf // Instead of Cashpoints in Cashshop UI (interface) // Use ITEMID with ID below. The item must exists in the game // The item must have tradable flags, etc like a normal item // Instead of cashpoints will be consumed the item from players inventory // Set it to 0 if you wish completely disable the system. // Max ID = 65k cashshop_currency_itemid: 505 src/map/cashshop.cpp Find (inside function cashshop_buylist): if(pc_paycash( sd, totalcash, kafrapoints, LOG_TYPE_CASH ) <= 0){ clif_cashshop_result( sd, 0, CASHSHOP_RESULT_ERROR_SHORTTAGE_CASH ); return false; Replace to: // Custom code for using instead of cashpoints itemID as a currency in cashshop UI shop. if(battle_config.cashshop_currency_itemid) { struct item_data *id_cash_currency = itemdb_search(battle_config.cashshop_currency_itemid); if (!id_cash_currency) { clif_cashshop_result(sd, 0, CASHSHOP_RESULT_ERROR_SHORTTAGE_CASH); ShowError("cashshop_currency_itemid: %d itemID not exists in the game, try another one.\n", battle_config.cashshop_currency_itemid); return false; } int item_idx = pc_search_inventory(sd, battle_config.cashshop_currency_itemid); if (item_idx < 0 || pc_delitem(sd, item_idx, totalcash, 0, 0, LOG_TYPE_CONSUME)) { clif_cashshop_result(sd, 0, CASHSHOP_RESULT_ERROR_SHORTTAGE_CASH); return false; } } else // Original Function { if (pc_paycash(sd, totalcash, kafrapoints, LOG_TYPE_CASH) <= 0) { clif_cashshop_result(sd, 0, CASHSHOP_RESULT_ERROR_SHORTTAGE_CASH); return false; } Recompile. Tested with latest github hash @anacondaq there's a problem. it still counts the cash points in the interface + it still counts the cash points when buying. example is when you have 100 token and 0 cash points error message show but if you have 100 cash points and 100 token and if you buy items the deduction is correct. how to update the counts in interface is the new item id currency ? thank you! Quote Link to comment Share on other sites More sharing options...
Question
Mistique
Hi everyone.
Not quite sure if this belongs into requests or support, but I'm trying to get the cash shop system to accept an item currency rather than regular cash points, let's say item ID 501. Does anyone know how that can be achieved?
Thank you very much in advance!
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.