From d6622f54398a780d9c007c75855971ebb2a19ea1 Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Thu, 25 Jun 2020 08:05:10 +0200 Subject: Enable trading while Megaphone input box is present --- src/map/clif.c | 4 ++-- src/map/trade.c | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/map/clif.c b/src/map/clif.c index 491e4f805..deb53bccb 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -12454,7 +12454,7 @@ static void clif_parse_TradeRequest(int fd, struct map_session_data *sd) struct map_session_data *t_sd = map->id2sd(RFIFOL(fd, 2)); - if (sd->chat_id == 0 && pc_cant_act(sd)) + if (pc_cant_act_except_npc_chat(sd) || (sd->npc_id != 0 && sd->state.using_megaphone == 0)) return; //You can trade while in a chatroom. // @noask [LuzZza] @@ -13330,7 +13330,7 @@ static void clif_parse_NpcStringInput(int fd, struct map_session_data *sd) __att /// 01d5 .W .L .?B static void clif_parse_NpcStringInput(int fd, struct map_session_data *sd) { - if (sd->state.trading || pc_isdead(sd) || pc_isvending(sd)) + if ((sd->state.trading != 0 && sd->state.using_megaphone == 0) || pc_isdead(sd) || pc_isvending(sd)) return; int len = RFIFOW(fd, 2); diff --git a/src/map/trade.c b/src/map/trade.c index e727c3c70..31970fbf9 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -63,7 +63,7 @@ static void trade_traderequest(struct map_session_data *sd, struct map_session_d return; } - if (target_sd->npc_id) { + if (target_sd->npc_id != 0 && target_sd->state.using_megaphone == 0) { //Trade fails if you are using an NPC. clif->tradestart(sd, 2); return; @@ -166,9 +166,10 @@ static void trade_tradeack(struct map_session_data *sd, int type) } //Check if you can start trade. - if (sd->npc_id || sd->state.vending || sd->state.prevend || sd->state.buyingstore || sd->state.storage_flag != STORAGE_FLAG_CLOSED - || tsd->npc_id || tsd->state.vending || tsd->state.prevend || tsd->state.buyingstore || tsd->state.storage_flag != STORAGE_FLAG_CLOSED - ) { + if ((sd->npc_id != 0 && sd->state.using_megaphone == 0) || sd->state.vending != 0 || sd->state.prevend != 0 + || sd->state.buyingstore != 0 || sd->state.storage_flag != STORAGE_FLAG_CLOSED + || (tsd->npc_id != 0 && tsd->state.using_megaphone == 0) || tsd->state.vending != 0 || tsd->state.prevend != 0 + || tsd->state.buyingstore != 0 || tsd->state.storage_flag != STORAGE_FLAG_CLOSED) { //Fail clif->tradestart(sd, 2); clif->tradestart(tsd, 2); -- cgit v1.2.3-60-g2f50