summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorAsheraf <acheraf1998@gmail.com>2019-05-26 07:43:35 +0100
committerHaru <haru@dotalux.com>2020-02-09 20:52:57 +0100
commit7880742956210d463ba364b88dc7ddc5ca51355c (patch)
tree63c72157378bf56b3ab6782b9ee39f5476948825 /src/map/clif.c
parentc76c63d2dddb8c7ec4461dd660b7bb0210f4db96 (diff)
downloadhercules-7880742956210d463ba364b88dc7ddc5ca51355c.tar.gz
hercules-7880742956210d463ba364b88dc7ddc5ca51355c.tar.bz2
hercules-7880742956210d463ba364b88dc7ddc5ca51355c.tar.xz
hercules-7880742956210d463ba364b88dc7ddc5ca51355c.zip
Update PACKET_ZC_STATE_CHANGE to use struct format
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c56
1 files changed, 18 insertions, 38 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 942e492c2..9e69dcc44 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -4032,51 +4032,31 @@ static void clif_misceffect(struct block_list *bl, int type)
/// 0229 <id>.L <body state>.W <health state>.W <effect state>.L <pk mode>.B (ZC_STATE_CHANGE3)
static void clif_changeoption(struct block_list *bl)
{
- unsigned char buf[32];
- struct status_change *sc;
- struct map_session_data* sd;
-
nullpo_retv(bl);
- if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; //How can an option change if there's no sc?
+ struct status_change *sc = status->get_sc(bl);
- sd = BL_CAST(BL_PC, bl);
+ if (sc == NULL && bl->type != BL_NPC) // How can an option change if there's no sc?
+ return;
-#if PACKETVER >= 7
- WBUFW(buf,0) = 0x229;
- WBUFL(buf,2) = bl->id;
- WBUFW(buf,6) = (sc) ? sc->opt1 : 0;
- WBUFW(buf,8) = (sc) ? sc->opt2 : 0;
- WBUFL(buf,10) = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? BL_UCCAST(BL_NPC, bl)->option : 0);
- WBUFB(buf,14) = (sd)? sd->status.karma : 0;
- if (clif->isdisguised(bl)) {
- clif->send(buf,packet_len(0x229),bl,AREA_WOS);
- WBUFL(buf,2) = -bl->id;
- clif->send(buf,packet_len(0x229),bl,SELF);
- WBUFL(buf,2) = bl->id;
- WBUFL(buf,10) = OPTION_INVISIBLE;
- clif->send(buf,packet_len(0x229),bl,SELF);
- } else {
- clif->send(buf,packet_len(0x229),bl,AREA);
- }
-#else
- WBUFW(buf,0) = 0x119;
- WBUFL(buf,2) = bl->id;
- WBUFW(buf,6) = (sc) ? sc->opt1 : 0;
- WBUFW(buf,8) = (sc) ? sc->opt2 : 0;
- WBUFL(buf,10) = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? BL_UCCAST(BL_NPC, bl)->option : 0);
- WBUFB(buf,12) = (sd)? sd->status.karma : 0;
+ 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)) {
- clif->send(buf,packet_len(0x119),bl,AREA_WOS);
- WBUFL(buf,2) = -bl->id;
- clif->send(buf,packet_len(0x119),bl,SELF);
- WBUFL(buf,2) = bl->id;
- WBUFW(buf,10) = OPTION_INVISIBLE;
- clif->send(buf,packet_len(0x119),bl,SELF);
+ clif->send(&p, sizeof(p), bl, AREA_WOS);
+ p.AID = -bl->id;
+ clif->send(&p, sizeof(p), bl, SELF);
+ p.AID = bl->id;
+ p.effectState = OPTION_INVISIBLE;
+ clif->send(&p, sizeof(p), bl, SELF);
} else {
- clif->send(buf,packet_len(0x119),bl,AREA);
+ clif->send(&p, sizeof(p), bl, AREA);
}
-#endif
}
/// Displays status change effects on NPCs/monsters (ZC_NPC_SHOWEFST_UPDATE).