From 44694ebe59dadc8e18235b474392924d9be07f36 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Tue, 6 Nov 2012 20:46:34 +0100 Subject: [PATCH] Avoid errors on first load due to early BAG_UPDATE updates --- Monomyth.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Monomyth.lua b/Monomyth.lua index 1bdee29..aa0239f 100644 --- a/Monomyth.lua +++ b/Monomyth.lua @@ -7,7 +7,7 @@ local modifier function Monomyth:Register(event, func, override) self:RegisterEvent(event) self[event] = function(...) - if((MonomythDB and MonomythDB.toggle or true) and (override or not modifier)) then + if(MonomythDB.toggle and (override or not modifier)) then func(...) end end @@ -256,9 +256,9 @@ local ignoredItems = { [29464] = true, -- Soothsayer's Runes } -Monomyth:Register('BAG_UPDATE', function(bag) +local function BagUpdate(bag) + if(not MonomythDB.items) then return end if(atBank or atMail or atMerchant) then return end - if(not (MonomythDB and MonomythDB.items or true)) then return end for slot = 1, GetContainerNumSlots(bag) do local _, id, active = GetContainerItemQuestInfo(bag, slot) @@ -266,6 +266,10 @@ Monomyth:Register('BAG_UPDATE', function(bag) UseContainerItem(bag, slot) end end +end + +Monomyth:Register('PLAYER_LOGIN', function() + Monomyth:Register('BAG_UPDATE', BagUpdate) end) local errors = { -- 1.7.9.5