comparison Main.lua @ 43:15f2e3d8463b

Make sure spell_id is non-nil before attempting to record profession data.
author James D. Callahan III <jcallahan@curse.com>
date Thu, 14 Jun 2012 12:28:40 -0500
parents a2f1fcc1a813
children 2a9bb8175562
comparison
equal deleted inserted replaced
42:a2f1fcc1a813 43:15f2e3d8463b
1036 if spell_name then 1036 if spell_name then
1037 DatamineTT:ClearLines() 1037 DatamineTT:ClearLines()
1038 DatamineTT:SetTrainerService(index) 1038 DatamineTT:SetTrainerService(index)
1039 1039
1040 local _, _, spell_id = DatamineTT:GetSpell() 1040 local _, _, spell_id = DatamineTT:GetSpell()
1041 local profession, min_skill = _G.GetTrainerServiceSkillReq(index) 1041
1042 profession = profession or "General" 1042 if spell_id then
1043 1043 local profession, min_skill = _G.GetTrainerServiceSkillReq(index)
1044 local class_professions = npc.teaches[PLAYER_CLASS] 1044 profession = profession or "General"
1045 if not class_professions then 1045
1046 npc.teaches[PLAYER_CLASS] = {} 1046 local class_professions = npc.teaches[PLAYER_CLASS]
1047 class_professions = npc.teaches[PLAYER_CLASS] 1047 if not class_professions then
1048 end 1048 npc.teaches[PLAYER_CLASS] = {}
1049 1049 class_professions = npc.teaches[PLAYER_CLASS]
1050 local profession_skills = class_professions[profession] 1050 end
1051 if not profession_skills then 1051
1052 class_professions[profession] = {} 1052 local profession_skills = class_professions[profession]
1053 profession_skills = class_professions[profession] 1053 if not profession_skills then
1054 end 1054 class_professions[profession] = {}
1055 profession_skills[spell_id] = ("%d:%d"):format(required_level, min_skill) 1055 profession_skills = class_professions[profession]
1056 end
1057 profession_skills[spell_id] = ("%d:%d"):format(required_level, min_skill)
1058 end
1056 end 1059 end
1057 end 1060 end
1058 1061
1059 -- Reset the filters to what they were before 1062 -- Reset the filters to what they were before
1060 _G.SetTrainerServiceTypeFilter("available", available or 0) 1063 _G.SetTrainerServiceTypeFilter("available", available or 0)