fixed charges and some other minor bugs

This commit is contained in:
Manuel Simon Hirsig
2015-09-26 01:14:17 +02:00
parent c4fb4be1c6
commit 0b06156f52
2 changed files with 25 additions and 4 deletions
+22 -2
View File
@@ -47,6 +47,14 @@ function find_empty_slot()
end
end
function find_charge_item_slot(name, charges)
for slot in item_slots(name) do
if item_charges(slot) == charges then
return slot
end
end
end
function locked(slot)
local _, _, locked = GetContainerItemInfo(slog.bag, slot.bag_slot)
return locked
@@ -89,6 +97,15 @@ function stack_size(slot)
return item_count or 0
end
function item_charges(slot)
Aux_Scan_ClearTooltip()
AuxScanTooltip:SetOwner(UIParent, "ANCHOR_NONE")
AuxScanTooltip:SetBagItem(slot.bag, slot.bag_slot)
AuxScanTooltip:Show()
local tooltip = Aux_Scan_ExtractTooltip()
return Aux_Scan_ItemCharges(tooltip)
end
function Aux.stack.onupdate()
if state and state.processing <= 0 then
local next_slot = state.other_slots()
@@ -137,7 +154,7 @@ end
function Aux.stack.stop()
if state then
local slot
if state.target_slot and stack_size(state.target_slot) == state.target_size then
if state.target_slot and (stack_size(state.target_slot) == state.target_size or item_charges(state.target_slot) == state.target_size) then
slot = state.target_slot
end
local callback = state.callback
@@ -169,7 +186,10 @@ function Aux.stack.start(name, size, callback)
processing = 0,
}
if not state.target_slot then
if not target_slot then
Aux.stack.stop()
elseif item_charges(target_slot) then
state.target_slot = find_charges_item(name, size)
Aux.stack.stop()
end
end