chiCHI Posted April 6, 2013 Share Posted April 6, 2013 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.. Quote Link to comment Share on other sites More sharing options...
chiCHI Posted April 7, 2013 Author Share Posted April 7, 2013 bump Quote Link to comment Share on other sites More sharing options...
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