comparison 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
comparison
equal deleted inserted replaced
397:792320b3fc4d 398:f1da74457a98
109 GUILDBANKFRAME_OPENED = true, 109 GUILDBANKFRAME_OPENED = true,
110 ITEM_TEXT_BEGIN = true, 110 ITEM_TEXT_BEGIN = true,
111 ITEM_UPGRADE_MASTER_OPENED = true, 111 ITEM_UPGRADE_MASTER_OPENED = true,
112 LOOT_CLOSED = true, 112 LOOT_CLOSED = true,
113 LOOT_OPENED = true, 113 LOOT_OPENED = true,
114 LOOT_SLOT_CLEARED = "ClearChatLootData", 114 LOOT_SLOT_CLEARED = true,
115 MAIL_SHOW = true, 115 MAIL_SHOW = true,
116 MERCHANT_CLOSED = true, 116 MERCHANT_CLOSED = true,
117 MERCHANT_SHOW = "UpdateMerchantItems", 117 MERCHANT_SHOW = "UpdateMerchantItems",
118 MERCHANT_UPDATE = "UpdateMerchantItems", 118 MERCHANT_UPDATE = "UpdateMerchantItems",
119 PET_BAR_UPDATE = true, 119 PET_BAR_UPDATE = true,
896 end 896 end
897 end 897 end
898 898
899 899
900 function ClearChatLootData() 900 function ClearChatLootData()
901 if chat_loot_timer_handle then 901 if not chat_loot_timer_handle then
902 Debug("ClearChatLootData: Ending chat-based loot timer.") 902 return
903 chat_loot_timer_handle:Cancel() 903 end
904 chat_loot_timer_handle = nil 904 Debug("ClearChatLootData: Ending chat-based loot timer.")
905 905 chat_loot_timer_handle:Cancel()
906 if current_loot and current_loot.identifier and (private.CONTAINER_ITEM_ID_LIST[current_loot.identifier] ~= nil) then 906 chat_loot_timer_handle = nil
907 GenericLootUpdate("items") 907
908 end 908 if current_loot and current_loot.identifier and (private.CONTAINER_ITEM_ID_LIST[current_loot.identifier] ~= nil) then
909 GenericLootUpdate("items")
909 end 910 end
910 current_loot = nil 911 current_loot = nil
911 end 912 end
912 913
913 914
1270 end 1271 end
1271 end -- do-block 1272 end -- do-block
1272 1273
1273 1274
1274 -- EVENT HANDLERS ----------------------------------------------------- 1275 -- EVENT HANDLERS -----------------------------------------------------
1276
1277 function WDP:LOOT_SLOT_CLEARED(...)
1278 ClearChatLootData()
1279 end
1280
1275 1281
1276 function WDP:BLACK_MARKET_ITEM_UPDATE(event_name) 1282 function WDP:BLACK_MARKET_ITEM_UPDATE(event_name)
1277 if not ALLOWED_LOCALES[CLIENT_LOCALE] then 1283 if not ALLOWED_LOCALES[CLIENT_LOCALE] then
1278 return 1284 return
1279 end 1285 end
2029 -- Prevent opening the same loot window multiple times from recording data multiple times. 2035 -- Prevent opening the same loot window multiple times from recording data multiple times.
2030 local loot_guid_registry = {} 2036 local loot_guid_registry = {}
2031 2037
2032 2038
2033 function WDP:LOOT_CLOSED(event_name) 2039 function WDP:LOOT_CLOSED(event_name)
2034 if chat_loot_timer_handle then 2040 ClearChatLootData()
2035 ClearChatLootData()
2036 end
2037 current_loot = nil 2041 current_loot = nil
2038 table.wipe(current_action) 2042 table.wipe(current_action)
2039 end 2043 end
2040 2044
2041 2045
2134 return true 2138 return true
2135 end 2139 end
2136 2140
2137 2141
2138 function WDP:LOOT_OPENED(event_name) 2142 function WDP:LOOT_OPENED(event_name)
2139 if chat_loot_timer_handle then 2143 ClearChatLootData()
2140 ClearChatLootData()
2141 end
2142 2144
2143 if current_loot then 2145 if current_loot then
2144 current_loot = nil 2146 current_loot = nil
2145 Debug("%s: Previous loot did not process in time for this event. Attempting to extrapolate current_action from loot data.", event_name) 2147 Debug("%s: Previous loot did not process in time for this event. Attempting to extrapolate current_action from loot data.", event_name)
2146 2148