Mercurial > wow > askmrrobot
comparison Gear.lua @ 195:4ccc9ff6e824 v95
Update item parsing for new item link format changes.
author | Yellowfive |
---|---|
date | Tue, 24 Nov 2020 16:20:10 -0600 |
parents | 4aeedce4c995 |
children | 6e8838b231d4 |
comparison
equal
deleted
inserted
replaced
194:02bbbf5ef3db | 195:4ccc9ff6e824 |
---|---|
686 | 686 |
687 | 687 |
688 -- scan a bag for the best matching item | 688 -- scan a bag for the best matching item |
689 local function scanBagForItem(item, bagId, bestItem, bestDiff, bestLink) | 689 local function scanBagForItem(item, bagId, bestItem, bestDiff, bestLink) |
690 local numSlots = GetContainerNumSlots(bagId) | 690 local numSlots = GetContainerNumSlots(bagId) |
691 local loc = ItemLocation.CreateEmpty() | 691 --local loc = ItemLocation.CreateEmpty() |
692 local blizzItem | |
692 for slotId = 1, numSlots do | 693 for slotId = 1, numSlots do |
693 local _, _, _, _, _, _, itemLink = GetContainerItemInfo(bagId, slotId) | 694 local _, _, _, _, _, _, itemLink = GetContainerItemInfo(bagId, slotId) |
694 -- we skip any stackable item, as far as we know, there is no equippable gear that can be stacked | 695 -- we skip any stackable item, as far as we know, there is no equippable gear that can be stacked |
695 if itemLink then | 696 if itemLink then |
696 local bagItem = Amr.ParseItemLink(itemLink) | 697 local bagItem = Amr.ParseItemLink(itemLink) |
697 if bagItem ~= nil then | 698 if bagItem ~= nil then |
699 | |
700 blizzItem = Item:CreateFromBagAndSlot(bagId, slotId) | |
701 | |
702 -- seems to be of the form Item-1147-0-4000000XXXXXXXXX, so we take just the last 9 digits | |
703 bagItem.guid = blizzItem:GetItemGUID() | |
704 if bagItem.guid and strlen(bagItem.guid) > 9 then | |
705 bagItem.guid = strsub(bagItem.guid, -9) | |
706 end | |
707 | |
698 -- see if this is an azerite item and read azerite power ids | 708 -- see if this is an azerite item and read azerite power ids |
699 --[[loc:SetBagAndSlot(bagId, slotId) | 709 --[[loc:SetBagAndSlot(bagId, slotId) |
700 if C_AzeriteEmpoweredItem.IsAzeriteEmpoweredItem(loc) then | 710 if C_AzeriteEmpoweredItem.IsAzeriteEmpoweredItem(loc) then |
701 local powers = Amr.ReadAzeritePowers(loc) | 711 local powers = Amr.ReadAzeritePowers(loc) |
702 if powers then | 712 if powers then |
1138 end | 1148 end |
1139 else | 1149 else |
1140 | 1150 |
1141 -- find the best matching item anywhere in the player's gear | 1151 -- find the best matching item anywhere in the player's gear |
1142 local bestItem, bestDiff = Amr:FindMatchingItem(new, player, usedItems) | 1152 local bestItem, bestDiff = Amr:FindMatchingItem(new, player, usedItems) |
1153 | |
1143 new = bestItem | 1154 new = bestItem |
1144 | |
1145 local diff = countItemDifferences(new, old) | 1155 local diff = countItemDifferences(new, old) |
1146 | 1156 |
1147 if diff > 0 then | 1157 if diff > 0 then |
1148 list[slotId] = new | 1158 list[slotId] = new |
1149 if list == itemsToEquip.mh or list == itemsToEquip.oh then | 1159 if list == itemsToEquip.mh or list == itemsToEquip.oh then |
1150 itemsToEquip.weapons[slotId] = {} | 1160 itemsToEquip.weapons[slotId] = {} |
1151 end | 1161 end |
1152 remaining = remaining + 1 | 1162 remaining = remaining + 1 |