Jump to content
  • 0

Source edit for custom Shop


chiCHI

Question


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  35
  • Reputation:   3
  • Joined:  11/05/11
  • Last Seen:  

I found a source edit here released by Ind (http://rathena.org/board/user/391-ind/).

Basically, it converts any item you want to kafrapoints so that it can be used as a currency in cashshops.

 

here is the link to the orig page: http://www.eathena.ws/board/index.php?showtopic=266916

 

Somewhat it works when it checks for the item that will be used as a currency (eg: Proof of Donation)

but when you buy an item, it doesn't deduct anything to that specified currency.

 

here is the code: 


	if( stristr(nd->name,"ITMCur") ) {//Item Currency
	int count=0,ind=0,c = 0, cid = pc_readreg(sd,add_str("@RRITMCur"));
	for(c = 0; c < MAX_INVENTORY; c++)
	if(sd->status.inventory[c].nameid == cid )
	count += sd->status.inventory[c].amount;
	if( count != pc_readaccountreg( sd, "#CASHPOINTS" ) )
	return 6;
	ind = pc_search_inventory(sd, cid);
	if( ind < 0 )//because checking twice is safer...
	return 6;
	sd->cashPoints = count;
	if( sd->cashPoints < vt )
	return 6;
	if( pc_delitem(sd, ind, vt, 0, 0, LOG_TYPE_NPC) )//somehow it failed to delete...
	return 6;

	sd->cashPoints -= vt;
	if( !pet_create_egg(sd, nameid) )
	{
	struct item item_tmp;
	memset(&item_tmp, 0, sizeof(struct item));
	item_tmp.nameid = nameid;
	item_tmp.identify = 1;


	pc_additem(sd,&item_tmp, amount, LOG_TYPE_NPC);

	}
	if(log_config.enable_logs&0x20)
	log_pick_pc(sd, LOG_TYPE_SCRIPT, amount, NULL);
	pc_setaccountreg(sd,"#CASHPOINTS",sd->cashPoints);//update shop~
	return 0;
	}

	if( stristr(nd->name,"CharCur") ) {//Char Reg Currency (from set REGNAME,1;)
	const char* charReg = pc_readregstr(sd,add_str("@CharCurrrency$"));
	int count = pc_readglobalreg(sd,charReg);
	if( count != pc_readaccountreg( sd, "#CASHPOINTS" ) )//safecheck
	return 6;
	sd->cashPoints = count;
	if( sd->cashPoints < vt )
	return 6;
	sd->cashPoints -= vt;
	pc_setglobalreg(sd,charReg,sd->cashPoints);//update...
	if( !pet_create_egg(sd, nameid) )//give item...
	{
	struct item item_tmp;
	memset(&item_tmp, 0, sizeof(struct item));
	item_tmp.nameid = nameid;
	item_tmp.identify = 1;

	pc_additem(sd,&item_tmp, amount, LOG_TYPE_NPC);
	}
	if(log_config.enable_logs&0x20)
	log_pick_pc(sd, LOG_TYPE_SCRIPT, amount, NULL);
	pc_setaccountreg(sd,"#CASHPOINTS",sd->cashPoints);//update shop~
	return 0;
	}
	if( stristr(nd->name,"ACCCur") ) {//Account Reg Currency
	const char* charReg = pc_readregstr(sd,add_str("@AccCurrrency$"));
	int count = pc_readaccountreg(sd,charReg);
	if( count != pc_readaccountreg( sd, "#CASHPOINTS" ) )//safecheck
	return 6;
	sd->cashPoints = count;
	if( sd->cashPoints < vt )
	return 6;
	sd->cashPoints -= vt;
	pc_setaccountreg(sd,charReg,sd->cashPoints);//update...
	if( !pet_create_egg(sd, nameid) )//give item...
	{
	struct item item_tmp;
	memset(&item_tmp, 0, sizeof(struct item));
	item_tmp.nameid = nameid;
	item_tmp.identify = 1;

	pc_additem(sd,&item_tmp, amount, LOG_TYPE_NPC);
	}
	if(log_config.enable_logs&0x20)
	log_pick_pc(sd, LOG_TYPE_SCRIPT, amount, NULL);
	pc_setaccountreg(sd,"#CASHPOINTS",sd->cashPoints);//update shop~
	return 0;
	}

    if( sd->kafraPoints < points || sd->cashPoints < (vt - points) )
        return 6;
    pc_paycash(sd,vt,points);

 

 

Can somebody help me with this? It would be much appreciated. Thank you so much..

Link to comment
Share on other sites

1 answer to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  35
  • Reputation:   3
  • Joined:  11/05/11
  • Last Seen:  

bump :(

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

×
×
  • Create New...