Jump to content
Ind

Introducing Cash Shop Support

Recommended Posts

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 by Beret

Share this post


Link to post
Share on other sites
Guest unleashed

Oh man this is too good to be true! Awesome work Ind and special thanks to Yommy for releasing it!

Share this post


Link to post
Share on other sites

 

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.

Share this post


Link to post
Share on other sites

 

 

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},};

Share this post


Link to post
Share on other sites

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. 

Share this post


Link to post
Share on other sites

Sweet !!! Yommy thanks for the care and share & share & share :P and thanks Judas and Ind and Beret and everyone else who worked on this feature and the client :D.

Share this post


Link to post
Share on other sites

@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 :P

 

<3

Share this post


Link to post
Share on other sites

 

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...

 

:meow:

Share this post


Link to post
Share on other sites

Yommy finally! now i can also use your Cash Shop on my server! MUAHAHAHAHAHA!

 

thanks YOMNOMNOM

 

ofcourse for Ind & 3v3ryb0d3y

Edited by frenzmu06

Share this post


Link to post
Share on other sites

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 by Fanfare

Share this post


Link to post
Share on other sites

@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.

Share this post


Link to post
Share on other sites

@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 :P

 

<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...

 

:meow:

 

 

alright, will put it on my list.

Share this post


Link to post
Share on other sites

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 by Ryuuzaki

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 by Ryuuzaki

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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^^

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
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.