summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAsheraf <acheraf1998@gmail.com>2019-05-26 07:51:34 +0100
committerHaru <haru@dotalux.com>2020-02-09 20:52:57 +0100
commit28ae3af5455447a379320a83a32658e6e2c154b3 (patch)
tree8fc7e63c89e34ebb479853a267fc462b04ed3e04 /src
parent7880742956210d463ba364b88dc7ddc5ca51355c (diff)
downloadhercules-28ae3af5455447a379320a83a32658e6e2c154b3.tar.gz
hercules-28ae3af5455447a379320a83a32658e6e2c154b3.tar.bz2
hercules-28ae3af5455447a379320a83a32658e6e2c154b3.tar.xz
hercules-28ae3af5455447a379320a83a32658e6e2c154b3.zip
Add a function to send PACKET_ZC_STATE_CHANGE to a single target
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c28
-rw-r--r--src/map/clif.h1
2 files changed, 29 insertions, 0 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 9e69dcc44..d41a17e0b 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -4059,6 +4059,33 @@ static void clif_changeoption(struct block_list *bl)
}
}
+static void clif_changeoption_target(struct block_list *bl, struct block_list *target_bl, enum send_target target)
+{
+ nullpo_retv(bl);
+ nullpo_retv(target_bl);
+
+ struct status_change *sc = status->get_sc(bl);
+
+ if (sc == NULL && bl->type != BL_NPC) // How can an option change if there's no sc?
+ return;
+
+ struct map_session_data *sd = BL_CAST(BL_PC, bl);
+ struct PACKET_ZC_STATE_CHANGE p;
+ p.packetType = HEADER_ZC_STATE_CHANGE;
+ p.AID = bl->id;
+ p.bodyState = (sc != NULL) ? sc->opt1 : 0;
+ p.healthState = (sc != NULL) ? sc->opt2 : 0;
+ p.effectState = (sc != NULL) ? sc->option : BL_UCCAST(BL_NPC, bl)->option;
+ p.isPKModeON = (sd != NULL) ? sd->status.karma : 0;
+ if (clif->isdisguised(bl)) {
+ p.AID = -bl->id;
+ clif->send(&p, sizeof(p), target_bl, target);
+ p.AID = bl->id;
+ p.effectState = OPTION_INVISIBLE;
+ }
+ clif->send(&p, sizeof(p), target_bl, target);
+}
+
/// Displays status change effects on NPCs/monsters (ZC_NPC_SHOWEFST_UPDATE).
/// 028a <id>.L <effect state>.L <level>.L <showEFST>.L
static void clif_changeoption2(struct block_list *bl)
@@ -24192,6 +24219,7 @@ void clif_defaults(void)
/* visual effects client-side */
clif->misceffect = clif_misceffect;
clif->changeoption = clif_changeoption;
+ clif->changeoption_target = clif_changeoption_target;
clif->changeoption2 = clif_changeoption2;
clif->emotion = clif_emotion;
clif->talkiebox = clif_talkiebox;
diff --git a/src/map/clif.h b/src/map/clif.h
index 252dfefe1..25ac65af5 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -1006,6 +1006,7 @@ struct clif_interface {
/* visual effects client-side */
void (*misceffect) (struct block_list* bl,int type);
void (*changeoption) (struct block_list* bl);
+ void (*changeoption_target) (struct block_list *bl, struct block_list *target_bl, enum send_target target);
void (*changeoption2) (struct block_list* bl);
void (*emotion) (struct block_list *bl,int type);
void (*talkiebox) (struct block_list* bl, const char* talkie);