diff options
author | Haru <haru@dotalux.com> | 2020-06-28 03:21:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-28 03:21:28 +0200 |
commit | 9b22213254d64b2c155c6700030303852fd5b912 (patch) | |
tree | 7eb4047ade3194749eee98d62beca06fdf820a39 /src/map/pc.c | |
parent | 44513531ea39c6bdb464ef74ef60a21d70084904 (diff) | |
parent | 1d00e2268b7a20077d9d61dc8989b9f770344e59 (diff) | |
download | hercules-9b22213254d64b2c155c6700030303852fd5b912.tar.gz hercules-9b22213254d64b2c155c6700030303852fd5b912.tar.bz2 hercules-9b22213254d64b2c155c6700030303852fd5b912.tar.xz hercules-9b22213254d64b2c155c6700030303852fd5b912.zip |
Merge pull request #2775 from Kenpachi2k13/megaphone
Fix Megaphone behaviour
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index ad669c0c8..9b5764bd6 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5163,7 +5163,7 @@ static int pc_useitem(struct map_session_data *sd, int n) nullpo_ret(sd); Assert_ret(n >= 0 && n < sd->status.inventorySize); - if ((sd->npc_id != 0 && (sd->npc_item_flag & ITEMENABLEDNPC_CONSUME) == 0) + if ((sd->npc_id != 0 && sd->state.using_megaphone == 0 && (sd->npc_item_flag & ITEMENABLEDNPC_CONSUME) == 0) || (sd->state.workinprogress & 1) != 0) { #if PACKETVER >= 20110308 clif->msgtable(sd, MSG_BUSY); @@ -5190,6 +5190,16 @@ static int pc_useitem(struct map_session_data *sd, int n) // Store information for later use before it is lost (via pc->delitem) [Paradox924X] nameid = sd->inventory_data[n]->nameid; + if (nameid == ITEMID_MEGAPHONE && ((sd->state.workinprogress & 2) != 0 || sd->state.using_megaphone != 0 + || sd->npc_id != 0)) { +#if PACKETVER >= 20110308 + clif->msgtable(sd, MSG_BUSY); +#else + clif->messagecolor_self(sd->fd, COLOR_WHITE, msg_sd(sd, 48)); +#endif + return 0; + } + if (nameid != ITEMID_NAUTHIZ && sd->sc.opt1 > 0 && sd->sc.opt1 != OPT1_STONEWAIT && sd->sc.opt1 != OPT1_BURNING) return 0; @@ -5320,6 +5330,9 @@ static int pc_useitem(struct map_session_data *sd, int n) // Update item use time. sd->canuseitem_tick = tick + battle_config.item_use_interval; + if (nameid == ITEMID_MEGAPHONE) + sd->state.using_megaphone = 1; + script->run_use_script(sd, sd->inventory_data[n], npc->fake_nd->bl.id); script->potion_flag = 0; @@ -8171,7 +8184,7 @@ static int pc_dead(struct map_session_data *sd, struct block_list *src) duel->reject(sd->duel_invite, sd); } - if (sd->npc_id != 0 && sd->st != NULL && sd->st->state != RUN) + if (sd->npc_id != 0 && sd->state.using_megaphone == 0 && sd->st != NULL && sd->st->state != RUN) npc->event_dequeue(sd); pc_setglobalreg(sd, script->add_variable("PC_DIE_COUNTER"), sd->die_counter + 1); @@ -8194,7 +8207,7 @@ static int pc_dead(struct map_session_data *sd, struct block_list *src) npc->script_event(sd, NPCE_DIE); // Clear anything NPC-related if character died while interacting with one. - if ((sd->npc_id != 0 || sd->npc_shopid != 0) && sd->state.dialog != 0) { + if (((sd->npc_id != 0 && sd->state.using_megaphone == 0) || sd->npc_shopid != 0) && sd->state.dialog != 0) { if (sd->state.using_fake_npc != 0) { clif->clearunit_single(sd->npc_id, CLR_OUTSIGHT, sd->fd); sd->state.using_fake_npc = 0; |