diff options
author | shennetsind <notind@gmail.com> | 2013-06-08 13:15:28 -0700 |
---|---|---|
committer | shennetsind <notind@gmail.com> | 2013-06-08 13:15:28 -0700 |
commit | 13f5061b2640f017028c0d6f9ea0b657631b46c3 (patch) | |
tree | 0304d4af4a803632f2fb9a8aa32455af49882375 /src/map/trade.c | |
parent | 6d042dcbb41cc278f14706e7306412642ea90d3a (diff) | |
parent | d73783f22b2bb881aab74524d153d89a5932a199 (diff) | |
download | hercules-13f5061b2640f017028c0d6f9ea0b657631b46c3.tar.gz hercules-13f5061b2640f017028c0d6f9ea0b657631b46c3.tar.bz2 hercules-13f5061b2640f017028c0d6f9ea0b657631b46c3.tar.xz hercules-13f5061b2640f017028c0d6f9ea0b657631b46c3.zip |
Merge pull request #39 from Earisu/master
Help with renewal phase one and HPM system
Diffstat (limited to 'src/map/trade.c')
-rw-r--r-- | src/map/trade.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/map/trade.c b/src/map/trade.c index 1417426e9..4f4cc7394 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -55,7 +55,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta } if ( sd->trade_partner != 0 ) { // If a character tries to trade to another one then cancel the previous one - struct map_session_data *previous_sd = map_id2sd(sd->trade_partner); + struct map_session_data *previous_sd = iMap->id2sd(sd->trade_partner); if( previous_sd ){ previous_sd->trade_partner = 0; clif->tradecancelled(previous_sd); @@ -69,7 +69,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta return; } - if (!pc_can_give_items(sd) || !pc_can_give_items(target_sd)) //check if both GMs are allowed to trade + if (!iPc->can_give_items(sd) || !iPc->can_give_items(target_sd)) //check if both GMs are allowed to trade { clif->message(sd->fd, msg_txt(246)); clif->tradestart(sd, 2); // GM is not allowed to trade @@ -77,7 +77,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta } // Players can not request trade from far away, unless they are allowed to use @trade. - if (!pc_can_use_command(sd, "@trade") && + if (!iPc->can_use_command(sd, "@trade") && (sd->bl.m != target_sd->bl.m || !check_distance_bl(&sd->bl, &target_sd->bl, TRADE_DISTANCE))) { clif->tradestart(sd, 0); // too far return ; @@ -107,7 +107,7 @@ void trade_tradeack(struct map_session_data *sd, int type) if (sd->state.trading || !sd->trade_partner) return; //Already trading or no partner set. - if ((tsd = map_id2sd(sd->trade_partner)) == NULL) { + if ((tsd = iMap->id2sd(sd->trade_partner)) == NULL) { clif->tradestart(sd, 1); // character does not exist sd->trade_partner=0; return; @@ -135,7 +135,7 @@ void trade_tradeack(struct map_session_data *sd, int type) // Players can not request trade from far away, unless they are allowed to use @trade. // Check here as well since the original character could had warped. - if (!pc_can_use_command(sd, "@trade") && + if (!iPc->can_use_command(sd, "@trade") && (sd->bl.m != tsd->bl.m || !check_distance_bl(&sd->bl, &tsd->bl, TRADE_DISTANCE))) { clif->tradestart(sd, 0); // too far sd->trade_partner=0; @@ -201,9 +201,9 @@ int impossible_trade_check(struct map_session_data *sd) if (inventory[index].amount < sd->deal.item[i].amount) { // if more than the player have -> hack sprintf(message_to_gm, msg_txt(538), sd->status.name, sd->status.account_id); // Hack on trade: character '%s' (account: %d) try to trade more items that he has. - intif_wis_message_to_gm(wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm); + intif_wis_message_to_gm(iMap->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm); sprintf(message_to_gm, msg_txt(539), inventory[index].amount, inventory[index].nameid, sd->deal.item[i].amount); // This player has %d of a kind of item (id: %d), and try to trade %d of them. - intif_wis_message_to_gm(wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm); + intif_wis_message_to_gm(iMap->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm); // if we block people if (battle_config.ban_hack_trade < 0) { chrif_char_ask_name(-1, sd->status.name, 1, 0, 0, 0, 0, 0, 0); // type: 1 - block @@ -220,7 +220,7 @@ int impossible_trade_check(struct map_session_data *sd) // message about the ban strcpy(message_to_gm, msg_txt(508)); // This player hasn't been banned (Ban option is disabled). - intif_wis_message_to_gm(wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm); + intif_wis_message_to_gm(iMap->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm); return 1; } inventory[index].amount -= sd->deal.item[i].amount; // remove item from inventory @@ -329,7 +329,7 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount) if( !sd->state.trading || sd->state.deal_locked > 0 ) return; //Can't add stuff. - if( (target_sd = map_id2sd(sd->trade_partner)) == NULL ) + if( (target_sd = iMap->id2sd(sd->trade_partner)) == NULL ) { trade_tradecancel(sd); return; @@ -350,10 +350,10 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount) return; item = &sd->status.inventory[index]; - src_lv = pc_get_group_level(sd); - dst_lv = pc_get_group_level(target_sd); + src_lv = iPc->get_group_level(sd); + dst_lv = iPc->get_group_level(target_sd); 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 + (iPc->get_partner(sd) != target_sd || !itemdb_canpartnertrade(item, src_lv, dst_lv)) ) //Can't partner-trade { clif->message (sd->fd, msg_txt(260)); clif->tradeitemok(sd, index+2, 1); @@ -413,7 +413,7 @@ void trade_tradeaddzeny(struct map_session_data* sd, int amount) if( !sd->state.trading || sd->state.deal_locked > 0 ) return; //Can't add stuff. - if( (target_sd = map_id2sd(sd->trade_partner)) == NULL ) + if( (target_sd = iMap->id2sd(sd->trade_partner)) == NULL ) { trade_tradecancel(sd); return; @@ -439,7 +439,7 @@ void trade_tradeok(struct map_session_data *sd) if(sd->state.deal_locked || !sd->state.trading) return; - if ((target_sd = map_id2sd(sd->trade_partner)) == NULL) { + if ((target_sd = iMap->id2sd(sd->trade_partner)) == NULL) { trade_tradecancel(sd); return; } @@ -457,7 +457,7 @@ void trade_tradecancel(struct map_session_data *sd) struct map_session_data *target_sd; int trade_i; - target_sd = map_id2sd(sd->trade_partner); + target_sd = iMap->id2sd(sd->trade_partner); if(!sd->state.trading) { // Not trade acepted @@ -520,7 +520,7 @@ void trade_tradecommit(struct map_session_data *sd) if (!sd->state.trading || !sd->state.deal_locked) //Locked should be 1 (pressed ok) before you can press trade. return; - if ((tsd = map_id2sd(sd->trade_partner)) == NULL) { + if ((tsd = iMap->id2sd(sd->trade_partner)) == NULL) { trade_tradecancel(sd); return; } @@ -555,9 +555,9 @@ void trade_tradecommit(struct map_session_data *sd) { n = sd->deal.item[trade_i].index; - flag = pc_additem(tsd, &sd->status.inventory[n], sd->deal.item[trade_i].amount,LOG_TYPE_TRADE); + flag = iPc->additem(tsd, &sd->status.inventory[n], sd->deal.item[trade_i].amount,LOG_TYPE_TRADE); if (flag == 0) - pc_delitem(sd, n, sd->deal.item[trade_i].amount, 1, 6, LOG_TYPE_TRADE); + iPc->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); sd->deal.item[trade_i].index = 0; @@ -567,9 +567,9 @@ void trade_tradecommit(struct map_session_data *sd) { n = tsd->deal.item[trade_i].index; - flag = pc_additem(sd, &tsd->status.inventory[n], tsd->deal.item[trade_i].amount,LOG_TYPE_TRADE); + flag = iPc->additem(sd, &tsd->status.inventory[n], tsd->deal.item[trade_i].amount,LOG_TYPE_TRADE); if (flag == 0) - pc_delitem(tsd, n, tsd->deal.item[trade_i].amount, 1, 6, LOG_TYPE_TRADE); + iPc->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); tsd->deal.item[trade_i].index = 0; @@ -578,14 +578,14 @@ void trade_tradecommit(struct map_session_data *sd) } if( sd->deal.zeny ) { - pc_payzeny(sd ,sd->deal.zeny, LOG_TYPE_TRADE, tsd); - pc_getzeny(tsd,sd->deal.zeny,LOG_TYPE_TRADE, sd); + iPc->payzeny(sd ,sd->deal.zeny, LOG_TYPE_TRADE, tsd); + iPc->getzeny(tsd,sd->deal.zeny,LOG_TYPE_TRADE, sd); sd->deal.zeny = 0; } if ( tsd->deal.zeny) { - pc_payzeny(tsd,tsd->deal.zeny,LOG_TYPE_TRADE, sd); - pc_getzeny(sd ,tsd->deal.zeny,LOG_TYPE_TRADE, tsd); + iPc->payzeny(tsd,tsd->deal.zeny,LOG_TYPE_TRADE, sd); + iPc->getzeny(sd ,tsd->deal.zeny,LOG_TYPE_TRADE, tsd); tsd->deal.zeny = 0; } @@ -601,7 +601,7 @@ void trade_tradecommit(struct map_session_data *sd) clif->tradecompleted(tsd, 0); // save both player to avoid crash: they always have no advantage/disadvantage between the 2 players - if (save_settings&1) + if (iMap->save_settings&1) { chrif_save(sd,0); chrif_save(tsd,0); |