comparison Main.lua @ 559:eb77bf9c8e2f 8.0.1-3

Initial attempt at fixing world quest parsing. Will investigate more later.
author Caleb Atherton <atcaleb@twitch.tv>
date Wed, 18 Jul 2018 02:53:03 -0400
parents d423605eccf0
children bb5a42af4db0
comparison
equal deleted inserted replaced
558:d423605eccf0 559:eb77bf9c8e2f
1017 end 1017 end
1018 1018
1019 1019
1020 function WDP:ProcessWorldQuests() 1020 function WDP:ProcessWorldQuests()
1021 -- Ignore if player is low level (there are some world quests before max level now, but we can collect enough data from 110s alone still) 1021 -- Ignore if player is low level (there are some world quests before max level now, but we can collect enough data from 110s alone still)
1022 if _G.UnitLevel("player") ~= 110 then return end 1022 if _G.UnitLevel("player") >= 110 then return end
1023 1023
1024 -- Ignore if BFA for now; Map API's lack of completion causes issues here 1024 local current_ui_map_id = C_Map.GetBestMapForUnit("player")
1025 if IS_BFA then return end 1025 local bounty_maps = MapUtil.GetRelatedBountyZoneMaps(current_ui_map_id)
1026
1027 -- Get current continent and zones in current continent
1028 local continentIndex, continentID = GetCurrentMapContinent()
1029 local continentMaps = { GetMapZones(continentIndex) }
1030 1026
1031 -- Iterate over zones in continent 1027 -- Iterate over zones in continent
1032 for i = 1, #continentMaps, 2 do 1028 for i = 1, #bounty_maps do
1033 1029
1034 -- Get data for World Quests 1030 -- Get data for World Quests
1035 local api_data = C_TaskQuest.GetQuestsForPlayerByMapID(continentMaps[i], continentID); 1031 local api_data = C_TaskQuest.GetQuestsForPlayerByMapID(bounty_maps[i]);
1032 local continent_ui_map_id = MapUtil.GetMapParentInfo(bounty_maps[i], _G.Enum.UIMapType.Continent)
1036 1033
1037 -- Iterate over the questIDs for each map, doing preload reward requests and creating SavedVariables entries 1034 -- Iterate over the questIDs for each map, doing preload reward requests and creating SavedVariables entries
1038 if api_data and type(api_data) == "table" and #api_data > 0 then 1035 if api_data and type(api_data) == "table" and #api_data > 0 then
1039 for _, current_data in ipairs(api_data) do 1036 for _, current_data in ipairs(api_data) do
1040 1037
1041 -- Check if we had a valid API table returned to us 1038 -- Check if we had a valid API table returned to us
1042 if current_data and type(current_data) == "table" and current_data["questId"] then 1039 if current_data and type(current_data) == "table" and current_data["questId"] then
1043 local quest_id = tonumber(current_data["questId"]) or 0 1040 local quest_id = tonumber(current_data["questId"]) or 0
1044 1041
1045 -- Check if we have quest data 1042 -- Check if we have quest data
1046 if _G.HaveQuestData(quest_id) then 1043 if quest_id > 0 and _G.HaveQuestData(quest_id) and QuestUtils_IsQuestWorldQuest(quest_id) and current_data["mapID"] == bounty_maps[i] then
1047 local tag_id, tag_name, world_quest_type, rarity, is_elite, tradeskill_line_index = _G.GetQuestTagInfo(quest_id) 1044 _G.C_TaskQuest.RequestPreloadRewardData(quest_id)
1048 1045 RecordWorldQuestData(quest_id, continent_ui_map_id, bounty_maps[i], current_data)
1049 -- Check for valid questID and whether or not it is a World Quest
1050 if quest_id > 0 and world_quest_type ~= nil then
1051 _G.C_TaskQuest.RequestPreloadRewardData(quest_id)
1052 RecordWorldQuestData(quest_id, continentID, continentMaps[i], current_data)
1053 end
1054 end 1046 end
1055 end 1047 end
1056 end 1048 end
1057 end 1049 end
1058 end 1050 end