From 28ae3af5455447a379320a83a32658e6e2c154b3 Mon Sep 17 00:00:00 2001 From: Asheraf Date: Sun, 26 May 2019 07:51:34 +0100 Subject: Add a function to send PACKET_ZC_STATE_CHANGE to a single target --- src/map/clif.c | 28 ++++++++++++++++++++++++++++ src/map/clif.h | 1 + 2 files changed, 29 insertions(+) (limited to 'src/map') 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 .L .L .L .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); -- cgit v1.2.3-70-g09d2