changeset 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
files Constants.lua Main.lua
diffstat 2 files changed, 16 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/Constants.lua	Fri Oct 03 15:07:30 2014 -0400
+++ b/Constants.lua	Fri Oct 03 15:09:44 2014 -0400
@@ -398,21 +398,6 @@
     private.ACTION_TYPE_NAMES[bit] = name
 end
 
-private.EXTRAPOLATION_BANNED_SPELL_IDS = {
-    [13262] = "DISENCHANT",
-    [4036] = "ENGINEERING",
-    [30427] = "EXTRACT_GAS",
-    [131476] = "FISHING",
-    [2366] = "HERB_GATHERING",
-    [51005] = "MILLING",
-    [605] = "MIND_CONTROL",
-    [2575] = "MINING",
-    [921] = "PICK_POCKET",
-    [31252] = "PROSPECTING",
-    [73979] = "SEARCHING_FOR_ARTIFACTS",
-    [8613] = "SKINNING",
-}
-
 private.SPELL_LABELS_BY_NAME = {
     [_G.GetSpellInfo(13262)] = "DISENCHANT",
     [_G.GetSpellInfo(4036)] = "ENGINEERING",
--- a/Main.lua	Fri Oct 03 15:07:30 2014 -0400
+++ b/Main.lua	Fri Oct 03 15:09:44 2014 -0400
@@ -1810,6 +1810,13 @@
         local extrapolated_guid_registry = {}
         local num_guids = 0
 
+        -- Loot extrapolation cannot handle objects that need special spell labels (like HERBALISM or MINING) (MIND_CONTROL is okay)
+        if SPELL_FLAGS_BY_LABEL[current_action.spell_label] and not NON_LOOT_SPELL_LABELS[current_action.spell_label] then
+            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)
+            table.wipe(current_action)
+            return false
+        end
+
         table.wipe(current_action)
 
         for loot_slot = 1, _G.GetNumLootItems() do
@@ -1840,10 +1847,6 @@
             Debug("%s: No GUIDs found in loot. Blank loot window?", log_source)
             return false
         end
-        if private.previous_spell_id and private.EXTRAPOLATION_BANNED_SPELL_IDS[private.previous_spell_id] then
-            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)
-            return false
-        end
 
         local num_npcs = 0
         local num_objects = 0
@@ -2374,14 +2377,14 @@
     private.trainer_shown = true
 
     -- Get the initial trainer filters
-    local available = _G.GetTrainerServiceTypeFilter("available")
-    local unavailable = _G.GetTrainerServiceTypeFilter("unavailable")
-    local used = _G.GetTrainerServiceTypeFilter("used")
+    local available = _G.GetTrainerServiceTypeFilter("available") and 1 or 0
+    local unavailable = _G.GetTrainerServiceTypeFilter("unavailable") and 1 or 0
+    local used = _G.GetTrainerServiceTypeFilter("used") and 1 or 0
 
     -- Clear the trainer filters
-    _G.SetTrainerServiceTypeFilter("available", true)
-    _G.SetTrainerServiceTypeFilter("unavailable", true)
-    _G.SetTrainerServiceTypeFilter("used", true)
+    _G.SetTrainerServiceTypeFilter("available", 1)
+    _G.SetTrainerServiceTypeFilter("unavailable", 1)
+    _G.SetTrainerServiceTypeFilter("used", 1)
 
     for index = 1, _G.GetNumTrainerServices(), 1 do
         local spell_name, rank_name, _, _, required_level = _G.GetTrainerServiceInfo(index)
@@ -2413,9 +2416,9 @@
         end
     end
     -- Reset the filters to what they were before
-    _G.SetTrainerServiceTypeFilter("available", available or false)
-    _G.SetTrainerServiceTypeFilter("unavailable", unavailable or false)
-    _G.SetTrainerServiceTypeFilter("used", used or false)
+    _G.SetTrainerServiceTypeFilter("available", available or 0)
+    _G.SetTrainerServiceTypeFilter("unavailable", unavailable or 0)
+    _G.SetTrainerServiceTypeFilter("used", used or 0)
 end