Fixed sometimes choosing invalid items to break

When the player had items where one was a substring of the other ("Whiptail" vs "Whiptail Stem", for example), the game client would sometimes pick the wrong one to break. In the Whiptail case, this meant the game could attempt to cast Mill on a Whiptail Stem if it appeared first in the player's bags, which doesn't work. All we can do with the target-item attribute is supply a name, so it's not really our fault that the game makes this decision, but we can work around it by using target-bag and target-slot instead of target-item where we can be explicit about what we're trying to break.
This commit is contained in:
Parnic
2016-09-22 13:33:42 -05:00
parent 619e0f7479
commit 6624d74b2a

View File

@ -803,15 +803,15 @@ function Breakables:FindBreakables(bag)
--or PickLockId)
btn:SetAttribute("spell", BreakableAbilityName)
if isLockedItem then
btn:SetAttribute("target-item")
--if isLockedItem then
--btn:SetAttribute("target-item")
btn:SetAttribute("target-bag", foundBreakables[i][IDX_BAG])
btn:SetAttribute("target-slot", foundBreakables[i][IDX_SLOT])
else
--[[else
btn:SetAttribute("target-item", foundBreakables[i][IDX_NAME])
btn:SetAttribute("target-bag")
btn:SetAttribute("target-slot")
end
end]]
if lbfGroup then
btn.icon:SetTexture(foundBreakables[i][IDX_TEXTURE])