comparison Main.lua @ 444:929d7657e23b 6.1.0-3

Implemented support for recording money data via SHOW_LOOT_TOAST during chat-based loot recording.
author MMOSimca <MMOSimca@gmail.com>
date Tue, 10 Mar 2015 01:22:48 -0400
parents cecd877476ff
children c8b5277f5e2e
comparison
equal deleted inserted replaced
443:cecd877476ff 444:929d7657e23b
1487 end 1487 end
1488 1488
1489 GenericLootUpdate("items") 1489 GenericLootUpdate("items")
1490 current_loot = nil 1490 current_loot = nil
1491 container_loot_toasting = true -- Do not count further loots until timer expires or another container is opened 1491 container_loot_toasting = true -- Do not count further loots until timer expires or another container is opened
1492 elseif loot_source and (loot_source == LOOT_SOURCE_ID_REDUNDANT) and chat_loot_timer_handle and loot_type == "currency" then 1492 elseif loot_source and (loot_source == LOOT_SOURCE_ID_REDUNDANT) and chat_loot_timer_handle then
1493 local currency_texture = CurrencyLinkToTexture(item_link) 1493 -- Handle currency loot toasts for chat-based loot (we do this instead of reading currency chat messages because the chat messages are very delayed)
1494 if currency_texture and currency_texture ~= "" then 1494 if loot_type == "currency" then
1495 local currency_texture = CurrencyLinkToTexture(item_link)
1496 if currency_texture and currency_texture ~= "" then
1497 -- Verify that we're still assigning data to the right items
1498 if chat_loot_data.identifier and (private.CONTAINER_ITEM_ID_LIST[chat_loot_data.identifier] ~= nil) then
1499 local currency_token = ("currency:%s"):format(currency_texture)
1500 Debug("%s: Captured currency for chat-based loot recording. %s X %d", event_name, currency_token, quantity)
1501 chat_loot_data.loot = chat_loot_data.loot or {}
1502 chat_loot_data.loot[currency_token] = (chat_loot_data.loot[currency_token] or 0) + quantity
1503 else -- If not, cancel the timer and wipe the loot table early
1504 Debug("%s: Canceled chat-based loot recording because we would have assigned the wrong loot!", event_name)
1505 ClearChatLootData()
1506 end
1507 else
1508 Debug("%s: Currency texture is nil, from currency link %s", event_name, item_link)
1509 end
1510 -- Handle money loot toasts for chat-based loot (we do this instead of reading money chat messages because the chat messages are very delayed)
1511 elseif loot_type == "money" then
1495 -- Verify that we're still assigning data to the right items 1512 -- Verify that we're still assigning data to the right items
1496 if chat_loot_data.identifier and (private.CONTAINER_ITEM_ID_LIST[chat_loot_data.identifier] ~= nil) then 1513 if chat_loot_data.identifier and (private.CONTAINER_ITEM_ID_LIST[chat_loot_data.identifier] ~= nil) then
1497 local currency_token = ("currency:%s"):format(currency_texture) 1514 Debug("%s: Captured money for chat-based loot recording. money X %d", event_name, quantity)
1498 Debug("%s: Captured currency for chat-based loot recording. %s X %d", event_name, currency_token, quantity)
1499 chat_loot_data.loot = chat_loot_data.loot or {} 1515 chat_loot_data.loot = chat_loot_data.loot or {}
1500 chat_loot_data.loot[currency_token] = (chat_loot_data.loot[currency_token] or 0) + quantity 1516 chat_loot_data.loot["money"] = (chat_loot_data.loot["money"] or 0) + quantity
1501 else -- If not, cancel the timer and wipe the loot table early 1517 else -- If not, cancel the timer and wipe the loot table early
1502 Debug("%s: Canceled chat-based loot recording because we would have assigned the wrong loot!", event_name) 1518 Debug("%s: Canceled chat-based loot recording because we would have assigned the wrong loot!", event_name)
1503 ClearChatLootData() 1519 ClearChatLootData()
1504 end 1520 end
1505 else
1506 Debug("%s: Currency texture is nil, from currency link %s", event_name, item_link)
1507 end 1521 end
1508 else 1522 else
1509 Debug("%s: NPC and Container are nil, storing loot toast data for 5 seconds.", event_name) 1523 Debug("%s: NPC and Container are nil, storing loot toast data for 5 seconds.", event_name)
1510 1524
1511 loot_toast_data = loot_toast_data or {} 1525 loot_toast_data = loot_toast_data or {}