diff options
Diffstat (limited to 'src/map/trade.c')
-rw-r--r-- | src/map/trade.c | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/src/map/trade.c b/src/map/trade.c index 0d01b54a6..a8174be97 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -32,24 +32,24 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta nullpo_retv(sd); if (map[sd->bl.m].flag.notrade) { - clif_displaymessage (sd->fd, msg_txt(272)); + clif->displaymessage (sd->fd, msg_txt(272)); return; //Can't trade in notrade mapflag maps. } if (target_sd == NULL || sd == target_sd) { - clif_tradestart(sd, 1); // character does not exist + clif->tradestart(sd, 1); // character does not exist return; } if (target_sd->npc_id) { //Trade fails if you are using an NPC. - clif_tradestart(sd, 2); + clif->tradestart(sd, 2); return; } if (!battle_config.invite_request_check) { if (target_sd->guild_invite > 0 || target_sd->party_invite > 0 || target_sd->adopt_invite) { - clif_tradestart(sd, 2); + clif->tradestart(sd, 2); return; } } @@ -58,34 +58,34 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta struct map_session_data *previous_sd = map_id2sd(sd->trade_partner); if( previous_sd ){ previous_sd->trade_partner = 0; - clif_tradecancelled(previous_sd); + clif->tradecancelled(previous_sd); } // Once cancelled then continue to the new one. sd->trade_partner = 0; - clif_tradecancelled(sd); + clif->tradecancelled(sd); } if (target_sd->trade_partner != 0) { - clif_tradestart(sd, 2); // person is in another trade + clif->tradestart(sd, 2); // person is in another trade return; } if (!pc_can_give_items(sd) || !pc_can_give_items(target_sd)) //check if both GMs are allowed to trade { - clif_displaymessage(sd->fd, msg_txt(246)); - clif_tradestart(sd, 2); // GM is not allowed to trade + clif->displaymessage(sd->fd, msg_txt(246)); + clif->tradestart(sd, 2); // GM is not allowed to trade return; } // Players can not request trade from far away, unless they are allowed to use @trade. if (!pc_can_use_command(sd, "trade", COMMAND_ATCOMMAND) && (sd->bl.m != target_sd->bl.m || !check_distance_bl(&sd->bl, &target_sd->bl, TRADE_DISTANCE))) { - clif_tradestart(sd, 0); // too far + clif->tradestart(sd, 0); // too far return ; } target_sd->trade_partner = sd->status.account_id; sd->trade_partner = target_sd->status.account_id; - clif_traderequest(target_sd, sd->status.name); + clif->traderequest(target_sd, sd->status.name); } /*========================================== @@ -108,21 +108,21 @@ void trade_tradeack(struct map_session_data *sd, int type) return; //Already trading or no partner set. if ((tsd = map_id2sd(sd->trade_partner)) == NULL) { - clif_tradestart(sd, 1); // character does not exist + clif->tradestart(sd, 1); // character does not exist sd->trade_partner=0; return; } if (tsd->state.trading || tsd->trade_partner != sd->bl.id) { - clif_tradestart(sd, 2); + clif->tradestart(sd, 2); sd->trade_partner=0; return; //Already trading or wrong partner. } if (type == 4) { // Cancel - clif_tradestart(tsd, type); - clif_tradestart(sd, type); + clif->tradestart(tsd, type); + clif->tradestart(sd, type); sd->state.deal_locked = 0; sd->trade_partner = 0; tsd->state.deal_locked = 0; @@ -137,7 +137,7 @@ void trade_tradeack(struct map_session_data *sd, int type) // Check here as well since the original character could had warped. if (!pc_can_use_command(sd, "trade", COMMAND_ATCOMMAND) && (sd->bl.m != tsd->bl.m || !check_distance_bl(&sd->bl, &tsd->bl, TRADE_DISTANCE))) { - clif_tradestart(sd, 0); // too far + clif->tradestart(sd, 0); // too far sd->trade_partner=0; tsd->trade_partner = 0; return; @@ -147,8 +147,8 @@ void trade_tradeack(struct map_session_data *sd, int type) if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.storage_flag || tsd->npc_id || tsd->state.vending || tsd->state.buyingstore || tsd->state.storage_flag) { //Fail - clif_tradestart(sd, 2); - clif_tradestart(tsd, 2); + clif->tradestart(sd, 2); + clif->tradestart(tsd, 2); sd->state.deal_locked = 0; sd->trade_partner = 0; tsd->state.deal_locked = 0; @@ -161,8 +161,8 @@ void trade_tradeack(struct map_session_data *sd, int type) tsd->state.trading = 1; memset(&sd->deal, 0, sizeof(sd->deal)); memset(&tsd->deal, 0, sizeof(tsd->deal)); - clif_tradestart(tsd, type); - clif_tradestart(sd, type); + clif->tradestart(tsd, type); + clif->tradestart(sd, type); } /*========================================== @@ -338,7 +338,7 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount) if( amount == 0 ) { //Why do this.. ~.~ just send an ack, the item won't display on the trade window. - clif_tradeitemok(sd, index, 0); + clif->tradeitemok(sd, index, 0); return; } @@ -356,15 +356,15 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount) if( !itemdb_cantrade(item, src_lv, dst_lv) && //Can't trade (pc_get_partner(sd) != target_sd || !itemdb_canpartnertrade(item, src_lv, dst_lv)) ) //Can't partner-trade { - clif_displaymessage (sd->fd, msg_txt(260)); - clif_tradeitemok(sd, index+2, 1); + clif->displaymessage (sd->fd, msg_txt(260)); + clif->tradeitemok(sd, index+2, 1); return; } if( item->expire_time ) { // Rental System - clif_displaymessage (sd->fd, msg_txt(260)); - clif_tradeitemok(sd, index+2, 1); + clif->displaymessage (sd->fd, msg_txt(260)); + clif->tradeitemok(sd, index+2, 1); return; } @@ -372,14 +372,14 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount) ARR_FIND( 0, 10, trade_i, sd->deal.item[trade_i].index == index || sd->deal.item[trade_i].amount == 0 ); if( trade_i == 10 ) //No space left { - clif_tradeitemok(sd, index+2, 1); + clif->tradeitemok(sd, index+2, 1); return; } trade_weight = sd->inventory_data[index]->weight * amount; if( target_sd->weight + sd->deal.weight + trade_weight > target_sd->max_weight ) { //fail to add item -- the player was over weighted. - clif_tradeitemok(sd, index+2, 1); + clif->tradeitemok(sd, index+2, 1); return; } @@ -399,8 +399,8 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount) } sd->deal.weight += trade_weight; - clif_tradeitemok(sd, index+2, 0); // Return the index as it was received - clif_tradeadditem(sd, target_sd, index+2, amount); + clif->tradeitemok(sd, index+2, 0); // Return the index as it was received + clif->tradeadditem(sd, target_sd, index+2, amount); } /*========================================== @@ -427,7 +427,7 @@ void trade_tradeaddzeny(struct map_session_data* sd, int amount) } sd->deal.zeny = amount; - clif_tradeadditem(sd, target_sd, 0, amount); + clif->tradeadditem(sd, target_sd, 0, amount); } /*========================================== @@ -445,9 +445,9 @@ void trade_tradeok(struct map_session_data *sd) return; } sd->state.deal_locked = 1; - clif_tradeitemok(sd, 0, 0); - clif_tradedeal_lock(sd, 0); - clif_tradedeal_lock(target_sd, 1); + clif->tradeitemok(sd, 0, 0); + clif->tradedeal_lock(sd, 0); + clif->tradedeal_lock(target_sd, 1); } /*========================================== @@ -464,29 +464,29 @@ void trade_tradecancel(struct map_session_data *sd) { // Not trade acepted if( target_sd ) { target_sd->trade_partner = 0; - clif_tradecancelled(target_sd); + clif->tradecancelled(target_sd); } sd->trade_partner = 0; - clif_tradecancelled(sd); + clif->tradecancelled(sd); return; } for(trade_i = 0; trade_i < 10; trade_i++) { // give items back (only virtual) if (!sd->deal.item[trade_i].amount) continue; - clif_additem(sd, sd->deal.item[trade_i].index, sd->deal.item[trade_i].amount, 0); + clif->additem(sd, sd->deal.item[trade_i].index, sd->deal.item[trade_i].amount, 0); sd->deal.item[trade_i].index = 0; sd->deal.item[trade_i].amount = 0; } if (sd->deal.zeny) { - clif_updatestatus(sd, SP_ZENY); + clif->updatestatus(sd, SP_ZENY); sd->deal.zeny = 0; } sd->state.deal_locked = 0; sd->state.trading = 0; sd->trade_partner = 0; - clif_tradecancelled(sd); + clif->tradecancelled(sd); if (!target_sd) return; @@ -494,19 +494,19 @@ void trade_tradecancel(struct map_session_data *sd) for(trade_i = 0; trade_i < 10; trade_i++) { // give items back (only virtual) if (!target_sd->deal.item[trade_i].amount) continue; - clif_additem(target_sd, target_sd->deal.item[trade_i].index, target_sd->deal.item[trade_i].amount, 0); + clif->additem(target_sd, target_sd->deal.item[trade_i].index, target_sd->deal.item[trade_i].amount, 0); target_sd->deal.item[trade_i].index = 0; target_sd->deal.item[trade_i].amount = 0; } if (target_sd->deal.zeny) { - clif_updatestatus(target_sd, SP_ZENY); + clif->updatestatus(target_sd, SP_ZENY); target_sd->deal.zeny = 0; } target_sd->state.deal_locked = 0; target_sd->trade_partner = 0; target_sd->state.trading = 0; - clif_tradecancelled(target_sd); + clif->tradecancelled(target_sd); } /*========================================== @@ -560,7 +560,7 @@ void trade_tradecommit(struct map_session_data *sd) if (flag == 0) pc_delitem(sd, n, sd->deal.item[trade_i].amount, 1, 6, LOG_TYPE_TRADE); else - clif_additem(sd, n, sd->deal.item[trade_i].amount, 0); + clif->additem(sd, n, sd->deal.item[trade_i].amount, 0); sd->deal.item[trade_i].index = 0; sd->deal.item[trade_i].amount = 0; } @@ -572,7 +572,7 @@ void trade_tradecommit(struct map_session_data *sd) if (flag == 0) pc_delitem(tsd, n, tsd->deal.item[trade_i].amount, 1, 6, LOG_TYPE_TRADE); else - clif_additem(tsd, n, tsd->deal.item[trade_i].amount, 0); + clif->additem(tsd, n, tsd->deal.item[trade_i].amount, 0); tsd->deal.item[trade_i].index = 0; tsd->deal.item[trade_i].amount = 0; } @@ -598,8 +598,8 @@ void trade_tradecommit(struct map_session_data *sd) tsd->trade_partner = 0; tsd->state.trading = 0; - clif_tradecompleted(sd, 0); - clif_tradecompleted(tsd, 0); + clif->tradecompleted(sd, 0); + clif->tradecompleted(tsd, 0); // save both player to avoid crash: they always have no advantage/disadvantage between the 2 players if (save_settings&1) |