Index: conf/battle/items.conf =================================================================== --- conf/battle/items.conf (revision 14697) +++ conf/battle/items.conf (working copy) @@ -22,11 +22,11 @@ //-------------------------------------------------------------- // The highest value at which an item can be sold via the merchant vend skill. (in zeny) -vending_max_value: 1000000000 +vending_max_value: 30000 // Whether to allow buying from vending chars that are at their max. zeny limit. // If set to yes, the rest of the zeny above the char's capacity will disappear. -vending_over_max: yes +vending_over_max: no // Tax to apply to all vending transactions (eg: 10000 = 100%, 50 = 0.50%) // When a tax is applied, the item's full price is charged to the buyer, but Index: src/map/vending.c =================================================================== --- src/map/vending.c (revision 14697) +++ src/map/vending.c (working copy) @@ -73,7 +73,9 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const uint8* data, int count) { int i, j, cursor, w, new_ = 0, blank, vend_list[MAX_VENDING]; - double z; + double z,price_buffer=0.; + int currid,cost,vcurrid,new_currency = 677; //Change 677 to the Item ID of whatever you use as currency. + struct item item_buffer; struct s_vending vending[MAX_VENDING]; // against duplicate packets struct map_session_data* vsd = map_id2sd(aid); @@ -119,13 +121,15 @@ else vend_list[i] = j; - z += ((double)vsd->vending[j].value * (double)amount); - if( z > (double)sd->status.zeny || z < 0. || z > (double)MAX_ZENY ) + price_buffer += (((double)vsd->vending[j].value * (double)amount)); + currid = pc_search_inventory (sd, new_currency); + if( price_buffer > (double)sd->status.inventory[currid].amount || currid < 0. || price_buffer > (double)MAX_ZENY ) { clif_buyvending(sd, idx, amount, 1); // you don't have enough zeny return; } - if( z + (double)vsd->status.zeny > (double)MAX_ZENY && !battle_config.vending_over_max ) + vcurrid = pc_search_inventory (vsd, new_currency); + if( price_buffer + (double) vsd->status.inventory[vcurrid].amount > MAX_AMOUNT && !battle_config.vending_over_max ) { clif_buyvending(sd, idx, vsd->vending[j].amount, 4); // too much zeny = overflow return; @@ -170,10 +174,14 @@ if( log_config.zeny > 0 ) log_zeny(vsd, "V", sd, (int)z); - pc_payzeny(sd, (int)z); - if( battle_config.vending_tax ) - z -= z * (battle_config.vending_tax/10000.); - pc_getzeny(vsd, (int)z); + if(price_buffer > sd->status.inventory[currid].amount) + return; + cost = (int) price_buffer; + pc_delitem(sd, currid, cost, 0, 0); + memset(&item_buffer,0,sizeof(item_buffer)); + item_buffer.nameid = new_currency; + item_buffer.identify = 1; + pc_additem(vsd,&item_buffer,cost); for( i = 0; i < count; i++ ) {