comparison Main.lua @ 532:4d8f02877b4f

Fixed a bug in World Quest recording and commented out some old, irrelevant code.
author MMOSimca
date Tue, 11 Apr 2017 20:47:39 -0400
parents 39c3576943ba
children 2bb33dbd3d7c
comparison
equal deleted inserted replaced
531:ba48723702c0 532:4d8f02877b4f
66 local PLAYER_LEVEL = _G.UnitLevel("player") 66 local PLAYER_LEVEL = _G.UnitLevel("player")
67 local PLAYER_NAME = _G.UnitName("player") 67 local PLAYER_NAME = _G.UnitName("player")
68 local PLAYER_RACE = _G.select(2, _G.UnitRace("player")) 68 local PLAYER_RACE = _G.select(2, _G.UnitRace("player"))
69 69
70 local SPELL_ID_UPDATE_INTERACTIONS = 161006 70 local SPELL_ID_UPDATE_INTERACTIONS = 161006
71
72 local WORLD_MAP_ID_BROKEN_ISLES = 1007
73
74 -- Removed in Patch 7.0.3; previously used to determine if a system message was a quest reward or not
75 local ERR_QUEST_REWARD_ITEM_MULT_IS = _G.ERR_QUEST_REWARD_ITEM_MULT_IS or "Received %d of item: %s."
76 local ERR_QUEST_REWARD_ITEM_S = _G.ERR_QUEST_REWARD_ITEM_S or "Received item: %s."
77 71
78 local ALLOWED_LOCALES = { 72 local ALLOWED_LOCALES = {
79 enUS = true, 73 enUS = true,
80 enGB = true, 74 enGB = true,
81 enTW = true, 75 enTW = true,
1069 end 1063 end
1070 end 1064 end
1071 1065
1072 1066
1073 function WDP:ProcessWorldQuests() 1067 function WDP:ProcessWorldQuests()
1074 -- Ignore if player is low level 1068 -- 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)
1075 if _G.UnitLevel("player") ~= 110 then return end 1069 if _G.UnitLevel("player") ~= 110 then return end
1076 1070
1077 local current_world_map_id = _G.GetCurrentMapAreaID() 1071 local current_world_map_id = _G.GetCurrentMapAreaID()
1078 1072
1079 -- Iterate over known World Quest maps 1073 -- Iterate over known World Quest maps
1080 for i = 1, #private.WORLD_QUEST_MAP_IDS do 1074 for i = 1, #private.WORLD_QUEST_MAP_IDS do
1081 local world_map_id = private.WORLD_QUEST_MAP_IDS[i] 1075 local world_map_id = private.WORLD_QUEST_MAP_IDS[i]
1082 1076
1083 -- Only bother checking the API if the world map in question is currently displayed OR its continent is currently displayed 1077 -- Only bother checking the API if the world map in question is currently displayed
1084 if current_world_map_id == WORLD_MAP_ID_BROKEN_ISLES or current_world_map_id == world_map_id then 1078 if current_world_map_id == world_map_id then
1085 1079
1086 -- Get data for World Quests on map 1080 -- Get data for World Quests on map
1087 local api_data = _G.C_TaskQuest.GetQuestsForPlayerByMapID(world_map_id) 1081 local api_data = _G.C_TaskQuest.GetQuestsForPlayerByMapID(world_map_id)
1088 1082
1089 -- Iterate over the questIDs for each map, doing preload reward requests and creating SavedVariables entries 1083 -- Iterate over the questIDs for each map, doing preload reward requests and creating SavedVariables entries
1360 1354
1361 function WDP:ResumeChatLootRecording(event_name) 1355 function WDP:ResumeChatLootRecording(event_name)
1362 if block_chat_loot_data then 1356 if block_chat_loot_data then
1363 Debug("%s: Resuming chat-based loot recording.", event_name) 1357 Debug("%s: Resuming chat-based loot recording.", event_name)
1364 block_chat_loot_data = false 1358 block_chat_loot_data = false
1365 end
1366 end
1367
1368
1369 -- Process world quests if the map is moved to the Broken Isles continent world map (this provides us an opportunity to get data for all zones on the continent without moving the map)
1370 function WDP:WORLD_MAP_UPATE(event_name)
1371 if _G.GetCurrentMapAreaID() == WORLD_MAP_ID_BROKEN_ISLES and _G.GetServerTime() > (world_quest_event_timestamp + DELAY_PROCESS_WORLD_QUESTS) then
1372 world_quest_event_timestamp = _G.GetServerTime()
1373 WDP:ProcessWorldQuests()
1374 end 1359 end
1375 end 1360 end
1376 1361
1377 1362
1378 -- For now, bonus roll data only pollutes the true drop percentages. We still want to capture the data from SPELL_CONFIRMATION_PROMPT because of legendary quest items though. 1363 -- For now, bonus roll data only pollutes the true drop percentages. We still want to capture the data from SPELL_CONFIRMATION_PROMPT because of legendary quest items though.
1780 end 1765 end
1781 1766
1782 1767
1783 function WDP:CHAT_MSG_SYSTEM(event_name, message) 1768 function WDP:CHAT_MSG_SYSTEM(event_name, message)
1784 -- This code no longer works, as of Patch 7.0.3, because Blizzard unified the text from quest rewards and loot to match (and now there is no way to distinguish between them) 1769 -- This code no longer works, as of Patch 7.0.3, because Blizzard unified the text from quest rewards and loot to match (and now there is no way to distinguish between them)
1770 --[[
1771 -- Removed in Patch 7.0.3; previously used to determine if a system message was a quest reward or not
1772 local ERR_QUEST_REWARD_ITEM_MULT_IS = _G.ERR_QUEST_REWARD_ITEM_MULT_IS or "Received %d of item: %s."
1773 local ERR_QUEST_REWARD_ITEM_S = _G.ERR_QUEST_REWARD_ITEM_S or "Received item: %s."
1774
1785 local item_link, quantity = deformat(message, ERR_QUEST_REWARD_ITEM_MULT_IS) 1775 local item_link, quantity = deformat(message, ERR_QUEST_REWARD_ITEM_MULT_IS)
1786 if not item_link then 1776 if not item_link then
1787 quantity, item_link = 1, deformat(message, ERR_QUEST_REWARD_ITEM_S) 1777 quantity, item_link = 1, deformat(message, ERR_QUEST_REWARD_ITEM_S)
1788 end 1778 end
1789 local item_id = ItemLinkToID(item_link) 1779 local item_id = ItemLinkToID(item_link)
1791 if item_id then 1781 if item_id then
1792 -- If it was a quest message (that we can decode), parse its link 1782 -- If it was a quest message (that we can decode), parse its link
1793 RecordItemData(item_id, item_link, true) 1783 RecordItemData(item_id, item_link, true)
1794 else 1784 else
1795 -- If it isn't a quest message, check the other uses of system messages 1785 -- If it isn't a quest message, check the other uses of system messages
1796 if not private.trainer_shown then 1786 end
1797 local recipe_name = message:match(RECIPE_MATCH) 1787 ]]--
1798 1788
1799 if recipe_name and private.previous_spell_id then 1789 if not private.trainer_shown then
1800 local profession_name, prof_level = _G.C_TradeSkillUI.GetTradeSkillLine() 1790 local recipe_name = message:match(RECIPE_MATCH)
1801 1791
1802 if profession_name == _G.UNKNOWN then 1792 if recipe_name and private.previous_spell_id then
1803 return 1793 local profession_name, prof_level = _G.C_TradeSkillUI.GetTradeSkillLine()
1804 end 1794
1805 private.discovered_recipe_name = recipe_name 1795 if profession_name == _G.UNKNOWN then
1806 private.profession_level = prof_level 1796 return
1807 1797 end
1808 C_Timer.After(0.2, IterativeRecordDiscovery) 1798 private.discovered_recipe_name = recipe_name
1809 end 1799 private.profession_level = prof_level
1810 end 1800
1811 1801 C_Timer.After(0.2, IterativeRecordDiscovery)
1812 if currently_drunk then 1802 end
1813 if message == _G.DRUNK_MESSAGE_SELF1 or message:match(SOBER_MATCH) then 1803 end
1814 currently_drunk = nil 1804
1815 end 1805 if currently_drunk then
1816 return 1806 if message == _G.DRUNK_MESSAGE_SELF1 or message:match(SOBER_MATCH) then
1817 end 1807 currently_drunk = nil
1818 1808 end
1819 for index = 1, #DRUNK_MATCHES do 1809 return
1820 if message == DRUNK_COMPARES[index] or message:match(DRUNK_MATCHES[index]) then 1810 end
1821 currently_drunk = true 1811
1822 break 1812 for index = 1, #DRUNK_MATCHES do
1823 end 1813 if message == DRUNK_COMPARES[index] or message:match(DRUNK_MATCHES[index]) then
1814 currently_drunk = true
1815 break
1824 end 1816 end
1825 end 1817 end
1826 end 1818 end
1827 end 1819 end
1828 1820