From 870fa2b6005efb046e12888eb2062a3ec611fe5a Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Thu, 25 Jun 2020 07:34:49 +0200 Subject: Add state using_megaphone to struct map_session_data and implement its (un)setting --- src/map/itemdb.h | 1 + src/map/pc.c | 3 +++ src/map/pc.h | 1 + src/map/script.c | 2 ++ 4 files changed, 7 insertions(+) (limited to 'src') diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 4b06a21d6..39f0e7945 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -152,6 +152,7 @@ enum item_itemid { ITEMID_BUBBLE_GUM = 12210, ITEMID_GIANT_FLY_WING = 12212, ITEMID_NEURALIZER = 12213, + ITEMID_MEGAPHONE = 12221, ITEMID_M_CENTER_POTION = 12241, ITEMID_M_AWAKENING_POTION = 12242, ITEMID_M_BERSERK_POTION = 12243, diff --git a/src/map/pc.c b/src/map/pc.c index c1261c839..4c3f56280 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5320,6 +5320,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; diff --git a/src/map/pc.h b/src/map/pc.h index f2e911af3..074c01a13 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -224,6 +224,7 @@ struct map_session_data { unsigned int size :2; // for tiny/large types unsigned int night :1; //Holds whether or not the player currently has the SI_NIGHT effect on. [Skotlex] unsigned int using_fake_npc :1; + unsigned int using_megaphone : 1; //!< Whether the character is currently using a Megephone (ID=12221). unsigned int rewarp :1; //Signals that a player should warp as soon as he is done loading a map. [Skotlex] unsigned int killer : 1; unsigned int killable : 1; diff --git a/src/map/script.c b/src/map/script.c index 743a1779a..b79ac1603 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -12574,6 +12574,8 @@ static BUILDIN(loudhailer) clif->broadcast(&sd->bl, mes_formatted, (int)len_formatted, BC_MEGAPHONE, ALL_CLIENT); + sd->state.using_megaphone = 0; + return true; } -- cgit v1.2.3-70-g09d2