Browse Source

Resolves Autospell displaying errors to console (#4921)

* Fixes #4883
* Fixes Autospell displaying invalid skill errors when clicking Ok or Cancel.
Thanks to @admkakaroto!
Aleos 5 năm trước cách đây
mục cha
commit
5d4fd1d3b7
1 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 4 4
      src/map/skill.cpp

+ 4 - 4
src/map/skill.cpp

@@ -17636,15 +17636,15 @@ int skill_autospell(struct map_session_data *sd, uint16 skill_id)
 {
 	nullpo_ret(sd);
 
-	if (SKILL_CHK_GUILD(skill_id))
+	if (skill_id == 0 || skill_get_index_(skill_id, true, __FUNCTION__, __FILE__, __LINE__) == 0 || SKILL_CHK_GUILD(skill_id))
 		return 0;
 
 	uint16 lv = pc_checkskill(sd, skill_id), skill_lv = sd->menuskill_val;
-
-	if(!skill_lv || !lv) return 0; // Player must learn the skill before doing auto-spell [Lance]
-
 	uint16 maxlv = 1;
 
+	if (skill_lv == 0 || lv == 0)
+		return 0; // Player must learn the skill before doing auto-spell [Lance]
+
 #ifdef RENEWAL
 	if ((skill_id == MG_COLDBOLT || skill_id == MG_FIREBOLT || skill_id == MG_LIGHTNINGBOLT) && sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_SAGE)
 		maxlv = 10; //Soul Linker bonus. [Skotlex]