mirror of
https://github.com/parnic/breakables.git
synced 2025-06-17 01:41:51 -05:00
Improve picked lockbox ui update reliability
This commit is contained in:
@ -243,6 +243,7 @@ local BREAKABLE_PICK = 4
|
|||||||
local BREAKABLE_COMBINE = 5
|
local BREAKABLE_COMBINE = 5
|
||||||
|
|
||||||
local BagUpdateCheckDelay = 0.1
|
local BagUpdateCheckDelay = 0.1
|
||||||
|
local PickLockFinishedDelay = 1
|
||||||
local nextCheck = {}
|
local nextCheck = {}
|
||||||
for i=0,NUM_BAG_SLOTS do
|
for i=0,NUM_BAG_SLOTS do
|
||||||
nextCheck[i] = -1
|
nextCheck[i] = -1
|
||||||
@ -261,6 +262,10 @@ local showingTooltip = nil
|
|||||||
|
|
||||||
Breakables.optionsFrame = {}
|
Breakables.optionsFrame = {}
|
||||||
Breakables.justClicked = false
|
Breakables.justClicked = false
|
||||||
|
Breakables.justClickedBag = -1
|
||||||
|
Breakables.justClickedSlot = -1
|
||||||
|
Breakables.justPickedBag = -1
|
||||||
|
Breakables.justPickedSlot = -1
|
||||||
|
|
||||||
function Breakables:OnInitialize()
|
function Breakables:OnInitialize()
|
||||||
self.defaults = {
|
self.defaults = {
|
||||||
@ -417,7 +422,7 @@ function Breakables:RegisterEvents()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if CanPickLock then
|
if CanPickLock then
|
||||||
self:RegisterEvent("CHAT_MSG_OPENING", "OnBagItemLockPicked")
|
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED", "OnSpellCastSucceeded")
|
||||||
end
|
end
|
||||||
|
|
||||||
if UnitCanPetBattle then
|
if UnitCanPetBattle then
|
||||||
@ -488,8 +493,16 @@ function Breakables:OnTradeSkillUpdate()
|
|||||||
self:FindBreakables()
|
self:FindBreakables()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Breakables:OnBagItemLockPicked()
|
function Breakables:OnSpellCastSucceeded(evt, unit, guid, spell)
|
||||||
|
if spell ~= PickLockId then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
self.justPickedBag = self.justClickedBag
|
||||||
|
self.justPickedSlot = self.justClickedSlot
|
||||||
|
|
||||||
self:FindBreakables()
|
self:FindBreakables()
|
||||||
|
nextCheck[0] = GetTime() + PickLockFinishedDelay
|
||||||
end
|
end
|
||||||
|
|
||||||
function Breakables:PetBattleStarted()
|
function Breakables:PetBattleStarted()
|
||||||
@ -1212,6 +1225,9 @@ function Breakables:OnLeaveBreakableButton()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Breakables:PostClickedBreakableButton(this)
|
function Breakables:PostClickedBreakableButton(this)
|
||||||
|
self.justClickedBag = this.bag
|
||||||
|
self.justClickedSlot = this.slot
|
||||||
|
|
||||||
if this.type == BREAKABLE_HERB or this.type == BREAKABLE_ORE or this.type == BREAKABLE_DE or this.type == BREAKABLE_COMBINE then
|
if this.type == BREAKABLE_HERB or this.type == BREAKABLE_ORE or this.type == BREAKABLE_DE or this.type == BREAKABLE_COMBINE then
|
||||||
self.justClicked = true
|
self.justClicked = true
|
||||||
end
|
end
|
||||||
@ -1225,12 +1241,17 @@ function Breakables:FindBreakablesInBag(bagId)
|
|||||||
for slotId=1,GetContainerNumSlots(bagId) do
|
for slotId=1,GetContainerNumSlots(bagId) do
|
||||||
local found = self:FindBreakablesInSlot(bagId, slotId)
|
local found = self:FindBreakablesInSlot(bagId, slotId)
|
||||||
if found then
|
if found then
|
||||||
local addedToExisting = self:MergeBreakables(found, foundBreakables)
|
if bagId ~= self.justPickedBag or slotId ~= self.justPickedSlot then
|
||||||
|
local addedToExisting = self:MergeBreakables(found, foundBreakables)
|
||||||
|
|
||||||
if not addedToExisting then
|
if not addedToExisting then
|
||||||
foundBreakables[i] = found
|
foundBreakables[i] = found
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
elseif bagId == self.justPickedBag and slotId == self.justPickedSlot then
|
||||||
|
self.justPickedBag = -1
|
||||||
|
self.justPickedSlot = -1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
v1.8.7:
|
||||||
|
|
||||||
|
- Improve reliability of UI updates after picking lockboxes. There's no good game event for "locked item opened", so this uses some best-guess heuristics to make it function as expected in most cases.
|
||||||
|
|
||||||
v1.8.6:
|
v1.8.6:
|
||||||
|
|
||||||
- Improve enchanting level detection for Wrath Classic
|
- Improve enchanting level detection for Wrath Classic
|
||||||
|
Reference in New Issue
Block a user