diff Main.lua @ 398:f1da74457a98 6.0.3-2

Simplified ClearChatLootData calls (checks always done after the call) and fixed LOOT_SLOT_CLEARED event.
author MMOSimca <MMOSimca@gmail.com>
date Sat, 20 Dec 2014 09:38:04 -0500
parents 792320b3fc4d
children eb64f3b68a27
line wrap: on
line diff
--- a/Main.lua	Sat Dec 20 01:37:40 2014 -0500
+++ b/Main.lua	Sat Dec 20 09:38:04 2014 -0500
@@ -111,7 +111,7 @@
     ITEM_UPGRADE_MASTER_OPENED = true,
     LOOT_CLOSED = true,
     LOOT_OPENED = true,
-    LOOT_SLOT_CLEARED = "ClearChatLootData",
+    LOOT_SLOT_CLEARED = true,
     MAIL_SHOW = true,
     MERCHANT_CLOSED = true,
     MERCHANT_SHOW = "UpdateMerchantItems",
@@ -898,14 +898,15 @@
 
 
 function ClearChatLootData()
-    if chat_loot_timer_handle then
-        Debug("ClearChatLootData: Ending chat-based loot timer.")
-        chat_loot_timer_handle:Cancel()
-        chat_loot_timer_handle = nil
-
-        if current_loot and current_loot.identifier and (private.CONTAINER_ITEM_ID_LIST[current_loot.identifier] ~= nil) then
-            GenericLootUpdate("items")
-        end
+    if not chat_loot_timer_handle then
+        return
+    end
+    Debug("ClearChatLootData: Ending chat-based loot timer.")
+    chat_loot_timer_handle:Cancel()
+    chat_loot_timer_handle = nil
+
+    if current_loot and current_loot.identifier and (private.CONTAINER_ITEM_ID_LIST[current_loot.identifier] ~= nil) then
+        GenericLootUpdate("items")
     end
     current_loot = nil
 end
@@ -1273,6 +1274,11 @@
 
 -- EVENT HANDLERS -----------------------------------------------------
 
+function WDP:LOOT_SLOT_CLEARED(...)
+    ClearChatLootData()
+end
+
+
 function WDP:BLACK_MARKET_ITEM_UPDATE(event_name)
     if not ALLOWED_LOCALES[CLIENT_LOCALE] then
         return
@@ -2031,9 +2037,7 @@
 
 
     function WDP:LOOT_CLOSED(event_name)
-        if chat_loot_timer_handle then
-            ClearChatLootData()
-        end
+        ClearChatLootData()
         current_loot = nil
         table.wipe(current_action)
     end
@@ -2136,9 +2140,7 @@
 
 
     function WDP:LOOT_OPENED(event_name)
-        if chat_loot_timer_handle then
-            ClearChatLootData()
-        end
+        ClearChatLootData()
 
         if current_loot then
             current_loot = nil