changeset 410:ad8323486561

Added support for more item containers without loot windows. Improved conditional statements related to item handling.
author MMOSimca <MMOSimca@gmail.com>
date Fri, 02 Jan 2015 02:56:25 -0500
parents 78a2e8928a34
children 4adc1fa4ddba
files Constants.lua Main.lua
diffstat 2 files changed, 40 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/Constants.lua	Wed Dec 31 07:57:28 2014 -0500
+++ b/Constants.lua	Fri Jan 02 02:56:25 2015 -0500
@@ -70,8 +70,6 @@
     [73500] = 52340,
     [80615] = 58856,
     [84193] = 60838,
-    [85325] = 54218,
-    [85435] = 50301,
     [99438] = 69956,
     [99500] = 69990,
     [109946] = 78890,
@@ -296,15 +294,20 @@
 -- It also means there is a high margin for bad data since multiple bags can be clicked within a small time frame.
 -- True = instant cast; false = cast time
 private.CONTAINER_ITEM_ID_LIST = {
-    [105751] = true, -- Kor'kron Shaman's Treasure
-    [116980] = true, -- Invader's Forgotten Treasure
-    [118529] = true, -- Cache of Highmaul Treasures (Normal)
-    [118530] = true, -- Cache of Highmaul Treasures (Heroic)
-    [118531] = true, -- Cache of Highmaul Treasures (Mythic)
-    [119036] = true, -- Box of Storied Treasures
-    [119037] = true, -- Supply of Storied Rarities
-    [120319] = true, -- Invader's Damaged Cache
-    [120320] = true, -- Invader's Abandoned Sack
+    [50301] = true,
+    [54218] = true,
+    [97565] = true,
+    [102137] = true,
+    [105751] = true,
+    [110592] = true,
+    [116980] = true,
+    [118529] = true,
+    [118530] = true,
+    [118531] = true,
+    [119036] = true,
+    [119037] = true,
+    [120319] = true,
+    [120320] = true,
 }
 for key, value in next, private.DELAYED_CONTAINER_SPELL_ID_TO_ITEM_ID_MAP do
     private.CONTAINER_ITEM_ID_LIST[value] = false
--- a/Main.lua	Wed Dec 31 07:57:28 2014 -0500
+++ b/Main.lua	Fri Jan 02 02:56:25 2015 -0500
@@ -575,27 +575,35 @@
         end
     end
 
-    if not bag_index or not slot_index then
-        return
+    local any_loot = false
+
+    -- Check if Blizzard has marked this item has officially having a chance of containing loot
+    if bag_index and slot_index then
+        local _, _, _, _, _, is_lootable = _G.GetContainerItemInfo(bag_index, slot_index)
+        if is_lootable then
+            any_loot = true
+        end
     end
-    local _, _, _, _, _, is_lootable = _G.GetContainerItemInfo(bag_index, slot_index)
-
-    if not is_lootable and not private.CONTAINER_ITEM_ID_LIST[item_id] then
-        return
+    
+    -- Check if we've marked this item as one Blizzard provides bad is_lootable data for
+    if private.CONTAINER_ITEM_ID_LIST[item_id] ~= nil then
+        any_loot = true
     end
 
-    table.wipe(current_action)
-    current_loot = nil
-    current_action.target_type = AF.ITEM
-    current_action.identifier = item_id
-    current_action.loot_label = "contains"
-
-    -- For items that open instantly with no spell cast
-    if _G.GetNumLootItems() == 0 and private.CONTAINER_ITEM_ID_LIST[item_id] == true then
-        ClearChatLootData()
-        Debug("HandleItemUse: Beginning chat-based loot timer for item with ID %d.", item_id)
-        chat_loot_timer_handle = C_Timer.NewTimer(1, ClearChatLootData)
-        InitializeCurrentLoot()
+    if any_loot then
+        table.wipe(current_action)
+        current_loot = nil
+        current_action.target_type = AF.ITEM
+        current_action.identifier = item_id
+        current_action.loot_label = "contains"
+
+        -- For items that open instantly with no spell cast
+        if (private.CONTAINER_ITEM_ID_LIST[item_id] == true) and ((not _G.GetNumLootItems()) or (_G.GetNumLootItems() == 0)) then
+            ClearChatLootData()
+            Debug("HandleItemUse: Beginning chat-based loot timer for item with ID %d.", item_id)
+            chat_loot_timer_handle = C_Timer.NewTimer(1, ClearChatLootData)
+            InitializeCurrentLoot()
+        end
     end
 
     --[[DatamineTT:ClearLines()