Bagnon

Bagnon

127M Downloads

Bagnon Conflict with DurabilityAndItemLevel addone 9.0.0

gaveer opened this issue ยท 6 comments

commented

Running Software (issues missing this information will be deleted):

  • Addon version: Bagnon-9.0.0-9.0.1
  • Server patch: Retail 8.3.7.35662

Have you read the changelog? (please don't waste our time)

  • [Mark]

Describe the bug
A clear and concise description of what the bug is.

  • in loading screen

To Reproduce
Steps to reproduce the behaviour:

  1. Enter Wolrd
  2. See error

Expected behaviour
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Error Logs

1x ...faceDurabilityAndItemLevel\ItemLevel_Bag.lua:86: Usage: hooksecurefunc([table,] "function", hookfunc)
[string "=[C]"]: in function `hooksecurefunc'
[string "@DurabilityAndItemLevel\ItemLevel_Bag.lua"]:86: in main chunk

Additional context
Add any other context about the problem here.

  • DurabilityAndItemLevel /ItemLevel_Bag. Lua
local DAI = select(2, ...)
--------------------------------------------------------------------------------
-- ItemLevel strings
-- fyhcslb
--------------------------------------------------------------------------------

local bagFontStrings = {}
DAI.bagFontStrings = bagFontStrings

local function GetButtonFontString(button)
	local name = button:GetName()
	if not bagFontStrings[name] then
		bagFontStrings[name] = button:CreateFontString(nil, "OVERLAY")
		bagFontStrings[name]:SetFont(unpack(DAI:GetFont()))
		bagFontStrings[name]:SetPoint(unpack(DurabilityAndItemLevel["bagPoint"]))
	end
	return bagFontStrings[name]
end

local function UpdateButton(button, bag, slot)
	if not DurabilityAndItemLevel["showInBags"] then return end

	local buttonFontString = GetButtonFontString(button)
	local itemLink = GetContainerItemLink(bag, slot)

	local s = ""
	if itemLink then  -- has item
		local iLevel

		-- itemID, itemType, itemSubType, itemEquipLoc, icon, itemClassID, itemSubClassID
		local _, _, _, itemEquipLoc, _, itemClassID = GetItemInfoInstant(itemLink)

		if itemEquipLoc and itemEquipLoc ~= "" then
			-- if not tContains({2, 4}, itemClassID) then
			-- 	buttonFontString:SetText("")
			-- 	return
			-- end 

			-- get ilvl
			if DAI.ALWAYS_USE_TOOLTIP then
				iLevel = DAI:GetItemLevelFromTooltip(slot, bag)
			else
				iLevel = select(4, GetItemInfo(itemLink))
			end

			if iLevel and iLevel >= DurabilityAndItemLevel["iThreshold"] then
				local checkEnchant = false
				if tContains({"INVTYPE_FINGER", "INVTYPE_HAND", "INVTYPE_WEAPON", "INVTYPE_2HWEAPON", "INVTYPE_WEAPONMAINHAND", "INVTYPE_WEAPONOFFHAND", "INVTYPE_RANGEDRIGHT"}, itemEquipLoc) then
					checkEnchant = true
				end
				
				s = DAI:GetItemInfo(itemLink, iLevel, checkEnchant)
			end
		end
	end
	buttonFontString:SetText(s)
end

function DAI:UpdateAllBags(show)
	if not show then
		for _, s in pairs(bagFontStrings) do
			s:SetText("")
		end
	end
end

-- blizzard bags
hooksecurefunc("ContainerFrame_Update", function(frame)
	for i = 1, frame.size do
		local itemButton  = _G[frame:GetName() .. "Item" .. i]
		if itemButton then
			UpdateButton(itemButton, frame:GetID(), itemButton:GetID())
		end
	end
end)

-- blizzard bank bags
hooksecurefunc("BankFrameItemButton_Update", function(button)
	if not button.isBag then
		UpdateButton(button, -1, button:GetID())
	end
end)

-- bagnon
if IsAddOnLoaded("Bagnon") then
	hooksecurefunc(Bagnon.ItemSlot, "Update", function(self)
		UpdateButton(self, self:GetBag(), self:GetID())
	end)
end
commented

Got same issue here :)

commented

This is DurabilityAndItemLevel authors problem, he made his addon explicitly work with Bagnon (look at the end of the code posted) so why are you reporting it here and not there?

commented

The conflict start with the New Bagnon update .

commented

Mods change. That addon is using a Bagnon API that was deprecated like 2 years ago.

commented

is there a way to fix it ?

commented

@Slayer741 addone Updated ( DurabilityAndItemLevel)
enderneko/DurabilityAndItemLevel@4aa7f3c
contact the author of the addone and he released update