Jump to content

Quick Fix 2012-04-10aragexe Cash Shop


simplexjay2

Recommended Posts


  • Group:  Members
  • Topic Count:  56
  • Topics Per Day:  0.01
  • Content Count:  224
  • Reputation:   4
  • Joined:  02/09/12
  • Last Seen:  

I'm starting to help someone that not have been fix the cash shop in 2012-04-10araexe after i search looking to fix it some src are release but it failed... but thank's for those src give's me idea to fix the cash shop problem now here's the quick fix..

 

 

In: \src\map\clif.c

Find:
 /// CASH/POINT SHOP
Around line 15902

till before 
/// Adoption System
Around line 15902

change with this 

/// CASH/POINT SHOP
///

void clif_cashshop_open( struct map_session_data* sd ){
	WFIFOHEAD( sd->fd, 10 );
	WFIFOW( sd->fd, 0 ) = 0x845;
	WFIFOL( sd->fd, 2 ) = sd->cashPoints;
	WFIFOL( sd->fd, 6 ) = sd->kafraPoints;
	WFIFOSET( sd->fd, 10 );
}

void clif_parse_cashshop_open_request( int fd, struct map_session_data* sd ){
	sd->npc_shopid = -1; // Set npc_shopid when using cash shop from "cash shop" button [Aelys|Susu] bugreport:96
	clif_cashshop_open( sd );
}

void clif_parse_cashshop_close( int fd, struct map_session_data* sd ){
	sd->npc_shopid = 0; // Reset npc_shopid when using cash shop from "cash shop" button [Aelys|Susu] bugreport:96
	// No need to do anything here
}

