summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorDastgir <dastgirpojee@rocketmail.com>2015-12-17 15:38:07 +0530
committerDastgir <dastgirpojee@rocketmail.com>2015-12-25 18:03:59 +0530
commiteb0d0dc677e1d3e584de9202d3140fe6fb6db722 (patch)
treec8786013d81d15649fe0ab5f531bf5a559535d21 /src/map/clif.c
parent8e77c3459e87df92309afe25d25539e6684e2dda (diff)
downloadhercules-eb0d0dc677e1d3e584de9202d3140fe6fb6db722.tar.gz
hercules-eb0d0dc677e1d3e584de9202d3140fe6fb6db722.tar.bz2
hercules-eb0d0dc677e1d3e584de9202d3140fe6fb6db722.tar.xz
hercules-eb0d0dc677e1d3e584de9202d3140fe6fb6db722.zip
New Entity Packets Implemented (Thanks to Rytech)
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c52
1 files changed, 44 insertions, 8 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 63a36fa62..eac7fa91e 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1004,7 +1004,12 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu
p.PacketLength = sizeof(p);
p.objecttype = clif_bl_type(bl);
#endif
+#if PACKETVER >= 20131223
+ p.AID = bl->id;
+ p.GID = (sd)?sd->status.char_id:0; // CCODE
+#else
p.GID = bl->id;
+#endif
p.speed = status->get_speed(bl);
p.bodyState = (sc) ? sc->opt1 : 0;
p.healthState = (sc) ? sc->opt2 : 0;
@@ -1042,8 +1047,8 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu
#if PACKETVER >= 20080102
p.font = (sd) ? sd->status.font : 0;
#endif
-#if PACKETVER >= 20150000 //actual 20120221
- if (bl->type == BL_MOB && battle_config.show_monster_hp_bar) {
+#if PACKETVER >= 20120221
+ if( battle_config.show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl) ) {
p.maxHP = status_get_max_hp(bl);
p.HP = status_get_hp(bl);
p.isBoss = ( ((TBL_MOB*)bl)->spawn && ((TBL_MOB*)bl)->spawn->state.boss ) ? 1 : 0;
@@ -1053,6 +1058,9 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu
p.isBoss = 0;
}
#endif
+#if PACKETVER >= 20150513
+ p.body = 0;
+#endif
clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target);
@@ -1136,7 +1144,12 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) {
p.PacketLength = sizeof(p);
p.objecttype = clif_bl_type(bl);
#endif
+#if PACKETVER >= 20131223
+ p.AID = bl->id;
+ p.GID = (sd)?sd->status.char_id:0; // CCODE
+#else
p.GID = bl->id;
+#endif
p.speed = status->get_speed(bl);
p.bodyState = (sc) ? sc->opt1 : 0;
p.healthState = (sc) ? sc->opt2 : 0;
@@ -1173,8 +1186,8 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) {
#if PACKETVER >= 20080102
p.font = (sd) ? sd->status.font : 0;
#endif
-#if PACKETVER >= 20150000 //actual 20120221
- if (bl->type == BL_MOB && battle_config.show_monster_hp_bar) {
+#if PACKETVER >= 20120221
+ if( battle_config.show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl) ) {
p.maxHP = status_get_max_hp(bl);
p.HP = status_get_hp(bl);
p.isBoss = ( ((TBL_MOB*)bl)->spawn && ((TBL_MOB*)bl)->spawn->state.boss ) ? 1 : 0;
@@ -1184,6 +1197,9 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) {
p.isBoss = 0;
}
#endif
+#if PACKETVER >= 20150513
+ p.body = 0;
+#endif
if( disguised(bl) ) {
nullpo_retv(sd);
if( sd->status.class_ != sd->disguise )
@@ -1222,7 +1238,12 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd,
#if PACKETVER >= 20071106
p.objecttype = clif_bl_type(bl);
#endif
+#if PACKETVER >= 20131223
+ p.AID = bl->id;
+ p.GID = (tsd)?tsd->status.char_id:0; // CCODE
+#else
p.GID = bl->id;
+#endif
p.speed = status->get_speed(bl);
p.bodyState = (sc) ? sc->opt1 : 0;
p.healthState = (sc) ? sc->opt2 : 0;
@@ -1255,8 +1276,8 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd,
#if PACKETVER >= 20080102
p.font = (sd) ? sd->status.font : 0;
#endif
-#if PACKETVER >= 20150000 //actual 20120221
- if (bl->type == BL_MOB && battle_config.show_monster_hp_bar) {
+#if PACKETVER >= 20120221
+ if( battle_config.show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl) ) {
p.maxHP = status_get_max_hp(bl);
p.HP = status_get_hp(bl);
p.isBoss = ( ((TBL_MOB*)bl)->spawn && ((TBL_MOB*)bl)->spawn->state.boss ) ? 1 : 0;
@@ -1266,6 +1287,9 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd,
p.isBoss = 0;
}
#endif
+#if PACKETVER >= 20150513
+ p.body = 0;
+#endif
clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target);
@@ -4173,7 +4197,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) {
clif->specialeffect_single(bl,423,sd->fd);
else if(md->special_state.size==SZ_MEDIUM)
clif->specialeffect_single(bl,421,sd->fd);
-#if PACKETVER >= 20120404
+#if (PACKETVER >= 20120404 && PACKETVER < 20131223)
if (battle_config.show_monster_hp_bar && !(md->status.mode&MD_BOSS)) {
int i;
for(i = 0; i < DAMAGELOG_SIZE; i++) {// must show hp bar to all char who already hit the mob.
@@ -4224,6 +4248,7 @@ int clif_calc_walkdelay(struct block_list *bl,int delay, int type, int damage, i
/// Sends a 'damage' packet (src performs action on dst)
/// 008a <src ID>.L <dst ID>.L <server tick>.L <src speed>.L <dst speed>.L <damage>.W <div>.W <type>.B <damage2>.W (ZC_NOTIFY_ACT)
/// 02e1 <src ID>.L <dst ID>.L <server tick>.L <src speed>.L <dst speed>.L <damage>.L <div>.W <type>.B <damage2>.L (ZC_NOTIFY_ACT2)
+/// 08c8 <src ID>.L <dst ID>.L <server tick>.L <src speed>.L <dst speed>.L <damage>.L <IsSPDamage>.B <div>.W <type>.B <damage2>.L (ZC_NOTIFY_ACT2)
/// type: @see enum battle_dmg_type
/// for BDT_NORMAL: [ damage: total damage, div: amount of hits, damage2: assassin dual-wield damage ]
int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type, int64 in_damage2) {
@@ -4271,6 +4296,9 @@ int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int
p.damage = damage;
p.leftDamage = damage2;
}
+#if PACKETVER >= 20131223
+ p.is_sp_damaged = 0; // [ToDo] IsSPDamage - Displays blue digits.
+#endif
if(disguised(dst)) {
clif->send(&p,sizeof(p),dst,AREA_WOS);
@@ -5011,7 +5039,15 @@ int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick
}
WBUFW(buf,28)=skill_lv;
WBUFW(buf,30)=div;
- WBUFB(buf,32)=type;
+ // For some reason, late 2013 and newer clients have
+ // a issue that causes players and monsters to endure
+ // type 6 (ACTION_SKILL) skills. So we have to do a small
+ // hack to set all type 6 to be sent as type 8 ACTION_ATTACK_MULTIPLE
+#if PACKETVER < 20131223
+ WBUFB(buf,32)=type;
+#else
+ WBUFB(buf,32)=(type==6)?8:type;
+#endif
if (disguised(dst)) {
clif->send(buf,packet_len(0x1de),dst,AREA_WOS);
WBUFL(buf,8)=-dst->id;