From b19325b84257d9c06e7aa383979622cdbe91ad4b Mon Sep 17 00:00:00 2001 From: Aleos Date: Thu, 31 Aug 2017 10:15:00 -0400 Subject: [PATCH] Corrected mob chat display checks (#2390) * Fixes #2388. * Added a validation check when monsters try to talk and attempt to lookup and invalid chat message on skill usage. * Clones of players will now have no mob chat ID associated to their skills. Thanks to @M4karov! --- src/map/mob.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/map/mob.c b/src/map/mob.c index 04b76e707d..3d90e21a02 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -3643,12 +3643,16 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) //Skill used. Post-setups... if ( ms[ i ].msg_id ){ //Display color message [SnakeDrak] struct mob_chat *mc = mob_chat(ms[i].msg_id); - char temp[CHAT_SIZE_MAX]; - char name[NAME_LENGTH]; - snprintf(name, sizeof name,"%s", md->name); - strtok(name, "#"); // discard extra name identifier if present [Daegaladh] - snprintf(temp, sizeof temp,"%s : %s", name, mc->msg); - clif_messagecolor(&md->bl, mc->color, temp, true, AREA_CHAT_WOC); + + if (mc) { + char temp[CHAT_SIZE_MAX]; + char name[NAME_LENGTH]; + + snprintf(name, sizeof name,"%s", md->name); + strtok(name, "#"); // discard extra name identifier if present [Daegaladh] + snprintf(temp, sizeof temp,"%s : %s", name, mc->msg); + clif_messagecolor(&md->bl, mc->color, temp, true, AREA_CHAT_WOC); + } } if(!(battle_config.mob_ai&0x200)) { //pass on delay to same skill. for (j = 0; j < md->db->maxskill; j++) @@ -3810,6 +3814,7 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons ms[i].cancel = 0; ms[i].casttime = skill_castfix(&sd->bl,skill_id, ms[i].skill_lv); ms[i].delay = 5000+skill_delayfix(&sd->bl,skill_id, ms[i].skill_lv); + ms[i].msg_id = 0; inf = skill_get_inf(skill_id); if (inf&INF_ATTACK_SKILL) {