From a3afe42f9025c1049c05da0b2b99aad7ca8a6907 Mon Sep 17 00:00:00 2001 From: "Guilherme G. Menaldo" Date: Fri, 15 Jun 2018 11:49:32 -0300 Subject: Fixed clearunit packet not being sent to clients going out of the view range when monster dies --- conf/map/battle/client.conf | 7 +++++++ src/map/battle.c | 1 + src/map/battle.h | 1 + src/map/clif.c | 15 +++++++++++++-- src/map/clif.h | 1 + src/map/map.h | 1 + 6 files changed, 24 insertions(+), 2 deletions(-) diff --git a/conf/map/battle/client.conf b/conf/map/battle/client.conf index 4dc803bca..a7a351414 100644 --- a/conf/map/battle/client.conf +++ b/conf/map/battle/client.conf @@ -72,6 +72,13 @@ area_size: 14 // Chat area size (how many squares away from a player can they chat) chat_area_size: 9 +// Area which monster death packets should be sent to. +// This should be set to the farthest distance a player can reach in 250ms +// after a monster dies. +// Setting it to (area_size + 18) (18 being the range of Monk's Snap skill) +// should be a great value +dead_area_size: 32 + // Maximum walk path (how many cells a player can walk going to cursor) // default: 17(official) max_walk_path: 17 diff --git a/src/map/battle.c b/src/map/battle.c index 172f9083f..27e0273b4 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -7205,6 +7205,7 @@ static const struct battle_data { { "vcast_stat_scale", &battle_config.vcast_stat_scale, 530, 1, INT_MAX, }, { "area_size", &battle_config.area_size, 14, 0, INT_MAX, }, { "chat_area_size", &battle_config.chat_area_size, 9, 0, INT_MAX, }, + { "dead_area_size", &battle_config.dead_area_size, 32, 0, INT_MAX, }, { "zeny_from_mobs", &battle_config.zeny_from_mobs, 0, 0, 1, }, { "mobs_level_up", &battle_config.mobs_level_up, 0, 0, 1, }, { "mobs_level_up_exp_rate", &battle_config.mobs_level_up_exp_rate, 1, 1, INT_MAX, }, diff --git a/src/map/battle.h b/src/map/battle.h index f4176f142..9f5207e95 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -366,6 +366,7 @@ struct Battle_Config { int castrate_dex_scale; // added by [MouseJstr] int area_size; // added by [MouseJstr] int chat_area_size; // added by [gumi] + int dead_area_size; // Monster die area [KirieZ] int max_def, over_def_bonus; //added by [Skotlex] diff --git a/src/map/clif.c b/src/map/clif.c index adc7562e1..9d8ca844b 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -434,6 +434,7 @@ static bool clif_send(const void *buf, int len, struct block_list *bl, enum send struct battleground_data *bgd = NULL; int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd; struct s_mapiterator* iter; + int area_size; if( type != ALL_CLIENT ) nullpo_ret(bl); @@ -472,13 +473,18 @@ static bool clif_send(const void *buf, int len, struct block_list *bl, enum send case AREA: case AREA_WOSC: + case AREA_DEAD: if (sd && bl->prev == NULL) //Otherwise source misses the packet.[Skotlex] clif->send (buf, len, bl, SELF); /* Fall through */ case AREA_WOC: case AREA_WOS: + if (type == AREA_DEAD) + area_size = DEAD_AREA_SIZE; + else + area_size = AREA_SIZE; nullpo_retr(true, bl); - map->foreachinarea(clif->send_sub, bl->m, bl->x-AREA_SIZE, bl->y-AREA_SIZE, bl->x+AREA_SIZE, bl->y+AREA_SIZE, + map->foreachinarea(clif->send_sub, bl->m, bl->x - area_size, bl->y - area_size, bl->x + area_size, bl->y + area_size, BL_PC, buf, len, bl, type); break; case AREA_CHAT_WOC: @@ -909,7 +915,12 @@ static void clif_clearunit_area(struct block_list *bl, clr_type type) WBUFL(buf,2) = bl->id; WBUFB(buf,6) = type; - clif->send(buf, packet_len(0x80), bl, type == CLR_DEAD ? AREA : AREA_WOS); + /** + * When monster dies, there's a delay before the packet is sent, + * so we send it to a bigger area to avoid clients at the edge + * walking out of the area and missing it [KirieZ] + */ + clif->send(buf, packet_len(0x80), bl, type == CLR_DEAD ? AREA_DEAD : AREA_WOS); if (clif->isdisguised(bl)) { WBUFL(buf,2) = -bl->id; diff --git a/src/map/clif.h b/src/map/clif.h index 1dffc2711..4fc2c6336 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -89,6 +89,7 @@ typedef enum send_target { AREA_WOC, // area, without chatrooms AREA_WOSC, // area, without own chatrooms AREA_CHAT_WOC, // hearable area, without chatrooms + AREA_DEAD, // area, for clear unit (monster death) CHAT, // current chatroom CHAT_WOS, // current chatroom, without self PARTY, diff --git a/src/map/map.h b/src/map/map.h index 494f93cfe..bdf45c72f 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -48,6 +48,7 @@ enum E_MAPSERVER_ST { #define MAX_NPC_PER_MAP 512 #define AREA_SIZE (battle->bc->area_size) #define CHAT_AREA_SIZE (battle->bc->chat_area_size) +#define DEAD_AREA_SIZE (battle->bc->dead_area_size) #define DAMAGELOG_SIZE 30 #define LOOTITEM_SIZE 10 #define MAX_MOBSKILL 50 -- cgit v1.2.3-60-g2f50