Mercurial > wow > wowdb-profiler
comparison Main.lua @ 150:11f242b0b170
Get the number of merchant items AFTER clearing filters.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Wed, 03 Oct 2012 14:44:52 -0500 |
parents | ca490b4a98e8 |
children | e2331b00a1cf |
comparison
equal
deleted
inserted
replaced
149:3883ebb8baef | 150:11f242b0b170 |
---|---|
1385 end | 1385 end |
1386 merchant_standing = select(2, UnitFactionStanding("target")) | 1386 merchant_standing = select(2, UnitFactionStanding("target")) |
1387 current_merchant = NPCEntry(unit_idnum) | 1387 current_merchant = NPCEntry(unit_idnum) |
1388 current_merchant.sells = current_merchant.sells or {} | 1388 current_merchant.sells = current_merchant.sells or {} |
1389 end | 1389 end |
1390 local num_items = _G.GetMerchantNumItems() | |
1391 local current_filters = _G.GetMerchantFilter() | 1390 local current_filters = _G.GetMerchantFilter() |
1392 _G.SetMerchantFilter(_G.LE_LOOT_FILTER_ALL) | 1391 _G.SetMerchantFilter(_G.LE_LOOT_FILTER_ALL) |
1393 _G.MerchantFrame_Update() | 1392 _G.MerchantFrame_Update() |
1393 | |
1394 local num_items = _G.GetMerchantNumItems() | |
1394 | 1395 |
1395 for item_index = 1, num_items do | 1396 for item_index = 1, num_items do |
1396 local _, _, copper_price, stack_size, num_available, _, extended_cost = _G.GetMerchantItemInfo(item_index) | 1397 local _, _, copper_price, stack_size, num_available, _, extended_cost = _G.GetMerchantItemInfo(item_index) |
1397 local item_id = ItemLinkToID(_G.GetMerchantItemLink(item_index)) | 1398 local item_id = ItemLinkToID(_G.GetMerchantItemLink(item_index)) |
1398 | 1399 |
1775 if not spell_label then | 1776 if not spell_label then |
1776 return | 1777 return |
1777 end | 1778 end |
1778 table.wipe(current_action) | 1779 table.wipe(current_action) |
1779 | 1780 |
1780 local tt_item_name, tt_item_link = _G.GameTooltip:GetItem() | 1781 local item_name, item_link = _G.GameTooltip:GetItem() |
1781 local tt_unit_name, tt_unit_id = _G.GameTooltip:GetUnit() | 1782 local unit_name, unit_id = _G.GameTooltip:GetUnit() |
1782 | 1783 |
1783 if not tt_unit_name and _G.UnitName("target") == target_name then | 1784 if not unit_name and _G.UnitName("target") == target_name then |
1784 tt_unit_name = target_name | 1785 unit_name = target_name |
1785 tt_unit_id = "target" | 1786 unit_id = "target" |
1786 end | 1787 end |
1787 local spell_flags = private.SPELL_FLAGS_BY_LABEL[spell_label] | 1788 local spell_flags = private.SPELL_FLAGS_BY_LABEL[spell_label] |
1788 local zone_name, area_id, x, y, map_level, instance_token = CurrentLocationData() | 1789 local zone_name, area_id, x, y, map_level, instance_token = CurrentLocationData() |
1789 | 1790 |
1790 current_action.instance_token = instance_token | 1791 current_action.instance_token = instance_token |
1796 | 1797 |
1797 if not private.NON_LOOT_SPELL_LABELS[spell_label] then | 1798 if not private.NON_LOOT_SPELL_LABELS[spell_label] then |
1798 current_action.loot_label = spell_label:lower() | 1799 current_action.loot_label = spell_label:lower() |
1799 end | 1800 end |
1800 | 1801 |
1801 if tt_unit_name and not tt_item_name then | 1802 if unit_name and not item_name then |
1802 if bit.band(spell_flags, AF.NPC) == AF.NPC then | 1803 if bit.band(spell_flags, AF.NPC) == AF.NPC then |
1803 if not tt_unit_id or tt_unit_name ~= target_name then | 1804 if not unit_id or unit_name ~= target_name then |
1804 return | 1805 return |
1805 end | 1806 end |
1806 current_action.target_type = AF.NPC | 1807 current_action.target_type = AF.NPC |
1807 end | 1808 end |
1808 elseif bit.band(spell_flags, AF.ITEM) == AF.ITEM then | 1809 elseif bit.band(spell_flags, AF.ITEM) == AF.ITEM then |
1809 current_action.target_type = AF.ITEM | 1810 current_action.target_type = AF.ITEM |
1810 | 1811 |
1811 if tt_item_name and tt_item_name == target_name then | 1812 if item_name and item_name == target_name then |
1812 current_action.identifier = ItemLinkToID(tt_item_link) | 1813 current_action.identifier = ItemLinkToID(item_link) |
1813 elseif target_name and target_name ~= "" then | 1814 elseif target_name and target_name ~= "" then |
1814 local _, target_item_link = _G.GetItemInfo(target_name) | 1815 current_action.identifier = ItemLinkToID(select(2, _G.GetItemInfo(target_name))) |
1815 current_action.identifier = ItemLinkToID(target_item_link) | 1816 end |
1816 end | 1817 elseif not item_name and not unit_name then |
1817 elseif not tt_item_name and not tt_unit_name then | |
1818 if bit.band(spell_flags, AF.OBJECT) == AF.OBJECT then | 1818 if bit.band(spell_flags, AF.OBJECT) == AF.OBJECT then |
1819 if target_name == "" then | 1819 if target_name == "" then |
1820 return | 1820 return |
1821 end | 1821 end |
1822 current_action.object_name = target_name | 1822 current_action.object_name = target_name |