summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index c1261c839..64e52848f 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;
@@ -8148,12 +8161,10 @@ static int pc_dead(struct map_session_data *sd, struct block_list *src)
if (sd->status.pet_id > 0 && sd->pd != NULL) {
struct pet_data *pd = sd->pd;
- if (map->list[sd->bl.m].flag.noexppenalty == 0) {
+ if (map->list[sd->bl.m].flag.noexppenalty == 0)
pet->set_intimate(pd, pd->pet.intimate - pd->petDB->die);
- clif->send_petdata(sd, sd->pd, 1, pd->pet.intimate);
- }
- if (sd->pd->target_id != 0) // Unlock all targets.
+ if (sd->pd != NULL && sd->pd->target_id != 0) // Unlock all targets.
pet->unlocktarget(sd->pd);
}
@@ -8173,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);
@@ -8196,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;
@@ -12117,7 +12128,6 @@ static void pc_scdata_received(struct map_session_data *sd)
{
nullpo_retv(sd);
pc->inventory_rentals(sd);
- clif->show_modifiers(sd);
if (sd->expiration_time != 0) { // don't display if it's unlimited or unknow value
time_t exp_time = sd->expiration_time;