• 0
Sign in to follow this  
Mistique

Cash Shop item payment instead of Cash Points?

Question

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! 🙂  

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0
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. 😞

Share this post


Link to post
Share on other sites
  • 0
Posted (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 by anacondaq
  • Upvote 1

Share this post


Link to post
Share on other sites
  • 0
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:

error.png.abf656f1c4179185a38e21b8c081b564.png

Not declared... but I put it in items.conf like it said in the diff.

Share this post


Link to post
Share on other sites
  • 0

Hi, maybe you did not applied properly the diff? 

osuRPaZ.png

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

  • Upvote 1

Share this post


Link to post
Share on other sites
  • 0
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. 🙂 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this