//0846 <tabid>.W (CZ_REQ_SE_CASH_TAB_CODE))
//08c0 <len>.W <openIdentity>.L <itemcount>.W (ZC_ACK_SE_CASH_ITEM_LIST2)
void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) {
	short tab = RFIFOW(fd, packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
	int j;

	if( tab < 0 || tab > CASHSHOP_TAB_SEARCH )
		return;

	WFIFOHEAD(fd, 10 + ( cash_shop_items[tab].count * 6 ) );
	WFIFOW(fd, 0) = 0x8c0;
	WFIFOW(fd, 2) = 10 + ( cash_shop_items[tab].count * 6 );
	WFIFOL(fd, 4) = tab;
	WFIFOW(fd, 8) = cash_shop_items[tab].count;

	for( j = 0; j < cash_shop_items[tab].count; j++ ) {
		struct item_data *id = itemdb_search(cash_shop_items[tab].item[j]->nameid);
		WFIFOW(fd, 10 + ( 6 * j ) ) = (id->view_id) ? id->view_id : cash_shop_items[tab].item[j]->nameid;
		WFIFOL(fd, 12 + ( 6 * j ) ) = cash_shop_items[tab].item[j]->price;
	}

	WFIFOSET(fd, 10 + ( cash_shop_items[tab].count * 6 ));
}

//08ca <len>.W <itemcount> W <tabcode>.W (ZC_ACK_SCHEDULER_CASHITEM)
void clif_cashshop_list( int fd ){
	int tab;

	for( tab = CASHSHOP_TAB_NEW; tab < CASHSHOP_TAB_SEARCH; tab++ ){
		int length = 8 + cash_shop_items[tab].count * 6;
		int i, offset;

		WFIFOHEAD( fd, length );
		WFIFOW( fd, 0 ) = 0x8ca;
		WFIFOW( fd, 2 ) = length;
		WFIFOW( fd, 4 ) = cash_shop_items[tab].count;
		WFIFOW( fd, 6 ) = tab;

		for( i = 0, offset = 8; i < cash_shop_items[tab].count; i++, offset += 6 ){
			struct item_data *id = itemdb_search(cash_shop_items[tab].item[i]->nameid);
			WFIFOW( fd, offset ) = (id->view_id) ? id->view_id : cash_shop_items[tab].item[i]->nameid;
			WFIFOL( fd, offset + 2 ) = cash_shop_items[tab].item[i]->price;
		}

		WFIFOSET( fd, length );
	}
}

void clif_parse_cashshop_list_request( int fd, struct map_session_data* sd ){
	if( !sd->status.cashshop_sent ) {
		clif_cashshop_list( fd );
		sd->status.cashshop_sent = true;
	}
}
/// List of items offered in a cash shop (ZC_PC_CASH_POINT_ITEMLIST).
/// 0287 <packet len>.W <cash point>.L { <sell price>.L <discount price>.L <item type>.B <name id>.W }*
/// 0287 <packet len>.W <cash point>.L <kafra point>.L { <sell price>.L <discount price>.L <item type>.B <name id>.W }* (PACKETVER >= 20070711)
void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd)
{
	int fd,i;
#if PACKETVER < 20070711
	const int offset = 8;
#else
	const int offset = 12;
#endif

	nullpo_retv(sd);
	nullpo_retv(nd);

	fd = sd->fd;
	sd->npc_shopid = nd->bl.id;
	WFIFOHEAD(fd,offset+nd->u.shop.count*11);
	WFIFOW(fd,0) = 0x287;
	WFIFOW(fd,2) = offset+nd->u.shop.count*11;
	WFIFOL(fd,4) = sd->cashPoints; // Cash Points
#if PACKETVER >= 20070711
	WFIFOL(fd,8) = sd->kafraPoints; // Kafra Points
#endif

	for( i = 0; i < nd->u.shop.count; i++ ) {
		struct item_data* id = itemdb_search(nd->u.shop.shop_item[i].nameid);
		WFIFOL(fd,offset+0+i*11) = nd->u.shop.shop_item[i].value;
		WFIFOL(fd,offset+4+i*11) = nd->u.shop.shop_item[i].value; // Discount Price
		WFIFOB(fd,offset+8+i*11) = itemtype(id->nameid);
		WFIFOW(fd,offset+9+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid;
	}
	WFIFOSET(fd,WFIFOW(fd,2));
}


/// Cashshop Buy Ack (ZC_PC_CASH_POINT_UPDATE).
/// 0289 <cash point>.L <error>.W
/// 0289 <cash point>.L <kafra point>.L <error>.W (PACKETVER >= 20070711)
/// error:
///     0 = The deal has successfully completed. (ERROR_TYPE_NONE)
///     1 = The Purchase has failed because the NPC does not exist. (ERROR_TYPE_NPC)
///     2 = The Purchase has failed because the Kafra Shop System is not working correctly. (ERROR_TYPE_SYSTEM)
///     3 = You are over your Weight Limit. (ERROR_TYPE_INVENTORY_WEIGHT)
///     4 = You cannot purchase items while you are in a trade. (ERROR_TYPE_EXCHANGE)
///     5 = The Purchase has failed because the Item Information was incorrect. (ERROR_TYPE_ITEM_ID)
///     6 = You do not have enough Kafra Credit Points. (ERROR_TYPE_MONEY)
///     7 = You can purchase up to 10 items.
///     8 = Some items could not be purchased.
void clif_cashshop_ack(struct map_session_data* sd, int error)
{
	int fd = sd->fd;

	WFIFOHEAD(fd, packet_len(0x289));
	WFIFOW(fd,0) = 0x289;
	WFIFOL(fd,2) = sd->cashPoints;
#if PACKETVER < 20070711
	WFIFOW(fd,6) = TOW(error);
#else
	WFIFOL(fd,6) = sd->kafraPoints;
	WFIFOW(fd,10) = TOW(error);
#endif
	WFIFOSET(fd, packet_len(0x289));
}

#if PACKETVER >= 20120410
void clif_parse_cashshop_buy( int fd, struct map_session_data *sd ){ 
	struct s_packet_db* info = &packet_db[sd->packet_ver][RFIFOW(fd,0)]; 
	uint16 length = RFIFOW( fd, info->pos[0] );
	uint16 count = RFIFOW( fd, info->pos[1] );
 
	if( length < 10 || length < ( 10 + count * 6 ) ){ 
		return; 
	}
 
	cashshop_buylist( sd, RFIFOL( fd, info->pos[2] ),
		count, (uint16 *)RFIFOP( fd, info->pos[3] ) ); 

}
#endif 

void clif_cashshop_result( struct map_session_data *sd, uint16 item_id, uint16 result ){
	WFIFOHEAD( sd->fd, 16 );
	WFIFOW( sd->fd, 0 ) = 0x849;
	WFIFOL( sd->fd, 2 ) = item_id;
	WFIFOW( sd->fd, 6 ) = result;
	WFIFOL( sd->fd, 8 ) = sd->cashPoints;
	WFIFOL( sd->fd, 12 ) = sd->kafraPoints;
	WFIFOSET( sd->fd, 16 );
}

// TODO: find a more accurate date for this  - Brynner
#if PACKETVER < 20120410
/// Request to buy item(s) from cash shop (CZ_PC_BUY_CASH_POINT_ITEM).
/// 0288 <name id>.W <amount>.W
/// 0288 <name id>.W <amount>.W <kafra points>.L (PACKETVER >= 20070711)
/// 0288 <packet len>.W <kafra points>.L <count>.W { <amount>.W <name id>.W }.4B*count (PACKETVER >= 20100803)
/// 0848 <packet len>.W <count>.W <packet len>.W <kafra points>.L <count>.W { <amount>.W <name id>.W <tab>.W }.6B*count (PACKETVER >= 20130000)
void clif_parse_cashshop_buy(int fd, struct map_session_data *sd){

	int fail = 0;
	struct s_packet_db* info;
	int cmd = RFIFOW(fd,0);

	nullpo_retv(sd);

	info = &packet_db[sd->packet_ver][cmd];

	if( sd->state.trading || !sd->npc_shopid )
		fail = 1;
	else {
#if PACKETVER < 20101116
		short nameid = RFIFOW(fd,info->pos[0]);
		short amount = RFIFOW(fd,info->pos[1]);
		int points   = RFIFOL(fd,info->pos[2]);

		fail = npc_cashshop_buy(sd, nameid, amount, points);
		clif_cashshop_ack(sd,fail);
#else
		int s_itl = (cmd==0x848)?10:4; //item _list size (depend on cmd even for 2013+)
		int len    = RFIFOW(fd,info->pos[0]);
		int points = RFIFOL(fd,info->pos[1]);
		int count  = RFIFOW(fd,info->pos[2]);
		unsigned short* item_list = (unsigned short*)RFIFOP(fd,info->pos[3]);

		if( len < 10 || len != 10 + count * s_itl){
			ShowWarning("Player %u sent incorrect cash shop buy packet (len %u:%u)!\n", sd->status.char_id, len, 10 + count * s_itl);
			return;
		}
		if(cmd==0x848){
			cashshop_buylist( sd, points, count, item_list);
		} else {
			fail = npc_cashshop_buylist(sd,points,count,item_list);
		}
#endif
	}
	clif_cashshop_ack(sd,fail);
}
#endif

/// Adoption System

And use this Packet 2012-04-10

 

//2012-04-10aRagexeRE
packet_ver: 30
0x01FD,15,repairitem,2
0x089C,26,friendslistadd,2
0x0885,5,hommenu,2:4
0x0961,36,storagepassword,0
0x0288,-1,cashshopbuy,4:8
0x091C,26,partyinvite2,2
0x094B,19,wanttoconnection,2:6:10:14:18
0x0369,7,actionrequest,2:6
0x083C,10,useskilltoid,2:4:6
0x0439,8,useitem,2:4
0x0945,-1,itemlistwindowselected,2:4:8
0x0815,-1,reqopenbuyingstore,2:4:8:9:89
0x0817,2,reqclosebuyingstore,0
0x0360,6,reqclickbuyingstore,2
0x0811,-1,reqtradebuyingstore,2:4:8:12
0x0819,-1,searchstoreinfo,2:4:5:9:13:14:15
0x0835,2,searchstoreinfonextpage,0
0x0838,12,searchstoreinfolistitemclick,2:6:10
0x0437,5,walktoxy,2
0x0886,6,ticksend,2
0x0871,5,changedir,2:4
0x0938,6,takeitem,2
0x0891,6,dropitem,2:4
0x086C,8,movetokafra,2:4
0x08A6,8,movefromkafra,2:4
0x0438,10,useskilltopos,2:4:6:8
0x091D,18,bookingregreq,2:4:6
0x0366,90,useskilltoposinfo,2:4:6:8:10
0x0889,6,getcharnamerequest,2
0x0884,6,solvecharname,2
0x08E5,41,bookingregreq,2:4 //Added to prevent disconnections
0x08E6,4
0x08E7,10,bookingsearchreq,2
0x08E8,-1
0x08E9,2,bookingdelreq,2
0x08EA,4
0x08EB,39,bookingupdatereq,2
0x08EC,73
0x08ED,43
0x08EE,6
0x08EF,6,bookingignorereq,2
0x08F0,6
0x08F1,6,bookingjoinpartyreq,2
0x08F2,36
0x08F3,-1
0x08F4,6
0x08F5,-1,bookingsummonmember,2:4
0x08F6,22
0x08F7,3
0x08F8,7
0x08F9,6
0x08FA,6
0x08FB,6,bookingcanceljoinparty,2
0x0907,5,moveitem,2:4
0x0908,5
0x08D7,28,battlegroundreg,2:4 //Added to prevent disconnections
0x08CF,10 //Amulet spirits
0x0977,14 //Monster HP Bar
0x0916,26,guildinvite2,2
0x0844,2,cashshopopen,0
0x084a,2,cashshopclose,0
0x08c9,4,cashshopitemlist,0
0x0848,-1,cashshopbuy,2:4:6:10
Edited by simplexjay2
  • Upvote 1
Link to comment
Share on other sites

  • 9 months later...

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   0
  • Joined:  04/18/15
  • Last Seen:  

Hi, thank you very much for this. Is it safe? (it's working fine, i was test a little bit with different parameters)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  56
  • Topics Per Day:  0.01
  • Content Count:  224
  • Reputation:   4
  • Joined:  02/09/12
  • Last Seen:  

yep it's safe bro :D

Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  1
  • Reputation:   0
  • Joined:  09/04/15
  • Last Seen:  

hi sir can you send here your client or your exe kindly post it too thanks

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   1
  • Joined:  10/13/13
  • Last Seen:  

My first problem was gone that the "The Purchase Has failed because the npc does not exist." Thank you that this error was gone

 

but now this is my problem.

 

 

I Got A problem When i Buy on cashshop it doesn't get the item and the cash still the same.

Link to comment
Share on other sites

  • 6 months later...

  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  31
  • Reputation:   0
  • Joined:  02/05/14
  • Last Seen:  

I read most post with topic related to this and tried every method they posted but it didn't work.

I'm using ver17726, client 20120410.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  07/03/15
  • Last Seen:  

@Cinquedea ^ Same with me, i can't get the item and my cash poin not reduced now

Link to comment
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.   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.

×
×
  • Create New...