View Single Post
07/27/19, 08:13 AM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by cOOLsp0T View Post
Hi Folks, its me again.

I have a problem with an Event Handler wrapped around my function. The function itself loots all items, checks if the user whished to loot that item and destroys all left overs. My problem is, that the Event wouldnt fire. I register it right before the loot actions starts and unregister it when the looting action ends.

Code:
function LootManager.Lootinit()
	if Config.GeneralSettings.ClearNodes == true then
		EVENT_MANAGER:RegisterForEvent(LootManager.Name, EVENT_INVENTORY_SINGLE_SLOT_UPDATE, function(...) LootManager.GarbageHandler(...) end)
		LootManager.Debugger(1)
	end
	LootMoney()
	local num = GetNumLootItems()
	for itemnumber = 1, num, 1 do	
		lootitem = LootManager.ItemFilter(itemnumber,nil,nil)
		LootManager.Debugger(0,num,itemnumber,lootitem)
		_,_,_,_,_,_,LootManager.isQuest,_ = GetLootItemInfo(itemnumber)
		if Config.GeneralSettings.Debug ~= true then
			if Config.GeneralSettings.ClearNodes == true then LootItemById(itemID) end
			if Config.GeneralSettings.ClearNodes == false and lootitem == true then LootItemById(itemID) end
		end
	end

	if Config.GeneralSettings.BlindLoot == true then EndLooting() end
	if Config.GeneralSettings.ClearNodes == true then
		EVENT_MANAGER:UnregisterForEvent(LootManager.Name, EVENT_INVENTORY_SINGLE_SLOT_UPDATE)
		LootManager.Debugger(2)
	end
end
It is worth taking a look to built-in SHARED_INVENTORY and it's callbacks.
https://www.esoui.com/downloads/info...ourcecode.html
  Reply With Quote