From 7da438ed9885aa05f4d2748e655ad889b4d39c85 Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Thu, 25 Jun 2020 08:07:51 +0200 Subject: Enable vending shop features while Megaphone input box is present --- src/map/clif.c | 13 ++++++------- src/map/vending.c | 6 ++++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/map/clif.c b/src/map/clif.c index deb53bccb..715e829f0 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -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 != 0 && sd->state.using_megaphone == 0) || pc_isdead(sd) || pc_isvending(sd)) + if (((sd->state.trading != 0 || pc_isvending(sd)) && sd->state.using_megaphone == 0) || pc_isdead(sd)) return; int len = RFIFOW(fd, 2); @@ -14597,7 +14597,7 @@ static void clif_parse_CloseVending(int fd, struct map_session_data *sd) __attri /// 012e static void clif_parse_CloseVending(int fd, struct map_session_data *sd) { - if (sd->npc_id || sd->state.buyingstore || sd->state.trading) + if ((sd->npc_id != 0 && sd->state.using_megaphone == 0) || sd->state.buyingstore != 0 || sd->state.trading != 0) return; vending->close(sd); @@ -14608,12 +14608,9 @@ static void clif_parse_VendingListReq(int fd, struct map_session_data *sd) __att /// 0130 .L static void clif_parse_VendingListReq(int fd, struct map_session_data *sd) { - if (pc_istrading(sd) || pc_isdead(sd)) + if (pc_istrading_except_npc(sd) || (sd->npc_id != 0 && sd->state.using_megaphone == 0) || pc_isdead(sd)) return; - if( sd->npc_id ) {// using an NPC - return; - } vending->list(sd,RFIFOL(fd,2)); } @@ -14675,8 +14672,10 @@ static void clif_parse_OpenVending(int fd, struct map_session_data *sd) __attrib /// 1 = open static void clif_parse_OpenVending(int fd, struct map_session_data *sd) { - if (pc_istrading(sd) || pc_isdead(sd) || sd->state.vending || sd->state.buyingstore) + if (pc_istrading_except_npc(sd) || (sd->npc_id != 0 && sd->state.using_megaphone == 0) + || pc_isdead(sd) || sd->state.vending != 0 || sd->state.buyingstore != 0) { return; + } int len = (int)RFIFOW(fd, 2) - 85; diff --git a/src/map/vending.c b/src/map/vending.c index 4fd009025..9b3f48f38 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -251,8 +251,10 @@ static void vending_openvending(struct map_session_data *sd, const char *message int vending_skill_lvl; nullpo_retv(sd); - if ( pc_isdead(sd) || !sd->state.prevend || pc_istrading(sd)) - return; // can't open vendings lying dead || didn't use via the skill (wpe/hack) || can't have 2 shops at once + if (pc_isdead(sd) || sd->state.prevend == 0 || pc_istrading_except_npc(sd) + || (sd->npc_id != 0 && sd->state.using_megaphone == 0)) { + return; // Can't open vendings lying dead. || Didn't use via the skill. (wpe/hack) || Can't have 2 shops at once. + } vending_skill_lvl = pc->checkskill(sd, MC_VENDING); // skill level and cart check -- cgit v1.2.3-60-g2f50