Mercurial > wow > wowdb-profiler
comparison Main.lua @ 55:2b5a2d60dd51
Removed code for 4.3.4 compatibility. Set merchant filters to All before scanning and then restore them afterward.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Tue, 03 Jul 2012 11:54:36 -0500 |
parents | 052c4075df13 |
children | b58277aa11da |
comparison
equal
deleted
inserted
replaced
54:7125e4976001 | 55:2b5a2d60dd51 |
---|---|
833 end | 833 end |
834 | 834 |
835 if _G.type(verify_func) == "function" and not verify_func() then | 835 if _G.type(verify_func) == "function" and not verify_func() then |
836 return | 836 return |
837 end | 837 end |
838 -- TODO: Remove this check once the MoP client goes live | |
839 local wow_version = private.wow_version | |
840 local loot_registry = {} | 838 local loot_registry = {} |
841 action_data.loot_list = {} | 839 action_data.loot_list = {} |
842 action_data.looting = true | 840 action_data.looting = true |
843 | 841 |
844 if wow_version == "5.0.1" then | 842 for loot_slot = 1, _G.GetNumLootItems() do |
845 for loot_slot = 1, _G.GetNumLootItems() do | 843 local icon_texture, item_text, quantity, quality, locked = _G.GetLootSlotInfo(loot_slot) |
846 local icon_texture, item_text, quantity, quality, locked = _G.GetLootSlotInfo(loot_slot) | 844 local slot_type = _G.GetLootSlotType(loot_slot) |
847 | 845 |
848 local slot_type = _G.GetLootSlotType(loot_slot) | 846 if slot_type == _G.LOOT_SLOT_ITEM then |
849 | 847 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot)) |
850 if slot_type == _G.LOOT_SLOT_ITEM then | 848 loot_registry[item_id] = (loot_registry[item_id]) or 0 + quantity |
851 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot)) | 849 elseif slot_type == _G.LOOT_SLOT_MONEY then |
852 loot_registry[item_id] = (loot_registry[item_id]) or 0 + quantity | 850 table.insert(action_data.loot_list, ("money:%d"):format(_toCopper(item_text))) |
853 elseif slot_type == _G.LOOT_SLOT_MONEY then | 851 elseif slot_type == _G.LOOT_SLOT_CURRENCY then |
854 table.insert(action_data.loot_list, ("money:%d"):format(_toCopper(item_text))) | 852 table.insert(action_data.loot_list, ("currency:%d:%s"):format(quantity, icon_texture:match("[^\\]+$"):lower())) |
855 elseif slot_type == _G.LOOT_SLOT_CURRENCY then | |
856 table.insert(action_data.loot_list, ("currency:%d:%s"):format(quantity, icon_texture:match("[^\\]+$"):lower())) | |
857 end | |
858 end | |
859 else | |
860 for loot_slot = 1, _G.GetNumLootItems() do | |
861 local icon_texture, item_text, quantity, quality, locked = _G.GetLootSlotInfo(loot_slot) | |
862 if _G.LootSlotIsItem(loot_slot) then | |
863 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot)) | |
864 loot_registry[item_id] = (loot_registry[item_id]) or 0 + quantity | |
865 elseif _G.LootSlotIsCoin(loot_slot) then | |
866 table.insert(action_data.loot_list, ("money:%d"):format(_toCopper(item_text))) | |
867 elseif _G.LootSlotIsCurrency(loot_slot) then | |
868 table.insert(action_data.loot_list, ("currency:%d:%s"):format(quantity, icon_texture:match("[^\\]+$"):lower())) | |
869 end | |
870 end | 853 end |
871 end | 854 end |
872 | 855 |
873 for item_id, quantity in pairs(loot_registry) do | 856 for item_id, quantity in pairs(loot_registry) do |
874 table.insert(action_data.loot_list, ("%d:%d"):format(item_id, quantity)) | 857 table.insert(action_data.loot_list, ("%d:%d"):format(item_id, quantity)) |
891 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target")) | 874 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target")) |
892 | 875 |
893 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then | 876 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then |
894 return | 877 return |
895 end | 878 end |
879 local num_items = _G.GetMerchantNumItems() | |
880 local current_filters = _G.GetMerchantFilter() | |
896 local _, merchant_standing = UnitFactionStanding("target") | 881 local _, merchant_standing = UnitFactionStanding("target") |
897 local merchant = NPCEntry(unit_idnum) | 882 local merchant = NPCEntry(unit_idnum) |
898 merchant.sells = merchant.sells or {} | 883 merchant.sells = merchant.sells or {} |
899 | 884 |
900 local num_items = _G.GetMerchantNumItems() | 885 _G.MerchantFrame_SetFilter(nil, _G.LE_LOOT_FILTER_ALL) |
901 | 886 |
902 for item_index = 1, num_items do | 887 for item_index = 1, num_items do |
903 local _, _, copper_price, stack_size, num_available, _, extended_cost = _G.GetMerchantItemInfo(item_index) | 888 local _, _, copper_price, stack_size, num_available, _, extended_cost = _G.GetMerchantItemInfo(item_index) |
904 local item_id = ItemLinkToID(_G.GetMerchantItemLink(item_index)) | 889 local item_id = ItemLinkToID(_G.GetMerchantItemLink(item_index)) |
905 | 890 |
962 end | 947 end |
963 | 948 |
964 if _G.CanMerchantRepair() then | 949 if _G.CanMerchantRepair() then |
965 merchant.can_repair = true | 950 merchant.can_repair = true |
966 end | 951 end |
952 _G.MerchantFrame_SetFilter(nil, current_filters) | |
967 end | 953 end |
968 end -- do-block | 954 end -- do-block |
969 | 955 |
970 function WDP:PET_BAR_UPDATE() | 956 function WDP:PET_BAR_UPDATE() |
971 if not action_data.label or not action_data.label == "mind_control" then | 957 if not action_data.label or not action_data.label == "mind_control" then |