diff options
Diffstat (limited to 'src/map/vending.c')
-rw-r--r-- | src/map/vending.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/map/vending.c b/src/map/vending.c index a61e6fc79..723cb014f 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -59,7 +59,7 @@ void vending_vendinglistreq(struct map_session_data* sd, int id) { // GM is not allowed to trade clif_displaymessage(sd->fd, msg_txt(246)); return; - } + } sd->vended_id = vsd->vender_id; // register vending uid @@ -139,11 +139,11 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui clif_buyvending(sd, idx, amount, 2); // you can not buy, because overweight return; } - + //Check to see if cart/vend info is in sync. if( vending[j].amount > vsd->status.cart[idx].amount ) vending[j].amount = vsd->status.cart[idx].amount; - + // if they try to add packets (example: get twice or more 2 apples if marchand has only 3 apples). // here, we check cumulative amounts if( vending[j].amount < amount ) @@ -152,7 +152,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui clif_buyvending(sd, idx, vsd->vending[j].amount, 4); // not enough quantity return; } - + vending[j].amount -= amount; switch( pc_checkadditem(sd, vsd->status.cart[idx].nameid, amount) ) { @@ -168,13 +168,10 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui } } - //Logs (V)ending Zeny [Lupus] - log_zeny(vsd, LOG_TYPE_VENDING, sd, (int)z); - - pc_payzeny(sd, (int)z); + pc_payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd); if( battle_config.vending_tax ) z -= z * (battle_config.vending_tax/10000.); - pc_getzeny(vsd, (int)z); + pc_getzeny(vsd, (int)z, LOG_TYPE_VENDING, sd); for( i = 0; i < count; i++ ) { @@ -202,7 +199,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui { if( vsd->vending[i].amount == 0 ) continue; - + if( cursor != i ) // speedup { vsd->vending[cursor].index = vsd->vending[i].index; @@ -236,18 +233,18 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui } static int vending_checknearnpc_sub(struct block_list* bl, va_list args) { struct npc_data *nd = (struct npc_data*)bl; - + if( nd->sc.option & (OPTION_HIDE|OPTION_INVISIBLE) ) return 0; return 1; } bool vending_checknearnpc(struct block_list * bl) { - + if( battle_config.min_npc_vending_distance > 0 && map_foreachinrange(vending_checknearnpc_sub,bl, battle_config.min_npc_vending_distance, BL_NPC) ) return true; - + return false; } /*========================================== @@ -287,8 +284,8 @@ void vending_openvending(struct map_session_data* sd, const char* message, bool clif_skill_fail(sd, MC_VENDING, USESKILL_FAIL_LEVEL, 0); return; } - - + + // filter out invalid items i = 0; for( j = 0; j < count; j++ ) |