summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-06-25 07:34:49 +0200
committerKenpachi Developer <Kenpachi.Developer@gmx.de>2020-06-25 07:34:49 +0200
commit870fa2b6005efb046e12888eb2062a3ec611fe5a (patch)
treed6ba45f08a6ccec7b0fb22af5e1ee62bf13cae9a /src
parent9a06857cc3ad2ad8f00b52ccc33f6c07342ad985 (diff)
downloadhercules-870fa2b6005efb046e12888eb2062a3ec611fe5a.tar.gz
hercules-870fa2b6005efb046e12888eb2062a3ec611fe5a.tar.bz2
hercules-870fa2b6005efb046e12888eb2062a3ec611fe5a.tar.xz
hercules-870fa2b6005efb046e12888eb2062a3ec611fe5a.zip
Add state using_megaphone to struct map_session_data and implement its (un)setting
Diffstat (limited to 'src')
-rw-r--r--src/map/itemdb.h1
-rw-r--r--src/map/pc.c3
-rw-r--r--src/map/pc.h1
-rw-r--r--src/map/script.c2
4 files changed, 7 insertions, 0 deletions
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;
}