Mercurial > wow > wowdb-profiler
comparison Main.lua @ 220:62434c87d375
Handle recording of reforged items which have an upgrade ID.
| author | James D. Callahan III <jcallahan@curse.com> |
|---|---|
| date | Fri, 25 Jan 2013 16:37:13 -0600 |
| parents | 09d8ee2c1551 |
| children | 9dca914cbd13 |
comparison
equal
deleted
inserted
replaced
| 219:09d8ee2c1551 | 220:62434c87d375 |
|---|---|
| 801 | 801 |
| 802 local ScrapeItemUpgradeStats | 802 local ScrapeItemUpgradeStats |
| 803 do | 803 do |
| 804 local intermediary = {} | 804 local intermediary = {} |
| 805 | 805 |
| 806 function ScrapeItemUpgradeStats(item_id, item_link, upgrade_id) | 806 function ScrapeItemUpgradeStats(item_id, upgrade_id, reforge_id) |
| 807 if not ALLOWED_LOCALES[CLIENT_LOCALE] then | |
| 808 return | |
| 809 end | |
| 807 local create_entry | 810 local create_entry |
| 808 | 811 |
| 809 table.wipe(intermediary) | 812 table.wipe(intermediary) |
| 810 DatamineTT:SetHyperlink(item_link) | |
| 811 | 813 |
| 812 for line_index = 1, DatamineTT:NumLines() do | 814 for line_index = 1, DatamineTT:NumLines() do |
| 813 local left_text = _G["WDPDatamineTTTextLeft" .. line_index]:GetText() | 815 local left_text = _G["WDPDatamineTTTextLeft" .. line_index]:GetText() |
| 814 | 816 |
| 815 if not left_text then | 817 if not left_text then |
| 816 return | 818 return |
| 817 end | 819 end |
| 818 local amount, stat = left_text:match("+(.-) (.*)") | 820 local amount, stat = left_text:match("+(.-) (.*)") |
| 819 | 821 |
| 820 if amount and stat then | 822 if amount and stat then |
| 821 if stat:find("Reforged") then | 823 if reforge_id and reforge_id ~= 0 then |
| 822 return | 824 local reforge_string = stat:find("Reforged") |
| 825 | |
| 826 if reforge_string then | |
| 827 stat = stat:sub(0, reforge_string - 3) | |
| 828 intermediary.reforge_id = reforge_id | |
| 829 end | |
| 823 end | 830 end |
| 824 create_entry = true | 831 create_entry = true |
| 825 intermediary[stat:lower():gsub(" ", "_"):gsub("|r", "")] = tonumber(amount) | 832 intermediary[stat:lower():gsub(" ", "_"):gsub("|r", "")] = tonumber(amount) |
| 826 end | 833 end |
| 827 end | 834 end |
| 835 | 842 |
| 836 for stat, amount in pairs(intermediary) do | 843 for stat, amount in pairs(intermediary) do |
| 837 item.upgrades[upgrade_id][stat] = amount | 844 item.upgrades[upgrade_id][stat] = amount |
| 838 end | 845 end |
| 839 end | 846 end |
| 840 end -- do-block | 847 end |
| 848 | |
| 849 -- do-block | |
| 841 | 850 |
| 842 | 851 |
| 843 local function RecordItemData(item_id, item_link, durability) | 852 local function RecordItemData(item_id, item_link, durability) |
| 844 local item_string = select(3, item_link:find("^|%x+|H(.+)|h%[.+%]")) | 853 local item_string = select(3, item_link:find("^|%x+|H(.+)|h%[.+%]")) |
| 845 local item | 854 local item |
| 846 | 855 |
| 847 if item_string then | 856 if item_string then |
| 848 local _, _, _, _, _, _, _, suffix_id, unique_id, _, _, upgrade_id = (":"):split(item_string) | 857 local _, _, _, _, _, _, _, suffix_id, unique_id, _, reforge_id, upgrade_id = (":"):split(item_string) |
| 849 suffix_id = tonumber(suffix_id) | 858 suffix_id = tonumber(suffix_id) |
| 850 upgrade_id = tonumber(upgrade_id) | 859 upgrade_id = tonumber(upgrade_id) |
| 851 | 860 |
| 852 if suffix_id and suffix_id ~= 0 then | 861 if suffix_id and suffix_id ~= 0 then |
| 853 item = DBEntry("items", item_id) | 862 item = DBEntry("items", item_id) |
| 854 item.suffix_id = suffix_id | 863 item.suffix_id = suffix_id |
| 855 item.unique_id = bit.band(unique_id, 0xFFFF) | 864 item.unique_id = bit.band(unique_id, 0xFFFF) |
| 856 end | 865 end |
| 857 | 866 |
| 858 if upgrade_id and upgrade_id ~= 0 then | 867 if upgrade_id and upgrade_id ~= 0 then |
| 859 ScrapeItemUpgradeStats(item_id, item_link, upgrade_id) | 868 DatamineTT:SetHyperlink(item_link) |
| 869 ScrapeItemUpgradeStats(item_id, upgrade_id, reforge_id) | |
| 860 end | 870 end |
| 861 end | 871 end |
| 862 | 872 |
| 863 if durability and durability > 0 then | 873 if durability and durability > 0 then |
| 864 item = item or DBEntry("items", item_id) | 874 item = item or DBEntry("items", item_id) |
