diff --git a/Roomba.lua b/Roomba.lua
index a75a5b5..3f7905f 100644
--- a/Roomba.lua
+++ b/Roomba.lua
@@ -34,10 +34,6 @@ local function GetItemID(link)
return tonumber(string.match(string.match(link, "%d+:"), "%d+"))
end
-function Roomba:dmsg(msg)
- if settings.Debugging then d(msg) end
-end
-
local function GetInstanceId(target, slotId)
for i,v in ipairs(target) do
if v.data.slotIndex == slotId then return v.data.itemInstanceId end
@@ -106,8 +102,7 @@ function Roomba:RoombaReady()
self.guildInfo[selectedBankId] = ClearGuildDetails(selectedBankId)
local bank = self.guildInfo[selectedBankId]
- self:dmsg("Bank is ready")
- -- We only need to store A) slots with items
+ -- We only need to store A) slots with items
for index, slot in ipairs(GUILDBANK) do
if slot.data.equipType == 0 then -- Equipped gear cannot be stacked
local id = slot.data.itemInstanceId
@@ -131,6 +126,7 @@ function Roomba:RoombaReady()
KEYBIND_STRIP:UpdateKeybindButtonGroup(self.runDescriptor)
end
currentRun = {}
+ self.control:SetHidden(true)
end
--[[
@@ -172,15 +168,12 @@ function Roomba:ReturnItemsToBank(...)
local error = ...
local slot
-- Now that we've stacked it all lets move it back
- self:dmsg("Getting next to move back to bank")
currentReturnIndex, slot = next(inBagCollection)
if slot then
if error then
- self:dmsg("trying again")
return zo_callLater(function(...) self:ReturnItemsToBank() end, 2000)
end
if FindSlot(BACKPACK, slot.bagSlot) then
- self:dmsg("Moving stuff back from ".. slot.bagSlot)
self.text:SetText("Returning restacked " .. cSlot.name .. " to the Guild Bank")
return TransferToGuildBank(INVENTORY_BACKPACK, slot.bagSlot)
else
@@ -190,11 +183,9 @@ function Roomba:ReturnItemsToBank(...)
end
else
-- No more to move, we're complete
- self:dmsg("unregistering")
EVENT_MANAGER:UnregisterForEvent("RoombaGuildBankError", EVENT_GUILD_BANK_TRANSFER_ERROR)
EVENT_MANAGER:UnregisterForEvent("RoombaGuildBankSuccess", EVENT_GUILD_BANK_ITEM_ADDED)
-- Kick off the next transaction
- self:dmsg("Finished processing item")
ResetAll()
return zo_callLater(function() self:BeginProcess() end, DELAY)
end
@@ -204,24 +195,20 @@ function Roomba:BankItemsReceived(...)
local eventId, gslot = ...
local id = GetInstanceId(GUILDBANK, gslot)
if id ~= cInstanceId then return end
- self:dmsg("Moved successfully to slot " ..gslot)
-- We've moved one back! Remove it from contention
local slot = table.remove(inBagCollection, currentReturnIndex)
currentReturnIndex = nil
- self:dmsg("Clearing slot " .. slot.bagSlot)
return zo_callLater(function(...) self:ReturnItemsToBank() end, DELAY)
end
function Roomba:StartStacking()
- self:dmsg("Found an item to stack")
baseSlot = nil
EVENT_MANAGER:UnregisterForEvent("RoombaInventoryAdded", EVENT_INVENTORY_SINGLE_SLOT_UPDATE)
self.text:SetText("Stacking " .. cSlot.name .. " in inventory")
for _,slot in pairs(inBagCollection) do
if not baseSlot then
-- We want to stack everything on this
- self:dmsg("Setting ".. slot.bagSlot .." as base slot")
baseSlot = slot
else
baseSlot.count, baseSlot.stack = GetSlotStackSize(INVENTORY_BACKPACK, slot.bagSlot)
@@ -238,7 +225,6 @@ function Roomba:StartStacking()
if (result) then result = CallSecureProtected("PlaceInInventory", INVENTORY_BACKPACK, baseSlot.bagSlot) end
end
ClearCursor()
- self:dmsg("Stacked item in backpack")
end
end
baseSlot = nil
@@ -261,7 +247,6 @@ function Roomba:ReceiveItems(...)
end
if not GetInstanceId(BACKPACK, slotId) then return end -- are we empty
if GetInstanceId(BACKPACK, slotId) ~= cInstanceId then return end
- self:dmsg("Checking " .. bagId .. " inventory slot " .. slotId .. " to match ".. cInstanceId .. " with " .. (GetInstanceId(BACKPACK, slotId) or "nothing"))
cSlot.bagSlot = slotId
table.insert(inBagCollection, cSlot)
-- If we have another slot to move
@@ -276,7 +261,6 @@ end
function Roomba:BeginProcess()
local bank = self.guildInfo[self.currentBank]
if not bank then return end
- self:dmsg("Checking for space")
if not self:CheckWeHaveEnoughRoom() then return end
cSlotIdx = nil
@@ -291,7 +275,6 @@ function Roomba:BeginProcess()
local total = TableEntryCount(bank.duplicates)
ZO_StatusBar_SmoothTransition(self.speedRow.bar, index , total, FORCE_VALUE)
self.speedRow.name:SetText(string.format(format, (index/total)*100) .. "%")
-
if cDuplicateList then -- First off the rank
cSlotIdx, cSlot = next(cDuplicateList, cSlotIdx)
@@ -301,7 +284,6 @@ function Roomba:BeginProcess()
-- Clear this batch
inBagCollection = {}
-- And start off the job
- self:dmsg("Stacking up ".. zo_strformat(SI_TOOLTIP_ITEM_NAME, GetItemLink(3, cSlot.slot, LINK_STYLE_DEFAULT)))
-- If it suddenly doesn't exist, try the next in the list
if not FindSlot(GUILDBANK, cSlot.slot) then return zo_callLater(function() self:BeginProcess() end, DELAY) end
@@ -310,7 +292,6 @@ function Roomba:BeginProcess()
self.text:SetText("Retrieving " .. cSlot.name .. " from Guild Bank")
TransferFromGuildBank(cSlot.slot)
else
- self:dmsg("Nothing to restack")
-- Now rescan and show/hide roomba button
self.control:SetHidden(true)
self.text:SetText("Complete")
@@ -326,15 +307,9 @@ local function RoombaLoaded(eventCode, addOnName)
return
end
- local defaults = {
- Debugging = true
- }
-
ZO_CreateStringId("SI_BINDING_NAME_RUN_ROOMBA", "Run Roomba")
ZO_CreateStringId("SI_BINDING_NAME_RESCAN_ROOMBA", "Rescan Bank")
- settings = ZO_SavedVars:New("Roomba_Settings", 3, nil, defaults)
- SLASH_COMMANDS["/roombadebug"] = function() settings.Debugging = not settings.Debugging d("Turning debug ".. (settings.Debugging and "on" or "off")) end
-
+ SLASH_COMMANDS["/roombadebug"] = function() settings.Debugging = not settings.Debugging d("Turning debug ".. (settings.Debugging and "on" or "off")) end
end
function Roomba:InitialiseSettings()
@@ -387,6 +362,7 @@ function Roomba:InitaliseEvents()
end
function Roomba:InitialiseFrame()
+ self.control:SetDrawLayer(DL_OVERLAY)
self.speedRow = self.control:GetNamedChild("SpeedRow")
self.speedRow.name:SetText(" 0%")
self.icon = self.control:GetNamedChild("Icon")
diff --git a/Roomba.txt b/Roomba.txt
index 823d32a..6c71922 100644
--- a/Roomba.txt
+++ b/Roomba.txt
@@ -2,7 +2,6 @@
## Author: Wobin
## Version: @project-version@
## APIVersion: 100003
-## SavedVariables: Roomba_Settings
libs/LibStub/LibStub.lua
libs/LibAddonMenu-1.0/LibAddonMenu-1.0.lua
diff --git a/Roomba.xml b/Roomba.xml
index 3e13c71..053513e 100644
--- a/Roomba.xml
+++ b/Roomba.xml
@@ -1,10 +1,10 @@
<GuiXml>
<Controls>
- <TopLevelControl name="RoombaWindow" hidden="true" mouseEnabled="true" drawLayer="DL_OVERLAY">
+ <TopLevelControl name="RoombaWindow" hidden="true" mouseEnabled="true">
<Dimensions x="565" />
<Anchor point="TOPLEFT" relativeTo="ZO_SharedRightPanelBackground" offsetY="90" />
<Anchor point="BOTTOMLEFT" relativeTo="ZO_SharedRightPanelBackground" offsetY="-20" />
- <OnInitialized>
+ <OnInitialized>
Roomba_Initialise(self)
</OnInitialized>
<Controls>