summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/map/clif.c52
-rw-r--r--src/map/mob.c15
-rw-r--r--src/map/packets_struct.h55
3 files changed, 102 insertions, 20 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;
diff --git a/src/map/mob.c b/src/map/mob.c
index 0d6055b13..22b1266dd 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2068,11 +2068,17 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage) {
if (battle_config.show_mob_info&3)
clif->charnameack (0, &md->bl);
+
+#if PACKETVER >= 20131223
+ // Resend ZC_NOTIFY_MOVEENTRY to Update the HP
+ if (battle_config.show_monster_hp_bar)
+ clif->set_unit_walking(&md->bl, NULL, unit->bl2ud(&md->bl), AREA);
+#endif
if (!src)
return;
-#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.
@@ -2813,8 +2819,13 @@ void mob_heal(struct mob_data *md, unsigned int heal)
{
if (battle_config.show_mob_info&3)
clif->charnameack (0, &md->bl);
+#if PACKETVER >= 20131223
+ // Resend ZC_NOTIFY_MOVEENTRY to Update the HP
+ if (battle_config.show_monster_hp_bar)
+ clif->set_unit_walking(&md->bl, NULL, unit->bl2ud(&md->bl), AREA);
+#endif
-#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.
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index a9ccc019d..6a0013c6c 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -84,10 +84,14 @@ enum packet_headers {
idle_unitType = 0x2ee,
#elif PACKETVER < 20101124
idle_unitType = 0x7f9,
-#elif PACKETVER < 20150000 //actual 20120221
+#elif PACKETVER < 20120221
idle_unitType = 0x857,
-#else
+#elif PACKETVER < 20131223
idle_unitType = 0x915,
+#elif PACKETVER < 20150513
+ idle_unitType = 0x9dd,
+#else
+ idle_unitType = 0x9ff,
#endif
#if PACKETVER >= 20120618
status_changeType = 0x983,
@@ -104,8 +108,10 @@ enum packet_headers {
#endif
#if PACKETVER < 20071113
damageType = 0x8a,
-#else
+#elif PACKETVER < 20131223
damageType = 0x2e1,
+#else
+ damageType = 0x8c8,
#endif
#if PACKETVER < 4
spawn_unitType = 0x79,
@@ -117,10 +123,14 @@ enum packet_headers {
spawn_unitType = 0x2ed,
#elif PACKETVER < 20101124
spawn_unitType = 0x7f8,
-#elif PACKETVER < 20150000 //actual 20120221
+#elif PACKETVER < 20120221
spawn_unitType = 0x858,
-#else
+#elif PACKETVER < 20131223
spawn_unitType = 0x90f,
+#elif PACKETVER < 20150513
+ spawn_unitType = 0x9dc,
+#else
+ spawn_unitType = 0x9fe,
#endif
#if PACKETVER < 20080102
authokType = 0x73,
@@ -142,10 +152,14 @@ enum packet_headers {
unit_walkingType = 0x2ec,
#elif PACKETVER < 20101124
unit_walkingType = 0x7f7,
-#elif PACKETVER < 20150000 //actual 20120221
+#elif PACKETVER < 20120221
unit_walkingType = 0x856,
-#else
+#elif PACKETVER < 20131223
unit_walkingType = 0x914,
+#elif PACKETVER < 20150513
+ unit_walkingType = 0x9db,
+#else
+ unit_walkingType = 0x9fd,
#endif
bgqueue_ackType = 0x8d8,
bgqueue_notice_deleteType = 0x8db,
@@ -513,6 +527,9 @@ struct packet_spawn_unit {
short PacketLength;
unsigned char objecttype;
#endif
+#if PACKETVER >= 20131223
+ unsigned int AID;
+#endif
unsigned int GID;
short speed;
short bodyState;
@@ -558,11 +575,14 @@ struct packet_spawn_unit {
#if PACKETVER >= 20080102
short font;
#endif
-#if PACKETVER >= 20150000 //actual 20120221
+#if PACKETVER >= 20120221
int maxHP;
int HP;
unsigned char isBoss;
#endif
+#if PACKETVER >= 20150513
+ short body;
+#endif
} __attribute__((packed));
struct packet_unit_walking {
@@ -573,6 +593,9 @@ struct packet_unit_walking {
#if PACKETVER > 20071106
unsigned char objecttype;
#endif
+#if PACKETVER >= 20131223
+ unsigned int AID;
+#endif
unsigned int GID;
short speed;
short bodyState;
@@ -619,11 +642,14 @@ struct packet_unit_walking {
#if PACKETVER >= 20080102
short font;
#endif
-#if PACKETVER >= 20150000 //actual 20120221
+#if PACKETVER >= 20120221
int maxHP;
int HP;
unsigned char isBoss;
#endif
+#if PACKETVER >= 20150513
+ short body;
+#endif
} __attribute__((packed));
struct packet_idle_unit {
@@ -632,6 +658,9 @@ struct packet_idle_unit {
short PacketLength;
unsigned char objecttype;
#endif
+#if PACKETVER >= 20131223
+ unsigned int AID;
+#endif
unsigned int GID;
short speed;
short bodyState;
@@ -678,11 +707,14 @@ struct packet_idle_unit {
#if PACKETVER >= 20080102
short font;
#endif
-#if PACKETVER >= 20150000 //actual 20120221
+#if PACKETVER >= 20120221
int maxHP;
int HP;
unsigned char isBoss;
#endif
+#if PACKETVER >= 20150513
+ short body;
+#endif
} __attribute__((packed));
struct packet_status_change {
@@ -1044,6 +1076,9 @@ struct packet_damage {
#else
int damage;
#endif
+#if PACKETVER >= 20131223
+ unsigned char is_sp_damaged;
+#endif
short count;
unsigned char action;
#if PACKETVER < 20071113