/*========================================== * アイテム追加完了(ok押し) *------------------------------------------ */ void trade_tradeok(dumb_ptr<map_session_data> sd) { dumb_ptr<map_session_data> target_sd; int trade_i; nullpo_retv(sd); for (trade_i = 0; trade_i < TRADE_MAX; trade_i++) { IOff2 index = sd->deal_item_index[trade_i]; if (!index.ok()) continue; if (sd->deal_item_amount[trade_i] > sd->status.inventory[index.unshift()].amount || sd->deal_item_amount[trade_i] < 0) { trade_tradecancel(sd); return; } } if ((target_sd = map_id2sd(account_to_block(sd->trade_partner))) != nullptr) { sd->deal_locked = 1; clif_tradeitemok(sd, IOff2::from(0), 0, 0); clif_tradedeal_lock(sd, 0); clif_tradedeal_lock(target_sd, 1); } }
/*========================================== * アイテム追加完了(ok押し) *------------------------------------------ */ void trade_tradeok(dumb_ptr<map_session_data> sd) { dumb_ptr<map_session_data> target_sd; int trade_i; nullpo_retv(sd); for (trade_i = 0; trade_i < 10; trade_i++) { if (sd->deal_item_amount[trade_i] > sd->status.inventory[sd->deal_item_index[trade_i] - 2].amount || sd->deal_item_amount[trade_i] < 0) { trade_tradecancel(sd); return; } } if ((target_sd = map_id2sd(sd->trade_partner)) != NULL) { sd->deal_locked = 1; clif_tradeitemok(sd, 0, 0, 0); clif_tradedeal_lock(sd, 0); clif_tradedeal_lock(target_sd, 1); } }
/*========================================== * アイテム追加完了(ok押し) *------------------------------------------ */ void trade_tradeok(struct map_session_data *sd) { struct map_session_data *target_sd; int trade_i; nullpo_retv(sd); // check items for(trade_i = 0; trade_i < 10; trade_i++) { if ((((sd->deal.item[trade_i].index) >= 0) && (sd->deal.item[trade_i].amount > sd->status.inventory[sd->deal.item[trade_i].index].amount)) || (sd->deal.item[trade_i].amount < 0)) { trade_tradecancel(sd); return; } } // check exploit (trade more items that you have) if (impossible_trade_check(sd)) { trade_tradecancel(sd); return; } // check zeny if (sd->deal.zeny < 0 || sd->deal.zeny > MAX_ZENY || sd->deal.zeny > sd->status.zeny) { // check amount trade_tradecancel(sd); return; } if ((target_sd = map_id2sd(sd->trade_partner)) != NULL) { sd->state.deal_locked = 1; clif_tradeitemok(sd, 0, 0); clif_tradedeal_lock(sd, 0); clif_tradedeal_lock(target_sd, 1); } }
/*========================================== * 'Ok' button on the trade window is pressed. *------------------------------------------ */ void trade_tradeok(struct map_session_data *sd) { struct map_session_data *target_sd; if(sd->state.deal_locked || !sd->state.trading) return; if ((target_sd = map_id2sd(sd->trade_partner)) == NULL) { trade_tradecancel(sd); return; } sd->state.deal_locked = 1; clif_tradeitemok(sd, 0, 0); clif_tradedeal_lock(sd, 0); clif_tradedeal_lock(target_sd, 1); }
/*========================================== * アイテム追加完了(ok押し) *------------------------------------------ */ void trade_tradeok(struct map_session_data *sd) { struct map_session_data *target_sd; nullpo_retv(sd); target_sd = map_id2sd(sd->trade.partner); if(target_sd && target_sd->bl.prev) { if (sd->bl.m != target_sd->bl.m || unit_distance(&sd->bl, &target_sd->bl) > 2) { trade_tradecancel(sd); return; } sd->state.deal_locked = 1; clif_tradeitemok(sd,0,0); clif_tradedeal_lock(sd,0); clif_tradedeal_lock(target_sd,1); } else { trade_tradecancel(sd); } return; }