From 87471044aa0e166eea2baee2271ccc6e5dd62873 Mon Sep 17 00:00:00 2001 From: Playtester Date: Mon, 11 Apr 2016 19:51:51 +0200 Subject: [PATCH] Auto spell error log (fixes #1154) * When using auto spell, it will no longer print error messages to the map-server when no valid skill was selected Note: This needs to be done because the client sends us random IDs if the user simply presses on "Ok" without selecting a skill, so it's technically not an error, but expected behavior that needs to be handled. Special thanks to @anacondaqq and @stealth62 for helping to reproduce the error. --- src/map/skill.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/map/skill.c b/src/map/skill.c index de2d2f32d6..43d94b6131 100755 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -16595,12 +16595,18 @@ void skill_weaponrefine(struct map_session_data *sd, int idx) int skill_autospell(struct map_session_data *sd, uint16 skill_id) { uint16 skill_lv; + uint16 idx = 0; int maxlv=1,lv; nullpo_ret(sd); skill_lv = sd->menuskill_val; - lv=pc_checkskill(sd,skill_id); + + if ((idx = skill_get_index2(skill_id)) == 0) + return 0; + if (SKILL_CHK_GUILD(skill_id)) + return 0; + lv = (sd->status.skill[idx].id == skill_id) ? sd->status.skill[idx].lv : 0; if(!skill_lv || !lv) return 0; // Player must learn the skill before doing auto-spell [Lance]