comparison Main.lua @ 400:eb64f3b68a27

Combine CHAT_MSG_SYSTEM event handlers (oops). Amended conditional statement in HandleItemUse.
author MMOSimca <MMOSimca@gmail.com>
date Sun, 21 Dec 2014 22:40:43 -0500
parents f1da74457a98
children 2fa787786d9a
comparison
equal deleted inserted replaced
399:b2c7eb63ff92 400:eb64f3b68a27
581 if not bag_index or not slot_index then 581 if not bag_index or not slot_index then
582 return 582 return
583 end 583 end
584 local _, _, _, _, _, is_lootable = _G.GetContainerItemInfo(bag_index, slot_index) 584 local _, _, _, _, _, is_lootable = _G.GetContainerItemInfo(bag_index, slot_index)
585 585
586 if not is_lootable then 586 if not is_lootable and not private.CONTAINER_ITEM_ID_LIST[item_id] then
587 return 587 return
588 end 588 end
589 589
590 table.wipe(current_action) 590 table.wipe(current_action)
591 current_loot = nil 591 current_loot = nil
1611 update_func(item_id, quantity) 1611 update_func(item_id, quantity)
1612 end 1612 end
1613 end 1613 end
1614 1614
1615 1615
1616 function WDP:CHAT_MSG_SYSTEM(event_name, message)
1617 local item_link, quantity = deformat(message, _G.ERR_QUEST_REWARD_ITEM_MULT_IS)
1618 if not item_link then
1619 quantity, item_link = 1, deformat(message, _G.ERR_QUEST_REWARD_ITEM_S)
1620 end
1621 local item_id = ItemLinkToID(item_link)
1622
1623 if not item_id then
1624 return
1625 end
1626
1627 -- We only want to record the item's incoming data; no other need for system messages atm.
1628 RecordItemData(item_id, item_link, true)
1629 end
1630
1631
1632 function WDP:RecordQuote(event_name, message, source_name, language_name) 1616 function WDP:RecordQuote(event_name, message, source_name, language_name)
1633 if not ALLOWED_LOCALES[CLIENT_LOCALE] or not source_name or not name_to_id_map[source_name] or (language_name ~= "" and not languages_known[language_name]) then 1617 if not ALLOWED_LOCALES[CLIENT_LOCALE] or not source_name or not name_to_id_map[source_name] or (language_name ~= "" and not languages_known[language_name]) then
1634 return 1618 return
1635 end 1619 end
1636 local npc = NPCEntry(name_to_id_map[source_name]) 1620 local npc = NPCEntry(name_to_id_map[source_name])
1675 TradeSkillExecutePer(RecordDiscovery) 1659 TradeSkillExecutePer(RecordDiscovery)
1676 end 1660 end
1677 1661
1678 1662
1679 function WDP:CHAT_MSG_SYSTEM(event_name, message) 1663 function WDP:CHAT_MSG_SYSTEM(event_name, message)
1680 if not private.trainer_shown then 1664 local item_link, quantity = deformat(message, _G.ERR_QUEST_REWARD_ITEM_MULT_IS)
1681 local recipe_name = message:match(RECIPE_MATCH) 1665 if not item_link then
1682 1666 quantity, item_link = 1, deformat(message, _G.ERR_QUEST_REWARD_ITEM_S)
1683 if recipe_name and private.previous_spell_id then 1667 end
1684 local profession_name, prof_level = _G.GetTradeSkillLine() 1668 local item_id = ItemLinkToID(item_link)
1685 1669
1686 if profession_name == _G.UNKNOWN then 1670 -- If it isn't a quest message, check the other uses of system messages
1687 return 1671 if not item_id then
1688 end 1672 if not private.trainer_shown then
1689 private.discovered_recipe_name = recipe_name 1673 local recipe_name = message:match(RECIPE_MATCH)
1690 private.profession_level = prof_level 1674
1691 1675 if recipe_name and private.previous_spell_id then
1692 C_Timer.After(0.2, IterativeRecordDiscovery) 1676 local profession_name, prof_level = _G.GetTradeSkillLine()
1693 end 1677
1694 end 1678 if profession_name == _G.UNKNOWN then
1695 1679 return
1696 if currently_drunk then 1680 end
1697 if message == _G.DRUNK_MESSAGE_SELF1 or message:match(SOBER_MATCH) then 1681 private.discovered_recipe_name = recipe_name
1698 currently_drunk = nil 1682 private.profession_level = prof_level
1699 end 1683
1700 return 1684 C_Timer.After(0.2, IterativeRecordDiscovery)
1701 end 1685 end
1702 1686 end
1703 for index = 1, #DRUNK_MATCHES do 1687
1704 if message == DRUNK_COMPARES[index] or message:match(DRUNK_MATCHES[index]) then 1688 if currently_drunk then
1705 currently_drunk = true 1689 if message == _G.DRUNK_MESSAGE_SELF1 or message:match(SOBER_MATCH) then
1706 break 1690 currently_drunk = nil
1707 end 1691 end
1708 end 1692 return
1693 end
1694
1695 for index = 1, #DRUNK_MATCHES do
1696 if message == DRUNK_COMPARES[index] or message:match(DRUNK_MATCHES[index]) then
1697 currently_drunk = true
1698 break
1699 end
1700 end
1701 return
1702 end
1703
1704 -- We only want to record the item's incoming data; no other need for system messages atm.
1705 RecordItemData(item_id, item_link, true)
1709 end 1706 end
1710 end 1707 end
1711 1708
1712 1709
1713 do 1710 do