|
@@ -5134,38 +5134,25 @@ static int clif_hallucination_damage()
|
|
/// 11 = lucky dodge
|
|
/// 11 = lucky dodge
|
|
/// 12 = (touch skill?)
|
|
/// 12 = (touch skill?)
|
|
/// 13 = multi-hit critical
|
|
/// 13 = multi-hit critical
|
|
-int clif_damage(struct block_list* src, struct block_list* dst, t_tick tick, int sdelay, int ddelay, int64 sdamage, int div, enum e_damage_type type, int64 sdamage2, bool spdamage)
|
|
|
|
-{
|
|
|
|
- unsigned char buf[34];
|
|
|
|
- status_change *sc;
|
|
|
|
|
|
+int clif_damage(block_list& src, block_list& dst, t_tick tick, int sdelay, int ddelay, int64 sdamage, int div, enum e_damage_type type, int64 sdamage2, bool spdamage){
|
|
int damage = (int)cap_value(sdamage,INT_MIN,INT_MAX);
|
|
int damage = (int)cap_value(sdamage,INT_MIN,INT_MAX);
|
|
int damage2 = (int)cap_value(sdamage2,INT_MIN,INT_MAX);
|
|
int damage2 = (int)cap_value(sdamage2,INT_MIN,INT_MAX);
|
|
-#if PACKETVER < 20071113
|
|
|
|
- const int cmd = 0x8a;
|
|
|
|
- int offset = 0;
|
|
|
|
-#elif PACKETVER < 20131223
|
|
|
|
- const int cmd = 0x2e1;
|
|
|
|
- int offset = 2;
|
|
|
|
-#else
|
|
|
|
- const int cmd = 0x8c8;
|
|
|
|
- int offset = 3;
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
- nullpo_ret(src);
|
|
|
|
- nullpo_ret(dst);
|
|
|
|
|
|
|
|
if (type != DMG_MULTI_HIT_CRITICAL)
|
|
if (type != DMG_MULTI_HIT_CRITICAL)
|
|
type = clif_calc_delay(type,div,damage+damage2,ddelay);
|
|
type = clif_calc_delay(type,div,damage+damage2,ddelay);
|
|
- sc = status_get_sc(dst);
|
|
|
|
|
|
+
|
|
|
|
+ status_change *sc = status_get_sc(&dst);
|
|
|
|
+
|
|
if(sc && sc->count) {
|
|
if(sc && sc->count) {
|
|
if(sc->getSCE(SC_HALLUCINATION)) {
|
|
if(sc->getSCE(SC_HALLUCINATION)) {
|
|
damage = clif_hallucination_damage();
|
|
damage = clif_hallucination_damage();
|
|
- if(damage2) damage2 = clif_hallucination_damage();
|
|
|
|
|
|
+ if(damage2)
|
|
|
|
+ damage2 = clif_hallucination_damage();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// Calculate what sdelay to send to the client so it applies damage at the same time as the server
|
|
// Calculate what sdelay to send to the client so it applies damage at the same time as the server
|
|
- if (battle_config.synchronize_damage && src->type == BL_MOB) {
|
|
|
|
|
|
+ if (battle_config.synchronize_damage && src.type == BL_MOB) {
|
|
// When a clif_damage packet is sent to the client it will also send "sdelay" (amotion) as value.
|
|
// When a clif_damage packet is sent to the client it will also send "sdelay" (amotion) as value.
|
|
// The client however does not interpret this value as AttackMotion but incorrectly as an inverted
|
|
// The client however does not interpret this value as AttackMotion but incorrectly as an inverted
|
|
// animation speed modifier, with 432 standing for 1x animation speed.
|
|
// animation speed modifier, with 432 standing for 1x animation speed.
|
|
@@ -5175,7 +5162,7 @@ int clif_damage(struct block_list* src, struct block_list* dst, t_tick tick, int
|
|
// it displays the damage and makes the target flinch / stop. If the damage frame is undefined,
|
|
// it displays the damage and makes the target flinch / stop. If the damage frame is undefined,
|
|
// it instead displays the damage / flinch / stop at the beginning of the second to last frame.
|
|
// it instead displays the damage / flinch / stop at the beginning of the second to last frame.
|
|
// We define the time after which the damage frame shows at 1x speed as clientamotion.
|
|
// We define the time after which the damage frame shows at 1x speed as clientamotion.
|
|
- uint16 clientamotion = std::max((uint16)1, status_get_clientamotion(src));
|
|
|
|
|
|
+ uint16 clientamotion = std::max((uint16)1, status_get_clientamotion(&src));
|
|
|
|
|
|
// Knowing when the damage frame happens in the animation allows us to synchronize the timing
|
|
// Knowing when the damage frame happens in the animation allows us to synchronize the timing
|
|
// between client and server using the formula below.
|
|
// between client and server using the formula below.
|
|
@@ -5187,120 +5174,102 @@ int clif_damage(struct block_list* src, struct block_list* dst, t_tick tick, int
|
|
sdelay = std::min(sdelay, DEFAULT_ANIMATION_SPEED);
|
|
sdelay = std::min(sdelay, DEFAULT_ANIMATION_SPEED);
|
|
}
|
|
}
|
|
|
|
|
|
- WBUFW(buf,0) = cmd;
|
|
|
|
- WBUFL(buf,2) = src->id;
|
|
|
|
- WBUFL(buf,6) = dst->id;
|
|
|
|
- WBUFL(buf,10) = client_tick(tick);
|
|
|
|
- WBUFL(buf,14) = sdelay;
|
|
|
|
- WBUFL(buf,18) = ddelay;
|
|
|
|
- if (battle_config.hide_woe_damage && map_flag_gvg(src->m)) {
|
|
|
|
-#if PACKETVER < 20071113
|
|
|
|
- WBUFW(buf,22) = damage ? div : 0;
|
|
|
|
- WBUFW(buf,27+offset) = damage2 ? div : 0;
|
|
|
|
-#else
|
|
|
|
- WBUFL(buf, 22) = damage ? div : 0;
|
|
|
|
- WBUFL(buf, 27 + offset) = damage2 ? div : 0;
|
|
|
|
-#endif
|
|
|
|
|
|
+ PACKET_ZC_NOTIFY_ACT p{};
|
|
|
|
+
|
|
|
|
+ p.packetType = HEADER_ZC_NOTIFY_ACT;
|
|
|
|
+ p.srcID = src.id;
|
|
|
|
+ p.targetID = dst.id;
|
|
|
|
+ p.serverTick = client_tick(tick);
|
|
|
|
+ p.srcSpeed = sdelay;
|
|
|
|
+ p.dmgSpeed = ddelay;
|
|
|
|
+
|
|
|
|
+ if (battle_config.hide_woe_damage && map_flag_gvg(src.m)) {
|
|
|
|
+ p.damage = damage ? div : 0;
|
|
|
|
+ p.damage2 = damage2 ? div : 0;
|
|
} else {
|
|
} else {
|
|
-#if PACKETVER < 20071113
|
|
|
|
- WBUFW(buf,22) = min(damage, INT16_MAX);
|
|
|
|
- WBUFW(buf,27+offset) = damage2;
|
|
|
|
-#else
|
|
|
|
- WBUFL(buf,22) = damage;
|
|
|
|
- WBUFL(buf,27+offset) = damage2;
|
|
|
|
-#endif
|
|
|
|
|
|
+ p.damage = static_cast<decltype(p.damage)>( std::min( damage, static_cast<decltype(damage)>( std::numeric_limits<decltype(p.damage)>::max() ) ) );
|
|
|
|
+ p.damage2 = static_cast<decltype(p.damage2)>( std::min( damage2, static_cast<decltype(damage2)>( std::numeric_limits<decltype(p.damage2)>::max() ) ) );
|
|
}
|
|
}
|
|
|
|
+
|
|
#if PACKETVER >= 20131223
|
|
#if PACKETVER >= 20131223
|
|
- WBUFB(buf,26) = (spdamage) ? 1 : 0; // IsSPDamage - Displays blue digits.
|
|
|
|
|
|
+ p.isSPDamage = (spdamage) ? 1 : 0; // IsSPDamage - Displays blue digits.
|
|
#endif
|
|
#endif
|
|
- WBUFW(buf,24+offset) = div;
|
|
|
|
- WBUFB(buf,26+offset) = type;
|
|
|
|
|
|
|
|
- if(disguised(dst)) {
|
|
|
|
- clif_send(buf, packet_len(cmd), dst, AREA_WOS);
|
|
|
|
- WBUFL(buf,6) = disguised_bl_id( dst->id );
|
|
|
|
- clif_send(buf, packet_len(cmd), dst, SELF);
|
|
|
|
|
|
+ p.div = div;
|
|
|
|
+ p.type = type;
|
|
|
|
+
|
|
|
|
+ if(disguised(&dst)) {
|
|
|
|
+ clif_send( &p, sizeof(p), &dst, AREA_WOS);
|
|
|
|
+ p.targetID = disguised_bl_id( dst.id );
|
|
|
|
+ clif_send( &p, sizeof(p), &dst, SELF);
|
|
} else
|
|
} else
|
|
- clif_send(buf, packet_len(cmd), dst, AREA);
|
|
|
|
|
|
+ clif_send(&p, sizeof(p), &dst, AREA);
|
|
|
|
|
|
- if(disguised(src)) {
|
|
|
|
- WBUFL(buf,2) = disguised_bl_id( src->id );
|
|
|
|
- if (disguised(dst))
|
|
|
|
- WBUFL(buf,6) = dst->id;
|
|
|
|
-#if PACKETVER < 20071113
|
|
|
|
- if(damage > 0) WBUFW(buf,22) = -1;
|
|
|
|
- if(damage2 > 0) WBUFW(buf,27) = -1;
|
|
|
|
-#else
|
|
|
|
- if(damage > 0) WBUFL(buf,22) = -1;
|
|
|
|
- if(damage2 > 0) WBUFL(buf,27+offset) = -1;
|
|
|
|
-#endif
|
|
|
|
- clif_send(buf,packet_len(cmd),src,SELF);
|
|
|
|
|
|
+ if(disguised(&src)) {
|
|
|
|
+ p.srcID = disguised_bl_id( src.id );
|
|
|
|
+ if(damage > 0)
|
|
|
|
+ p.damage = -1;
|
|
|
|
+ if(damage2 > 0)
|
|
|
|
+ p.damage2 = -1;
|
|
|
|
+ clif_send( &p, sizeof(p), &src, SELF);
|
|
}
|
|
}
|
|
|
|
|
|
- if(src == dst) {
|
|
|
|
- unit_setdir(src, unit_getdir(src));
|
|
|
|
- }
|
|
|
|
|
|
+ if(&src == &dst)
|
|
|
|
+ unit_setdir(&src, unit_getdir(&src));
|
|
|
|
|
|
// In case this assignment is bypassed by DMG_MULTI_HIT_CRITICAL
|
|
// In case this assignment is bypassed by DMG_MULTI_HIT_CRITICAL
|
|
type = clif_calc_delay(type, div, damage + damage2, ddelay);
|
|
type = clif_calc_delay(type, div, damage + damage2, ddelay);
|
|
//Return adjusted can't walk delay for further processing.
|
|
//Return adjusted can't walk delay for further processing.
|
|
- return clif_calc_walkdelay(dst, ddelay, type, damage+damage2, div);
|
|
|
|
|
|
+ return clif_calc_walkdelay(&dst, ddelay, type, damage+damage2, div);
|
|
}
|
|
}
|
|
|
|
|
|
/*==========================================
|
|
/*==========================================
|
|
* src picks up dst
|
|
* src picks up dst
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-void clif_takeitem(struct block_list* src, struct block_list* dst)
|
|
|
|
-{
|
|
|
|
- //clif_damage(src,dst,0,0,0,0,0,DMG_PICKUP_ITEM,0,false);
|
|
|
|
- unsigned char buf[32];
|
|
|
|
-
|
|
|
|
- nullpo_retv(src);
|
|
|
|
- nullpo_retv(dst);
|
|
|
|
|
|
+void clif_takeitem(block_list& src, block_list& dst){
|
|
|
|
+ PACKET_ZC_NOTIFY_ACT p{};
|
|
|
|
|
|
- WBUFW(buf, 0) = 0x8a;
|
|
|
|
- WBUFL(buf, 2) = src->id;
|
|
|
|
- WBUFL(buf, 6) = dst->id;
|
|
|
|
- WBUFB(buf,26) = 1;
|
|
|
|
- clif_send(buf, packet_len(0x8a), src, AREA);
|
|
|
|
|
|
+ p.packetType = HEADER_ZC_NOTIFY_ACT;
|
|
|
|
+ p.srcID = src.id;
|
|
|
|
+ p.targetID = dst.id;
|
|
|
|
+ p.type = DMG_PICKUP_ITEM;
|
|
|
|
|
|
|
|
+ clif_send(&p, sizeof(p), &src, AREA);
|
|
}
|
|
}
|
|
|
|
|
|
/*==========================================
|
|
/*==========================================
|
|
* inform clients in area that `bl` is sitting
|
|
* inform clients in area that `bl` is sitting
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-void clif_sitting(struct block_list* bl)
|
|
|
|
-{
|
|
|
|
- unsigned char buf[32];
|
|
|
|
- nullpo_retv(bl);
|
|
|
|
|
|
+void clif_sitting(block_list& bl){
|
|
|
|
+ PACKET_ZC_NOTIFY_ACT p{};
|
|
|
|
|
|
- WBUFW(buf, 0) = 0x8a;
|
|
|
|
- WBUFL(buf, 2) = bl->id;
|
|
|
|
- WBUFB(buf,26) = 2;
|
|
|
|
- clif_send(buf, packet_len(0x8a), bl, AREA);
|
|
|
|
|
|
+ p.packetType = HEADER_ZC_NOTIFY_ACT;
|
|
|
|
+ p.srcID = bl.id;
|
|
|
|
+ p.type = DMG_SIT_DOWN;
|
|
|
|
+
|
|
|
|
+ clif_send(&p, sizeof(p), &bl, AREA);
|
|
|
|
|
|
- if(disguised(bl)) {
|
|
|
|
- WBUFL(buf, 2) = disguised_bl_id( bl->id );
|
|
|
|
- clif_send(buf, packet_len(0x8a), bl, SELF);
|
|
|
|
|
|
+ if(disguised(&bl)) {
|
|
|
|
+ p.srcID = disguised_bl_id( bl.id );
|
|
|
|
+ clif_send(&p, sizeof(p), &bl, SELF);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/*==========================================
|
|
/*==========================================
|
|
* inform clients in area that `bl` is standing
|
|
* inform clients in area that `bl` is standing
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-void clif_standing(struct block_list* bl)
|
|
|
|
-{
|
|
|
|
- unsigned char buf[32];
|
|
|
|
- nullpo_retv(bl);
|
|
|
|
|
|
+void clif_standing(block_list& bl){
|
|
|
|
+ PACKET_ZC_NOTIFY_ACT p{};
|
|
|
|
|
|
- WBUFW(buf, 0) = 0x8a;
|
|
|
|
- WBUFL(buf, 2) = bl->id;
|
|
|
|
- WBUFB(buf,26) = 3;
|
|
|
|
- clif_send(buf, packet_len(0x8a), bl, AREA);
|
|
|
|
|
|
+ p.packetType = HEADER_ZC_NOTIFY_ACT;
|
|
|
|
+ p.srcID = bl.id;
|
|
|
|
+ p.type = DMG_STAND_UP;
|
|
|
|
|
|
- if(disguised(bl)) {
|
|
|
|
- WBUFL(buf, 2) = disguised_bl_id( bl->id );
|
|
|
|
- clif_send(buf, packet_len(0x8a), bl, SELF);
|
|
|
|
|
|
+ clif_send(&p, sizeof(p), &bl, AREA);
|
|
|
|
+
|
|
|
|
+ if(disguised(&bl)) {
|
|
|
|
+ p.srcID = disguised_bl_id( bl.id );
|
|
|
|
+ clif_send(&p, sizeof(p), &bl, SELF);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -9814,7 +9783,7 @@ void clif_refresh(map_session_data *sd)
|
|
if( sd->state.vending )
|
|
if( sd->state.vending )
|
|
clif_openvending( *sd );
|
|
clif_openvending( *sd );
|
|
if( pc_issit(sd) )
|
|
if( pc_issit(sd) )
|
|
- clif_sitting(&sd->bl); // FIXME: just send to self, not area
|
|
|
|
|
|
+ clif_sitting(sd->bl); // FIXME: just send to self, not area
|
|
if( pc_isdead(sd) ) // When you refresh, resend the death packet.
|
|
if( pc_isdead(sd) ) // When you refresh, resend the death packet.
|
|
clif_clearunit_single( sd->bl.id, CLR_DEAD, *sd );
|
|
clif_clearunit_single( sd->bl.id, CLR_DEAD, *sd );
|
|
else
|
|
else
|
|
@@ -11572,14 +11541,14 @@ void clif_parse_HowManyConnections(int fd, map_session_data *sd)
|
|
clif_user_count(sd, map_getusers());
|
|
clif_user_count(sd, map_getusers());
|
|
}
|
|
}
|
|
|
|
|
|
-void clif_parse_ActionRequest_sub( map_session_data& sd, int action_type, int target_id, t_tick tick ){
|
|
|
|
|
|
+void clif_parse_ActionRequest_sub( map_session_data& sd, uint8 action_type, int target_id, t_tick tick ){
|
|
if (pc_isdead(&sd)) {
|
|
if (pc_isdead(&sd)) {
|
|
clif_clearunit_area(sd.bl, CLR_DEAD);
|
|
clif_clearunit_area(sd.bl, CLR_DEAD);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
// Statuses that don't let the player sit / stand / talk with NPCs (targeted)
|
|
// Statuses that don't let the player sit / stand / talk with NPCs (targeted)
|
|
- if (action_type != 0x00 && action_type != 0x07) {
|
|
|
|
|
|
+ if (action_type != DMG_NORMAL && action_type != DMG_REPEAT) {
|
|
if (sd.sc.cant.interact)
|
|
if (sd.sc.cant.interact)
|
|
return;
|
|
return;
|
|
pc_stop_walking(&sd, 1);
|
|
pc_stop_walking(&sd, 1);
|
|
@@ -11591,8 +11560,8 @@ void clif_parse_ActionRequest_sub( map_session_data& sd, int action_type, int ta
|
|
|
|
|
|
switch(action_type)
|
|
switch(action_type)
|
|
{
|
|
{
|
|
- case 0x00: // once attack
|
|
|
|
- case 0x07: // continuous attack
|
|
|
|
|
|
+ case DMG_NORMAL: // once attack
|
|
|
|
+ case DMG_REPEAT: // continuous attack
|
|
|
|
|
|
if( pc_cant_act(&sd) )
|
|
if( pc_cant_act(&sd) )
|
|
return;
|
|
return;
|
|
@@ -11613,7 +11582,7 @@ void clif_parse_ActionRequest_sub( map_session_data& sd, int action_type, int ta
|
|
sd.idletime_mer = last_tick;
|
|
sd.idletime_mer = last_tick;
|
|
unit_attack(&sd.bl, target_id, action_type != 0);
|
|
unit_attack(&sd.bl, target_id, action_type != 0);
|
|
break;
|
|
break;
|
|
- case 0x02: // sitdown
|
|
|
|
|
|
+ case DMG_SIT_DOWN: // sitdown
|
|
if (battle_config.basic_skill_check && pc_checkskill(&sd, NV_BASIC) < 3 && pc_checkskill(&sd, SU_BASIC_SKILL) < 1) {
|
|
if (battle_config.basic_skill_check && pc_checkskill(&sd, NV_BASIC) < 3 && pc_checkskill(&sd, SU_BASIC_SKILL) < 1) {
|
|
clif_skill_fail( sd, 1, USESKILL_FAIL_LEVEL, 2 );
|
|
clif_skill_fail( sd, 1, USESKILL_FAIL_LEVEL, 2 );
|
|
break;
|
|
break;
|
|
@@ -11621,7 +11590,7 @@ void clif_parse_ActionRequest_sub( map_session_data& sd, int action_type, int ta
|
|
|
|
|
|
if(pc_issit(&sd)) {
|
|
if(pc_issit(&sd)) {
|
|
//Bugged client? Just refresh them.
|
|
//Bugged client? Just refresh them.
|
|
- clif_sitting(&sd.bl);
|
|
|
|
|
|
+ clif_sitting(sd.bl);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -11648,12 +11617,12 @@ void clif_parse_ActionRequest_sub( map_session_data& sd, int action_type, int ta
|
|
|
|
|
|
pc_setsit(&sd);
|
|
pc_setsit(&sd);
|
|
skill_sit(&sd, true);
|
|
skill_sit(&sd, true);
|
|
- clif_sitting(&sd.bl);
|
|
|
|
|
|
+ clif_sitting(sd.bl);
|
|
break;
|
|
break;
|
|
- case 0x03: // standup
|
|
|
|
|
|
+ case DMG_STAND_UP: // standup
|
|
if (!pc_issit(&sd)) {
|
|
if (!pc_issit(&sd)) {
|
|
//Bugged client? Just refresh them.
|
|
//Bugged client? Just refresh them.
|
|
- clif_standing(&sd.bl);
|
|
|
|
|
|
+ clif_standing(sd.bl);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -11673,7 +11642,7 @@ void clif_parse_ActionRequest_sub( map_session_data& sd, int action_type, int ta
|
|
if (battle_config.mer_idle_no_share && sd.md && battle_config.idletime_mer_option&IDLE_SIT)
|
|
if (battle_config.mer_idle_no_share && sd.md && battle_config.idletime_mer_option&IDLE_SIT)
|
|
sd.idletime_mer = last_tick;
|
|
sd.idletime_mer = last_tick;
|
|
skill_sit(&sd, false);
|
|
skill_sit(&sd, false);
|
|
- clif_standing(&sd.bl);
|
|
|
|
|
|
+ clif_standing(sd.bl);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -12102,7 +12071,7 @@ void clif_parse_NpcClicked(int fd,map_session_data *sd)
|
|
switch (bl->type) {
|
|
switch (bl->type) {
|
|
case BL_MOB:
|
|
case BL_MOB:
|
|
case BL_PC:
|
|
case BL_PC:
|
|
- clif_parse_ActionRequest_sub( *sd, 0x07, bl->id, gettick() );
|
|
|
|
|
|
+ clif_parse_ActionRequest_sub( *sd, DMG_REPEAT, bl->id, gettick() );
|
|
break;
|
|
break;
|
|
case BL_NPC:
|
|
case BL_NPC:
|
|
#ifdef RENEWAL
|
|
#ifdef RENEWAL
|