summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-06-25 08:05:10 +0200
committerKenpachi Developer <Kenpachi.Developer@gmx.de>2020-06-25 08:05:10 +0200
commitd6622f54398a780d9c007c75855971ebb2a19ea1 (patch)
tree2d848946ec7483e23018dd4d69ad927880db6deb /src
parent7aacf9eed8162c18733364cc9b52f1b9358bc9db (diff)
downloadhercules-d6622f54398a780d9c007c75855971ebb2a19ea1.tar.gz
hercules-d6622f54398a780d9c007c75855971ebb2a19ea1.tar.bz2
hercules-d6622f54398a780d9c007c75855971ebb2a19ea1.tar.xz
hercules-d6622f54398a780d9c007c75855971ebb2a19ea1.zip
Enable trading while Megaphone input box is present
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c4
-rw-r--r--src/map/trade.c9
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 <packet len>.W <npc id>.L <string>.?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);