From b5b4c77e5fff30072c7c24ed8a8d7316d08d8c9c Mon Sep 17 00:00:00 2001 From: skotlex Date: Thu, 20 Apr 2006 16:04:47 +0000 Subject: - Added support for n to specify minutes to @charban. - Fixed a logic typo on the way dummy_npc_id was defined. - Added state.trading to specify when a trading has started. Now you should be able to walk around until the trade is either rejected or started. - Armor defense is no longer reduced by the amount of characters targetting you. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6192 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/atcommand.c | 2 +- src/map/battle.c | 7 ++++--- src/map/clif.c | 4 ++-- src/map/map.h | 3 ++- src/map/npc.c | 1 + src/map/npc.h | 2 +- src/map/trade.c | 13 +++++++++---- 7 files changed, 20 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index adaa5c117..b10d4b6c1 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -4625,7 +4625,7 @@ int atcommand_char_ban( if (modif_p[0] == 's') { second = value; modif_p++; - } else if (modif_p[0] == 'm' && modif_p[1] == 'n') { + } else if (modif_p[0] == 'n' || (modif_p[0] == 'm' && modif_p[1] == 'n')) { minute = value; modif_p = modif_p + 2; } else if (modif_p[0] == 'h') { diff --git a/src/map/battle.c b/src/map/battle.c index 529a32b33..44704b0b0 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -1899,10 +1899,11 @@ static struct Damage battle_calc_weapon_attack( target_count = unit_counttargeted(target,battle_config.vit_penalty_count_lv); if(target_count >= battle_config.vit_penalty_count) { if(battle_config.vit_penalty_type == 1) { - def1 = (def1 * (100 - (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num))/100; +// armor defense shouldn't be reduced from what people are saying. [Skotlex] +// def1 = (def1 * (100 - (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num))/100; def2 = (def2 * (100 - (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num))/100; } else { //Assume type 2 - def1 -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num; +// def1 -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num; def2 -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num; } } @@ -4131,7 +4132,7 @@ void battle_set_defaults() { battle_config.gm_cant_drop_min_lv = 1; battle_config.gm_cant_drop_max_lv = 0; battle_config.disp_hpmeter = 60; - battle_config.skill_wall_check = 0; + battle_config.skill_wall_check = 1; battle_config.cell_stack_limit = 1; battle_config.bone_drop = 0; battle_config.buyer_name = 1; diff --git a/src/map/clif.c b/src/map/clif.c index 484abb02a..3aba4a0a1 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -161,10 +161,10 @@ enum { //Removed sd->npc_shopid because there is no packet sent from the client when you cancel a buy! //Quick check to know if the player shouldn't be "busy" with something else to deny action requests. [Skotlex] -#define clif_cant_act(sd) (sd->npc_id || sd->vender_id || sd->chatID || sd->sc.opt1 || sd->trade_partner || sd->state.storage_flag) +#define clif_cant_act(sd) (sd->npc_id || sd->vender_id || sd->chatID || sd->sc.opt1 || sd->state.trading || sd->state.storage_flag) // Checks if SD is in a trade/shop (where messing with the inventory can cause problems/exploits) -#define clif_trading(sd) (sd->npc_id || sd->vender_id || sd->trade_partner) +#define clif_trading(sd) (sd->npc_id || sd->vender_id || sd->state.trading ) //To idenfity disguised characters. #define disguised(bl) (bl->type==BL_PC && ((TBL_PC*)bl)->disguise) diff --git a/src/map/map.h b/src/map/map.h index 4a558f9cb..1c6c8214b 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -486,7 +486,8 @@ struct map_session_data { unsigned showexp :1; unsigned showzeny :1; unsigned mainchat :1; //[LuzZza] - unsigned deal_locked :2; + unsigned trading :1; //[Skotlex] is 1 only after a trade has started. + unsigned deal_locked :2; //1: Clicked on OK. 2: Clicked on TRADE unsigned party_sent :1; unsigned guild_sent :1; unsigned monster_ignore :1; // for monsters to ignore a character [Valaris] [zzo] diff --git a/src/map/npc.c b/src/map/npc.c index e0dda3344..bd83131ed 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -50,6 +50,7 @@ static int npc_mob=0; static int npc_delay_mob=0; static int npc_cache_mob=0; char *current_file = NULL; +int dummy_npc_id=0; int npc_get_new_npc_id(void){ return npc_id++; } static struct dbt *ev_db; diff --git a/src/map/npc.h b/src/map/npc.h index a44897027..2ee4999c6 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -66,7 +66,7 @@ int npc_remove_map(struct npc_data *nd); int npc_unload(struct npc_data *nd); int npc_reload(void); -static int dummy_npc_id; +extern int dummy_npc_id; extern char *current_file; diff --git a/src/map/trade.c b/src/map/trade.c index eb870418d..e808083d1 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -45,7 +45,7 @@ void trade_traderequest(struct map_session_data *sd, int target_id) { if ( pc_can_give_items(level) || pc_can_give_items(pc_isGM(target_sd)) ) //check if both GMs are allowed to trade { clif_displaymessage(sd->fd, msg_txt(246)); - trade_tradecancel(sd); // GM is not allowed to trade + trade_tradecancel(sd); // GM is not allowed to trade } else if ((target_sd->trade_partner != 0) || (sd->trade_partner != 0)) { trade_tradecancel(sd); // person is in another trade } else { @@ -83,8 +83,9 @@ void trade_tradeack(struct map_session_data *sd, int type) { target_sd->trade_partner = 0; } - if (type == 3) { //Initiate trade + sd->state.trading = 1; + target_sd->state.trading = 1; memset(&sd->deal, 0, sizeof(sd->deal)); memset(&target_sd->deal, 0, sizeof(target_sd->deal)); } @@ -284,7 +285,7 @@ void trade_tradeadditem(struct map_session_data *sd, int index, int amount) { int trade_i, trade_weight, nameid; nullpo_retv(sd); - if ((target_sd = map_id2sd(sd->trade_partner)) == NULL || sd->state.deal_locked > 0) + if (!sd->state.trading || (target_sd = map_id2sd(sd->trade_partner)) == NULL || sd->state.deal_locked > 0) return; //Can't add stuff. if (index == 0) @@ -428,8 +429,10 @@ void trade_tradecancel(struct map_session_data *sd) { } sd->state.deal_locked = 0; sd->trade_partner = 0; + sd->state.trading = 0; target_sd->state.deal_locked = 0; target_sd->trade_partner = 0; + target_sd->state.trading = 0; clif_tradecancelled(sd); clif_tradecancelled(target_sd); } @@ -446,7 +449,7 @@ void trade_tradecommit(struct map_session_data *sd) { nullpo_retv(sd); - if ((target_sd = map_id2sd(sd->trade_partner)) != NULL) { + if (sd->state.trading && (target_sd = map_id2sd(sd->trade_partner)) != NULL) { if ((sd->state.deal_locked >= 1) && (target_sd->state.deal_locked >= 1)) { // both have pressed 'ok' if (sd->state.deal_locked < 2) { // set locked to 2 sd->state.deal_locked = 2; @@ -545,8 +548,10 @@ void trade_tradecommit(struct map_session_data *sd) { } sd->state.deal_locked = 0; sd->trade_partner = 0; + sd->state.trading = 0; target_sd->state.deal_locked = 0; target_sd->trade_partner = 0; + target_sd->state.trading = 0; clif_tradecompleted(sd, 0); clif_tradecompleted(target_sd, 0); // save both player to avoid crash: they always have no advantage/disadvantage between the 2 players -- cgit v1.2.3-70-g09d2