# HG changeset patch # User MMOSimca # Date 1419086284 18000 # Node ID f1da74457a9873d0cc1f97c201a9233d38431e29 # Parent 792320b3fc4d26692dd7ba7e1a76f5a91ccbae4f Simplified ClearChatLootData calls (checks always done after the call) and fixed LOOT_SLOT_CLEARED event. diff -r 792320b3fc4d -r f1da74457a98 Main.lua --- 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