comparison Main.lua @ 344:7bca9a0f9382 WoD

Fixed loot extrapolation restrictions. Fixed Blizzard bug with Trainer filters not using boolean values.
author MMOSimca <MMOSimca@gmail.com>
date Fri, 03 Oct 2014 15:09:44 -0400
parents 2149753132a1
children 61a9520b5337
comparison
equal deleted inserted replaced
343:2149753132a1 344:7bca9a0f9382
1808 1808
1809 local function ExtrapolatedCurrentActionFromLootData(event_name) 1809 local function ExtrapolatedCurrentActionFromLootData(event_name)
1810 local extrapolated_guid_registry = {} 1810 local extrapolated_guid_registry = {}
1811 local num_guids = 0 1811 local num_guids = 0
1812 1812
1813 -- Loot extrapolation cannot handle objects that need special spell labels (like HERBALISM or MINING) (MIND_CONTROL is okay)
1814 if SPELL_FLAGS_BY_LABEL[current_action.spell_label] and not NON_LOOT_SPELL_LABELS[current_action.spell_label] then
1815 Debug("%s: Problematic spell label %s found. Loot extrapolation for this set of loot would have run an increased risk of introducing bad data into the system.", log_source, private.previous_spell_id)
1816 table.wipe(current_action)
1817 return false
1818 end
1819
1813 table.wipe(current_action) 1820 table.wipe(current_action)
1814 1821
1815 for loot_slot = 1, _G.GetNumLootItems() do 1822 for loot_slot = 1, _G.GetNumLootItems() do
1816 local loot_info = { 1823 local loot_info = {
1817 _G.GetLootSourceInfo(loot_slot) 1824 _G.GetLootSourceInfo(loot_slot)
1836 end 1843 end
1837 local log_source = event_name .. "- ExtrapolatedCurrentActionFromLootData" 1844 local log_source = event_name .. "- ExtrapolatedCurrentActionFromLootData"
1838 1845
1839 if num_guids == 0 then 1846 if num_guids == 0 then
1840 Debug("%s: No GUIDs found in loot. Blank loot window?", log_source) 1847 Debug("%s: No GUIDs found in loot. Blank loot window?", log_source)
1841 return false
1842 end
1843 if private.previous_spell_id and private.EXTRAPOLATION_BANNED_SPELL_IDS[private.previous_spell_id] then
1844 Debug("%s: Problematic spell id %s found. Loot extrapolation for this set of loot would have run an increased risk of introducing bad data into the system.", log_source, private.previous_spell_id)
1845 return false 1848 return false
1846 end 1849 end
1847 1850
1848 local num_npcs = 0 1851 local num_npcs = 0
1849 local num_objects = 0 1852 local num_objects = 0
2372 trainer.teaches = trainer.teaches or {} 2375 trainer.teaches = trainer.teaches or {}
2373 2376
2374 private.trainer_shown = true 2377 private.trainer_shown = true
2375 2378
2376 -- Get the initial trainer filters 2379 -- Get the initial trainer filters
2377 local available = _G.GetTrainerServiceTypeFilter("available") 2380 local available = _G.GetTrainerServiceTypeFilter("available") and 1 or 0
2378 local unavailable = _G.GetTrainerServiceTypeFilter("unavailable") 2381 local unavailable = _G.GetTrainerServiceTypeFilter("unavailable") and 1 or 0
2379 local used = _G.GetTrainerServiceTypeFilter("used") 2382 local used = _G.GetTrainerServiceTypeFilter("used") and 1 or 0
2380 2383
2381 -- Clear the trainer filters 2384 -- Clear the trainer filters
2382 _G.SetTrainerServiceTypeFilter("available", true) 2385 _G.SetTrainerServiceTypeFilter("available", 1)
2383 _G.SetTrainerServiceTypeFilter("unavailable", true) 2386 _G.SetTrainerServiceTypeFilter("unavailable", 1)
2384 _G.SetTrainerServiceTypeFilter("used", true) 2387 _G.SetTrainerServiceTypeFilter("used", 1)
2385 2388
2386 for index = 1, _G.GetNumTrainerServices(), 1 do 2389 for index = 1, _G.GetNumTrainerServices(), 1 do
2387 local spell_name, rank_name, _, _, required_level = _G.GetTrainerServiceInfo(index) 2390 local spell_name, rank_name, _, _, required_level = _G.GetTrainerServiceInfo(index)
2388 2391
2389 if spell_name then 2392 if spell_name then
2411 profession_skills[spell_id] = ("%d:%d:%d"):format(required_level, min_skill, _G.GetTrainerServiceCost(index)) 2414 profession_skills[spell_id] = ("%d:%d:%d"):format(required_level, min_skill, _G.GetTrainerServiceCost(index))
2412 end 2415 end
2413 end 2416 end
2414 end 2417 end
2415 -- Reset the filters to what they were before 2418 -- Reset the filters to what they were before
2416 _G.SetTrainerServiceTypeFilter("available", available or false) 2419 _G.SetTrainerServiceTypeFilter("available", available or 0)
2417 _G.SetTrainerServiceTypeFilter("unavailable", unavailable or false) 2420 _G.SetTrainerServiceTypeFilter("unavailable", unavailable or 0)
2418 _G.SetTrainerServiceTypeFilter("used", used or false) 2421 _G.SetTrainerServiceTypeFilter("used", used or 0)
2419 end 2422 end
2420 2423
2421 2424
2422 function WDP:UNIT_SPELLCAST_SENT(event_name, unit_id, spell_name, spell_rank, target_name, spell_line) 2425 function WDP:UNIT_SPELLCAST_SENT(event_name, unit_id, spell_name, spell_rank, target_name, spell_line)
2423 if private.tracked_line or unit_id ~= "player" then 2426 if private.tracked_line or unit_id ~= "player" then