Mercurial > wow > wowdb-profiler
comparison Main.lua @ 402:da1daa941777 6.0.3-3
ExtrapolatedCurrentActionFromLootData can now generate a proper current_action table for loot from fishing.
author | MMOSimca <MMOSimca@gmail.com> |
---|---|
date | Sun, 21 Dec 2014 22:44:54 -0500 |
parents | 2fa787786d9a |
children | f96f53dfb531 |
comparison
equal
deleted
inserted
replaced
401:2fa787786d9a | 402:da1daa941777 |
---|---|
2043 table.wipe(current_action) | 2043 table.wipe(current_action) |
2044 end | 2044 end |
2045 | 2045 |
2046 | 2046 |
2047 local function ExtrapolatedCurrentActionFromLootData(event_name) | 2047 local function ExtrapolatedCurrentActionFromLootData(event_name) |
2048 local log_source = event_name .. "- ExtrapolatedCurrentActionFromLootData" | |
2049 local previous_spell_label = current_action.spell_label | |
2048 local extrapolated_guid_registry = {} | 2050 local extrapolated_guid_registry = {} |
2049 local num_guids = 0 | 2051 local num_guids = 0 |
2052 table.wipe(current_action) | |
2053 | |
2054 if _G.IsFishingLoot() then | |
2055 -- Set up a proper 'fishing' current_action table | |
2056 local zone_name, area_id, x, y, map_level, instance_token = CurrentLocationData() | |
2057 if not (zone_name and area_id and x and y and map_level) then | |
2058 Debug("%s: Missing current location data - %s, %d, %d, %d, %d.", log_source, zone_name, area_id, x, y, map_level) | |
2059 return | |
2060 end | |
2061 current_action.instance_token = instance_token | |
2062 current_action.map_level = map_level | |
2063 current_action.x = x | |
2064 current_action.y = y | |
2065 current_action.zone_data = ("%s:%d"):format(zone_name, area_id) | |
2066 current_action.spell_label = "FISHING" | |
2067 current_action.loot_label = "fishing" | |
2068 current_action.identifier = "FISHING:NONE" | |
2069 current_action.target_type = AF.ZONE | |
2070 | |
2071 Debug("%s: Fishing loot detected.", log_source) | |
2072 return true | |
2073 end | |
2050 | 2074 |
2051 -- Loot extrapolation cannot handle objects that need special spell labels (like HERBALISM or MINING) (MIND_CONTROL is okay) | 2075 -- Loot extrapolation cannot handle objects that need special spell labels (like HERBALISM or MINING) (MIND_CONTROL is okay) |
2052 if private.SPELL_FLAGS_BY_LABEL[current_action.spell_label] and not private.NON_LOOT_SPELL_LABELS[current_action.spell_label] then | 2076 if previous_spell_label and private.SPELL_FLAGS_BY_LABEL[previous_spell_label] and not private.NON_LOOT_SPELL_LABELS[previous_spell_label] then |
2053 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) | 2077 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) |
2054 table.wipe(current_action) | |
2055 return false | 2078 return false |
2056 end | 2079 end |
2057 | |
2058 table.wipe(current_action) | |
2059 | 2080 |
2060 for loot_slot = 1, _G.GetNumLootItems() do | 2081 for loot_slot = 1, _G.GetNumLootItems() do |
2061 local loot_info = { | 2082 local loot_info = { |
2062 _G.GetLootSourceInfo(loot_slot) | 2083 _G.GetLootSourceInfo(loot_slot) |
2063 } | 2084 } |
2077 num_guids = num_guids + 1 | 2098 num_guids = num_guids + 1 |
2078 end | 2099 end |
2079 end | 2100 end |
2080 end | 2101 end |
2081 end | 2102 end |
2082 local log_source = event_name .. "- ExtrapolatedCurrentActionFromLootData" | |
2083 | 2103 |
2084 if num_guids == 0 then | 2104 if num_guids == 0 then |
2085 Debug("%s: No GUIDs found in loot. Blank loot window?", log_source) | 2105 Debug("%s: No GUIDs found in loot. Blank loot window?", log_source) |
2086 return false | 2106 return false |
2087 end | 2107 end |