diff options
author | glighta <glighta@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-11-12 00:06:25 +0000 |
---|---|---|
committer | glighta <glighta@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-11-12 00:06:25 +0000 |
commit | ae57ff81700dbe6714ef107b34510457e9c9c5b6 (patch) | |
tree | e624b5ac4214e5ac9e00aee596055ce19ff95be5 /src/map/trade.c | |
parent | 20e444cce123f97b5e2d60cfb4c134c08479fb41 (diff) | |
download | hercules-ae57ff81700dbe6714ef107b34510457e9c9c5b6.tar.gz hercules-ae57ff81700dbe6714ef107b34510457e9c9c5b6.tar.bz2 hercules-ae57ff81700dbe6714ef107b34510457e9c9c5b6.tar.xz hercules-ae57ff81700dbe6714ef107b34510457e9c9c5b6.zip |
-Add Homon-S skills, 1st implementation (all done except Eleanors)
--Upd Skill conf to set land-limit for homonculus by default (ground skill limit)
--Mv MH_HEILIGE_STANGE and MH_ANGRIFFS_MODUS skill from Eleanor to Bayeri
-Enforce all zeny transaction to use pc_payzeny and pc_getzeny handlers, (auto log and clif)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16914 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/trade.c')
-rw-r--r-- | src/map/trade.c | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/src/map/trade.c b/src/map/trade.c index a423b4118..0b6431c07 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -74,15 +74,15 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta 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 return ; } - + target_sd->trade_partner = sd->status.account_id; sd->trade_partner = target_sd->status.account_id; clif_traderequest(target_sd, sd->status.name); @@ -106,7 +106,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) { clif_tradestart(sd, 1); // character does not exist sd->trade_partner=0; @@ -177,7 +177,7 @@ int impossible_trade_check(struct map_session_data *sd) int i, index; nullpo_retr(1, sd); - + if(sd->deal.zeny > sd->status.zeny) { pc_setglobalreg(sd,"ZENY_HACKER",1); @@ -220,7 +220,7 @@ int impossible_trade_check(struct map_session_data *sd) } else // 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); return 1; } @@ -257,7 +257,7 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd) n = sd->deal.item[trade_i].index; if (amount > inventory[n].amount) return 0; //qty Exploit? - + data = itemdb_search(inventory[n].nameid); i = MAX_INVENTORY; if (itemdb_isstackable2(data)) { //Stackable item. @@ -272,7 +272,7 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd) break; } } - + if (i == MAX_INVENTORY) {// look for an empty slot. for(i = 0; i < MAX_INVENTORY && inventory2[i].nameid; i++); if (i == MAX_INVENTORY) @@ -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) { trade_tradecancel(sd); return; @@ -470,7 +470,7 @@ void trade_tradecancel(struct map_session_data *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; @@ -498,7 +498,7 @@ void trade_tradecancel(struct map_session_data *sd) 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); target_sd->deal.zeny = 0; @@ -525,9 +525,9 @@ void trade_tradecommit(struct map_session_data *sd) trade_tradecancel(sd); return; } - + sd->state.deal_locked = 2; - + if (tsd->state.deal_locked < 2) return; //Not yet time for trading. @@ -547,7 +547,7 @@ void trade_tradecommit(struct map_session_data *sd) trade_tradecancel(sd); return; } - + // trade is accepted and correct. for( trade_i = 0; trade_i < 10; trade_i++ ) { @@ -580,37 +580,28 @@ void trade_tradecommit(struct map_session_data *sd) if( sd->deal.zeny || tsd->deal.zeny ) { - sd->status.zeny += tsd->deal.zeny - sd->deal.zeny; - tsd->status.zeny += sd->deal.zeny - tsd->deal.zeny; - - //Logs Zeny (T)rade [Lupus] - if( sd->deal.zeny ) - log_zeny(tsd, LOG_TYPE_TRADE, sd, sd->deal.zeny); - if( tsd->deal.zeny ) - log_zeny(sd, LOG_TYPE_TRADE, tsd, tsd->deal.zeny); + pc_getzeny(sd,tsd->deal.zeny - sd->deal.zeny,LOG_TYPE_TRADE, tsd); + pc_getzeny(tsd,sd->deal.zeny - tsd->deal.zeny,LOG_TYPE_TRADE, sd); sd->deal.zeny = 0; tsd->deal.zeny = 0; - - clif_updatestatus(sd, SP_ZENY); - clif_updatestatus(tsd, SP_ZENY); } - + sd->state.deal_locked = 0; sd->trade_partner = 0; sd->state.trading = 0; - + tsd->state.deal_locked = 0; tsd->trade_partner = 0; tsd->state.trading = 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) { - chrif_save(sd,0); + chrif_save(sd,0); chrif_save(tsd,0); } } |