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!
This commit is contained in:
Aleos 2017-08-31 10:15:00 -04:00 committed by GitHub
parent 3e51f68570
commit b19325b842

View File

@ -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) {