Thaoky / Altoholic_Retail

WoW Altoholic Addon (WoW Retail version)
24 stars 5 forks source link

Altoholic v10.2.015 (retail): DataStore_Crafts/DataStore_Crafts_Retail.lua:265: attempt to index local 'profession' (a nil value) #19

Closed R-Adrian closed 4 months ago

R-Adrian commented 4 months ago

on a character that has Mining + Skinning as professions ... but in the Draenor Garrison has a Blacksmithing building.... (edit: these two do not matter) edit2: they do seem to matter though /edit2

open the Blacksmithing interface from the building crafting NPC and this happens:

1x DataStore_Crafts/DataStore_Crafts_Retail.lua:265: attempt to index local 'profession' (a nil value) [string "@DataStore_Crafts/DataStore_Crafts_Retail.lua"]:265: in function <DataStore_Crafts/DataStore_Crafts_Retail.lua:263> [string "@DataStore_Crafts/DataStore_Crafts_Retail.lua"]:317: in function <DataStore_Crafts/DataStore_Crafts_Retail.lua:302> [string "@DataStore_Crafts/DataStore_Crafts_Retail.lua"]:503: in function `callback' [string "@DataStore/Events/Addon.lua"]:16: in function <DataStore/Events/Addon.lua:12>

Locals: profession = nil professionIndex = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = "attempt to index local 'profession' (a nil value)" C_TradeSkillUI = { GetCraftingOperationInfo = defined =[C]:-1 IsRecipeSourceTypeFiltered = defined =[C]:-1 GetSalvagableItemIDs = defined =[C]:-1 DropPendingObliterateItemFromCursor = defined =[C]:-1 GetRecipeInfo = defined =[C]:-1 IsTradeSkillReady = defined =[C]:-1 GetRecipeItemNameFilter = defined =[C]:-1 SetRecipeItemNameFilter = defined =[C]:-1 SetInventorySlotFilter = defined =[C]:-1 GetRecipeLink = defined =[C]:-1 GetRecipeSchematic = defined =[C]:-1 GetOnlyShowSkillUpRecipes = defined =[C]:-1 GetAllRecipeIDs = defined =[C]:-1 SetOnlyShowSkillUpRecipes = defined =[C]:-1 StopRecipeRepeat = defined =[C]:-1 GetProfessionChildSkillLineID = defined =[C]:-1 IsRuneforging = defined =[C]:-1 ClearPendingObliterateItem = defined =[C]:-1 GetCategories = defined =[C]:-1 GetReagentDifficultyText = defined =[C]:-1 GetFactionSpecificOutputItem = defined =[C]:-1 GetSourceTypeFilter = defined =[C]:-1 HasFavoriteOrderRecipes = defined =[C]:-1 GetRecipeQualityItemIDs = defined =[C]:-1 IsRecipeRepeating = defined =[C]:-1 SetRecipeFavorite = defined =[C]:-1 GetOnlyShowFirstCraftRecipes = defined =[C]:-1 IsRecipeProfessionLearned = defined =[C]:-1 GetQualitiesForRecipe = defined =[C]:-1 GetAllProfessionTradeSkillLines = defined =[C]:-1 GetSubCategories = defined =[C]:-1 OpenRecipe = defined =[C]:-1 SetOnlyShowMakeableRecipes = defined =[C]:-1 IsNearProfessionSpellFocus = defined =[C]:-1 IsRecipeFavorite = defined =[C]:-1 IsRecraftItemEquipped = defined =[C]:-1 CanTradeSkillListLink = defined =[C]:-1 GetRecipeSourceText = defined =[C]:-1 IsEnchantTargetValid = defined =[C]:-1 GetProfessionSkillLineID = defined =[C]:-1 GetProfessionInfoByRecipeID = defined =[C]:-1 GetPendingObliterateItemLink = defined =[C]:-1 CloseTradeSkill = defined =[C]:-1 ClearInventorySlotFilter = defined =[C]:-1 SetRecipeCategoryFilter = defined =[C]:-1 CraftSalvage = defined =[C]:-1 GetCraftingTargetItems = defined =[C]:-1 GetEnchantItems = defined =[C]:-1 CanStoreEnchantInItem = defined =[C]:-1 GetRecipeRepeatCount = defined @Blizzard_Deprecated/Deprecated_10_0_0.lua:18 GetProfessionNameForSkillLineAbility = defined =[C]:-1 GetChildProfessionInfo = defined =[C]:-1 ObliterateItem = defined =[C]:-1 SetShowLearned = defined =[C]:-1 GetCategoryInfo = defined =[C]:-1 GetPendingObliterateItemID = defined =[C]:-1 GetOriginalCraftRecipeID = defined =[C]:-1 IsTradeSkillGuild = defined =[C]:-1 IsNPCCrafting = defined =[C]:-1 GetBaseProfessionInfo = defined =[C]:-1 IsOriginalCraftRecipeLearned = defined =[C]:-1 GetRecipeInfoForSkillLineAbility = defined =[C]:-1 GetHideUnownedFlags = defined =[C]:-1 SetShowUnlearned = defined =[C]:-1 GetGatheringOperationInfo = defined =[C]:-1 GetRecipeDescription = defined =[C]:-1 GetReagentSlotStatus = defined =[C]:-1 GetProfessionInventorySlots = defined
R-Adrian commented 4 months ago

the main professions do not seem to matter, on another character that has Alchemy + Herbalism as professions, in the Draenor Garrison i have an Alchemist crafter NPC and the same error happens when opening the crafting interface from the NPC:

3x DataStore_Crafts/DataStore_Crafts_Retail.lua:265: attempt to index local 'profession' (a nil value) [string "@DataStore_Crafts/DataStore_Crafts_Retail.lua"]:265: in function <DataStore_Crafts/DataStore_Crafts_Retail.lua:263> [string "@DataStore_Crafts/DataStore_Crafts_Retail.lua"]:317: in function <DataStore_Crafts/DataStore_Crafts_Retail.lua:302> [string "@DataStore_Crafts/DataStore_Crafts_Retail.lua"]:503: in function `callback' [string "@DataStore/Events/Addon.lua"]:16: in function <DataStore/Events/Addon.lua:12>

