TransmogTokens icon indicating copy to clipboard operation
TransmogTokens copied to clipboard

TransmogTokens-1.4.9.lua:509: attempt to call method 'GetSlotTransmogSources' (a nil value)

Open Ookami313 opened this issue 3 years ago • 3 comments

Unsure if this addon is still in development since it hasn't been updated since 8.0, but I'm posting this just in case.

Ran into an error today while I was going through my reagents bank. Upon mousing over a stack of Sunmotes I have for crafting TBC gear for transmog I received the following error. Thanks.

26x TransmogTokens\TransmogTokens-1.4.9.lua:509: attempt to call method 'GetSlotTransmogSources' (a nil value) [string "@TransmogTokens\TransmogTokens-1.4.9.lua"]:509: in function getSource' [string "@TransmogTokens\TransmogTokens-1.4.9.lua"]:518: in function getAppearanceID' [string "@TransmogTokens\TransmogTokens-1.4.9.lua"]:562: in function calculateNeededSingle' [string "@TransmogTokens\TransmogTokens-1.4.9.lua"]:549: in function calculateNeeded' [string "@TransmogTokens\TransmogTokens-1.4.9.lua"]:574: in function calculateNeededText' [string "@TransmogTokens\TransmogTokens-1.4.9.lua"]:621: in function processTooltip' [string "@TransmogTokens\TransmogTokens-1.4.9.lua"]:687: in function <TransmogTokens\TransmogTokens.lua:684> [string "=[C]"]: ? [string "=[C]"]: ? [string "=[C]"]: ? [string "=[C]"]: ? [string "@BetterWardrobe\Libs\AceHook-3.0\AceHook-3.0-9.lua"]:95: in function <...dOns\BetterWardrobe\Libs\AceHook-3.0\AceHook-3.0.lua:87> ... [string "=[C]"]: ? [string "=[C]"]: ? [string "=[C]"]: ? [string "=[C]"]: ? [string "@TradeSkillMaster\LibTSM\Service\ItemTooltipClasses\Wrapper.lua"]:107: in function <...Master\LibTSM\Service\ItemTooltipClasses\Wrapper.lua:105> [string "=[C]"]: ? [string "=[C]"]: ? [string "@Vendor\sys\hook.lua"]:95: in function <Vendor\sys\hook.lua:91> [string "=[C]"]: in function `SetInventoryItem' [string "@FrameXML\BankFrame.lua"]:49: in function <FrameXML\BankFrame.lua:46>

Locals: itemLink = "|cffa335ee|Hitem:34388::::::::60:251:::1:::::::|h[Pauldrons of Berserking]|h|r" itemID = 34388 _ = "Armor" _ = "Plate" slotName = "INVTYPE_SHOULDER" slots =

{ 1 = 3 } (for generator) = defined =[C]:-1 (for state) =
{ 1 = 3 } (for control) = 1 i = 1 slot = 3 (*temporary) = nil (*temporary) = { 0 = } (*temporary) = 3 (*temporary) = "attempt to call method 'GetSlotTransmogSources' (a nil value)" t =
{ AQ_LOOKUP =
{ } ARMOR_TYPE_MAIL = "MAIL" getSource = defined @TransmogTokens\TransmogTokens.lua:492 SET_INDEX =
{ } getItemID = defined @TransmogTokens\TransmogTokens.lua:484 AQ_ENTRIES =
{ } NOTES =
{ } getItemBonus = defined @TransmogTokens\TransmogTokens.lua:488 REDEEM_DATA =
{ } createTierWindow = defined @TransmogTokens\TransmogTokens.lua:167 getAppearanceID = defined @TransmogTokens\TransmogTokens.lua:517 calculateNeededText = defined @TransmogTokens\TransmogTokens.lua:573 ARMOR_TYPE_PLATE = "PLATE" CLASS_ITEM_TYPE =
{ } processTooltip = defined @TransmogTokens\TransmogTokens.lua:597 updateTierFrame = defined @TransmogTokens\TransmogTokens.lua:229 calculateNeededSingle = defined @TransmogTokens\TransmogTokens.lua:558 addItemInfo = defined @TransmogTokens\TransmogTokens.lua:647 hasApperance = defined @TransmogTokens\TransmogTokens.lua:525 REDEEM_LOOKUP =
{ } pushDataNode = defined @TransmogTokens\TransmogTokens.lua:395 SET_DATA =
{ } showTierWindow = defined @TransmogTokens\TransmogTokens.lua:159 L =
{ } SPEC_CLASS_TOKENS =
{ } ARMOR_TYPE_CLOTH = "CLOTH" ARMOR_TYPE_LEATHER = "LEATHER" SORTED_DATA =
{ } CLASS_REDEEM_LOOKUP =
{ } tooltipCache =
{ } calculateNeeded = defined @TransmogTokens\TransmogTokens.lua:539 sortRedeemData = defined @TransmogTokens\TransmogTokens.lua:468 sortData = defined @TransmogTokens\TransmogTokens.lua:402 INVENTORY_SLOTS =
{ } addDoubleTooltipLine = defined @TransmogTokens\TransmogTokens.lua:474 BONUS_LOOKUP =
{ } addTooltipLine = defined @TransmogTokens\TransmogTokens.lua:479 } model = { 0 = }

Ookami313 avatar Jul 08 '21 01:07 Ookami313

Might have a fix for this, but be warned that i have no idea if this actually fixes the problem or just takes away the error itself, breaks something else or will be broken in the future. Note that i also don't know LUA all that well, so it might not be the best way of writing this code.

To fix replace the code block from line 492 to 515 in TransmogTokens.lua with this code:

TransmogTokens.getSource = function(itemLink)
	if itemLink == nil then
		return;
	end

	local itemID, _, _, slotName = GetItemInfoInstant(itemLink);
	if t.INVENTORY_SLOTS == nil then
		local slots = slotName
	else
		local slots = t.INVENTORY_SLOTS[slotName];
	end

	if not slots or not IsDressableItem(itemLink) then
		return;
	end

	model:SetUnit("player");
	model:Undress();

	if type(slots) == "table" then
		for i, slot in pairs(slots) do
			model:TryOn(itemLink, slot);
			local source = model:GetSlotTransmogSources(slot);
		
			if source ~= 0 then
				return source;
			end
		end
	else
		model:TryOn(itemLink, Slots);
		local source = model:GetSlotTransmogSources(slots);
	
		if source ~= 0 then
			return source;
		end
	end
end

fatalicus avatar Jul 16 '21 14:07 fatalicus

https://github.com/Stanzilla/WoWUIBugs/wiki/9.1.0-Consolidated-UI-Changes

Removed: DressUpModel:GetSlotTransmogSources

dartraiden avatar Nov 17 '21 13:11 dartraiden

Updated fix. Replace the function TransmogTokens.getSource with the below:

TransmogTokens.getSource = function(itemLink)
	if itemLink == nil then
		return;
	end

    local source = select(2, C_TransmogCollection.GetItemInfo(itemLink))
    if source then
        return source
    end

    local itemID, _, _, slotName = GetItemInfoInstant(itemLink);
    local slots = t.INVENTORY_SLOTS[slotName];

    if not slots or not IsDressableItem(itemLink) then
    	return;
    end

    model:SetUnit("player");
    model:Undress();

	for i, slot in pairs(slots) do
    	model:TryOn(itemLink, slot);
		local info = model:GetItemTransmogInfo(slot);

		if info and info.appearanceID ~= nil and info.appearanceID ~= 0 then
			return info.appearanceID;
		end
	end
end

oppewala avatar Sep 22 '22 04:09 oppewala