Browse Source

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.

Playtester 9 years ago
parent
commit
87471044aa
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/map/skill.c

+ 7 - 1
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)
 int skill_autospell(struct map_session_data *sd, uint16 skill_id)
 {
 {
 	uint16 skill_lv;
 	uint16 skill_lv;
+	uint16 idx = 0;
 	int maxlv=1,lv;
 	int maxlv=1,lv;
 
 
 	nullpo_ret(sd);
 	nullpo_ret(sd);
 
 
 	skill_lv = sd->menuskill_val;
 	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]
 	if(!skill_lv || !lv) return 0; // Player must learn the skill before doing auto-spell [Lance]