Locals: profession = nil professionIndex = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = "attempt to index local 'profession' (a nil value)" C_TradeSkillUI =
{ GetCraftingOperationInfo = defined =[C]:-1 IsRecipeSourceTypeFiltered = defined =[C]:-1 GetSalvagableItemIDs = defined =[C]:-1 DropPendingObliterateItemFromCursor = defined =[C]:-1 GetRecipeInfo = defined =[C]:-1 IsTradeSkillReady = defined =[C]:-1 GetRecipeItemNameFilter = defined =[C]:-1 SetRecipeItemNameFilter = defined =[C]:-1 SetInventorySlotFilter = defined =[C]:-1 GetRecipeLink = defined =[C]:-1 GetRecipeSchematic = defined =[C]:-1 GetOnlyShowSkillUpRecipes = defined =[C]:-1 GetAllRecipeIDs = defined =[C]:-1 SetOnlyShowSkillUpRecipes = defined =[C]:-1 StopRecipeRepeat = defined =[C]:-1 GetProfessionChildSkillLineID = defined =[C]:-1 IsRuneforging = defined =[C]:-1 ClearPendingObliterateItem = defined =[C]:-1 GetCategories = defined =[C]:-1 GetReagentDifficultyText = defined =[C]:-1 GetFactionSpecificOutputItem = defined =[C]:-1 GetSourceTypeFilter = defined =[C]:-1 HasFavoriteOrderRecipes = defined =[C]:-1 GetRecipeQualityItemIDs = defined =[C]:-1 IsRecipeRepeating = defined =[C]:-1 SetRecipeFavorite = defined =[C]:-1 GetOnlyShowFirstCraftRecipes = defined =[C]:-1 IsRecipeProfessionLearned = defined =[C]:-1 GetQualitiesForRecipe = defined =[C]:-1 GetAllProfessionTradeSkillLines = defined =[C]:-1 GetSubCategories = defined =[C]:-1 OpenRecipe = defined =[C]:-1 SetOnlyShowMakeableRecipes = defined =[C]:-1 IsNearProfessionSpellFocus = defined =[C]:-1 IsRecipeFavorite = defined =[C]:-1 IsRecraftItemEquipped = defined =[C]:-1 CanTradeSkillListLink = defined =[C]:-1 GetRecipeSourceText = defined =[C]:-1 IsEnchantTargetValid = defined =[C]:-1 GetProfessionSkillLineID = defined =[C]:-1 GetProfessionInfoByRecipeID = defined =[C]:-1 GetPendingObliterateItemLink = defined =[C]:-1 CloseTradeSkill = defined =[C]:-1 ClearInventorySlotFilter = defined =[C]:-1 SetRecipeCategoryFilter = defined =[C]:-1 CraftSalvage = defined =[C]:-1 GetCraftingTargetItems = defined =[C]:-1 GetEnchantItems = defined =[C]:-1 CanStoreEnchantInItem = defined =[C]:-1 GetRecipeRepeatCount = defined @Blizzard_Deprecated/Deprecated_10_0_0.lua:18 GetProfessionNameForSkillLineAbility = defined =[C]:-1 GetChildProfessionInfo = defined =[C]:-1 ObliterateItem = defined =[C]:-1 SetShowLearned = defined =[C]:-1 GetCategoryInfo = defined =[C]:-1 GetPendingObliterateItemID = defined =[C]:-1 GetOriginalCraftRecipeID = defined =[C]:-1 IsTradeSkillGuild = defined =[C]:-1 IsNPCCrafting = defined =[C]:-1 GetBaseProfessionInfo = defined =[C]:-1 IsOriginalCraftRecipeLearned = defined =[C]:-1 GetRecipeInfoForSkillLineAbility = defined =[C]:-1 GetHideUnownedFlags = defined =[C]:-1 SetShowUnlearned = defined =[C]:-1 GetGatheringOperationInfo = defined =[C]:-1 GetRecipeDescription = defined =[C]:-1 GetReagentSlotStatus = defined =[C]:-1 GetProfessionInventorySlots = defined
Thaoky commented 4 months ago

I'll check that.. I'll admit I did not check the WoD npc's ..

Thaoky commented 4 months ago

There's something weird here. I can't reproduce it, and based on your call stack and the locals, it should crash earlier. See, it says in the locals that "profession" and "professionIndex" are both nil, but if professionIndex was really nil, then it would have crashed at line 315.

May I ask you to add those two lines between 315 and 317 in DataStore_Crafts/DataStore_Crafts_Retail.lua, and tell me what you see ?

print("profession: " .. (profession or "nil")) print("professionIndex: " .. (professionIndex or "nil"))

The first line should print the address of the table (or crash if it is really nil), the second one its index.

R-Adrian commented 4 months ago

i think i know where i messed up my testing... i moved the buildings around... i have both engineering and alchemy buildings in the garrison and i thought i was in the alchemy one... but i am in Engineering. (on my Alchemist + Herbalist char)

image

furball13 commented 4 months ago

I got it to blow up on my miner/skinner, at the enchanting and blacksmithing buildings. (It also happened on my enchanter/herbalist at the blacksmithing building - enchanting doesn't offer the crafting UI, since he has that profession himself.)

At line 317 in DataStore_Crafts_Retail.lua I added: print("TradeskillName: " .. (tradeskillName or nil)) print("ProfessionIndex: " .. (professionIndex or nil)) print("Profession: " .. (profession or nil))

TradeskillName is what you'd expect (Enchanting, at that building). The error occurs on the next line (trying to print professionIndex):

DataStore_Crafts/DataStore_Crafts_Retail.lua:318: attempt to concatenate a nil value [string "@DataStore_Crafts/DataStore_Crafts_Retail.lua"]:318: in function <DataStore_Crafts/DataStore_Crafts_Retail.lua:302> [string "@DataStore_Crafts/DataStore_Crafts_Retail.lua"]:507: in function `callback' [string "@DataStore/Events/Addon.lua"]:16: in function <DataStore/Events/Addon.lua:12>

Locals: info =

{ skillLevel = 0 professionID = 333 sourceCounter = 3 isPrimaryProfession = true profession = 9 skillModifier = 0 professionName = "Enchanting" maxSkillLevel = 0 expansionName = "Unknown" } tradeskillName = "Enchanting" char =
{ Professions =
{ } lastUpdate = 1717354503 Indices =
{ } Ranks =
{ } } professionIndex = nil profession = nil

Thaoky commented 4 months ago

Hi, could you try changing lines 314-315 to this ? I think scanning the profession links is missed for some reason, this should fix it.

local professionIndex = char.Indices[tradeskillName]
if not professionIndex then
    ScanProfessionLinks()
    professionIndex = char.Indices[tradeskillName]
end
local profession = char.Professions[professionIndex]
furball13 commented 4 months ago

The problem is that the game is using the Tradeskill UI to "craft" things that aren't actually a known profession (Runeforging was the same issue, but that's checked for now). In the garrison, it's NPCs making things from existing professions, but the player hasn't learned those professions. I just checked, on a hunch, and I also get the same error at the Tuskarr Fishing Gear crafter in Iskaara.

C_TradeSkillUI.GetBaseProfessionInfo() returns skillLevel=0 for both places (Runeforging returns 1), so it might work to add another condition to line 311:

if not tradeskillName or tradeskillName == "UNKNOWN" or info.skillLevel == 0 or info.professionID == 960 then return end

I don't know if there is any time that would exclude a legitimate scan though.

Thaoky commented 4 months ago

I made a tentative fix in .017, just uploaded, please try with it and let me know :)

furball13 commented 4 months ago

Looks good for me. No more errors in garrison (tested blacksmith and enchanter buildings, on a miner/skinner character), or Iskaara. 👍

R-Adrian commented 4 months ago

looks good for me too - no more profession errors in garrison either when opening the NPC interface, so i think i can close this issue now, Thank You.

(i'm playing mostly Pandaria Remix these days and i avoided visiting Garrisons much)