From 6910bc2848919eca790b36cf914304f5aabb28e5 Mon Sep 17 00:00:00 2001 From: Anch Date: Wed, 3 Aug 2022 16:40:17 +1200 Subject: [PATCH] fixed pattern selection not working --- AtlasLoot/Core/AtlasDifficulty.lua | 2 +- AtlasLoot/Core/AtlasLoot.lua | 146 ++---------------- AtlasLoot/Core/WishList.lua | 6 +- .../DefaultFrame/AtlaslootDefaultFrame.lua | 7 +- AtlasLoot_Crafting/craftingTBC.lua | 20 +-- 5 files changed, 26 insertions(+), 155 deletions(-) diff --git a/AtlasLoot/Core/AtlasDifficulty.lua b/AtlasLoot/Core/AtlasDifficulty.lua index 963510a..265b55b 100644 --- a/AtlasLoot/Core/AtlasDifficulty.lua +++ b/AtlasLoot/Core/AtlasDifficulty.lua @@ -73,7 +73,7 @@ AtlasLoot_Difficulty = { }; ["Crafting"] = { - {"Crafting Patterns", "" }, + {"Crafting Patterns", "Pattern" }, {"Item Normal", 2 }, {"Bloodforged", 1 }, }; diff --git a/AtlasLoot/Core/AtlasLoot.lua b/AtlasLoot/Core/AtlasLoot.lua index d61bcaf..f387bfc 100644 --- a/AtlasLoot/Core/AtlasLoot.lua +++ b/AtlasLoot/Core/AtlasLoot.lua @@ -15,7 +15,6 @@ AtlasLootBoss_OnClick() AtlasLoot_ShowItemsFrame() AtlasLoot_GenerateAtlasMenu(dataID, pFrame) AtlasLoot_SetItemInfoFrame() -AtlasLootItemsFrame_OnCloseButton() AtlasLootMenuItem_OnClick() AtlasLoot_NavButton_OnClick() AtlasLoot_IsLootTableAvailable(dataID) @@ -54,7 +53,6 @@ ATLASLOOT_INDENT = " "; AtlasLoot_Dewdrop = AceLibrary("Dewdrop-2.0"); AtlasLoot_DewdropSubMenu = AceLibrary("Dewdrop-2.0"); AtlasLoot_DewdropExpansionMenu = AceLibrary("Dewdrop-2.0"); -AtlasLoot_DifficultyAtlas = AceLibrary("Dewdrop-2.0"); --Variable to cap debug spam ATLASLOOT_DEBUGSHOWN = false; ATLASLOOT_FILTER_ENABLE = false; @@ -68,26 +66,7 @@ local PURPLE = "|cff9F3FFF"; local BLUE = "|cff0070dd"; local ORANGE = "|cffFF8400"; ---Establish number of boss lines in the Atlas frame for scrolling -local ATLAS_LOOT_BOSS_LINES = 25; - ---Flag so that error messages do not spam -local ATLASLOOT_POPUPSHOWN = false; - ---Set constants for expansions -local ATLAS_EXPANSION = {"CLASSIC", "TBC", "WRATH"}; - ---Set the default anchor for the loot frame to the Atlas frame -AtlasLoot_AnchorFrame = AtlasFrame; - ---Variables to hold hooked Atlas functions -Hooked_Atlas_Refresh = nil; -Hooked_Atlas_OnShow = nil; -Hooked_AtlasScrollBar_Update = nil; - -isTablereference = false; notPattern = false; -Updated_dataID = ""; --Search panel open and close save variables --dataID, dataSource, boss, pFrame, tablenumber @@ -154,18 +133,6 @@ StaticPopupDialogs["ATLASLOOT_SETUP"] = { hideOnEscape = 1 }; ---Popup Box for an old version of Atlas -StaticPopupDialogs["ATLASLOOT_OLD_ATLAS"] = { - text = AL["It has been detected that your version of Atlas does not match the version that Atlasloot is tuned for ("]..ATLASLOOT_CURRENT_ATLAS[1].."/"..ATLASLOOT_PREVIEW_ATLAS[1]..AL["). Depending on changes, there may be the occasional error, so please visit http://www.atlasmod.com as soon as possible to update."], - button1 = AL["OK"], - OnAccept = function() - DEFAULT_CHAT_FRAME:AddMessage(BLUE..AL["AtlasLoot"]..": "..RED..AL["Incompatible Atlas Detected"]); - end, - timeout = 0, - whileDead = 1, - hideOnEscape = 1 -}; - --[[ AtlasLoot_OnEvent(event): event - Name of the event, passed from the API @@ -213,38 +180,12 @@ function AtlasLoot_OnVariablesLoaded() {Name = AL["Select a Loot Table..."]}; }; end - --Figure out if it is a compatible Atlas version - for i=1,#ATLASLOOT_CURRENT_ATLAS do - if ATLAS_VERSION == ATLASLOOT_CURRENT_ATLAS[i] then - AtlasCheck = true; - AtlasLoot.db.profile.AtlasType = "Release"; - end - end - for i=1,#ATLASLOOT_PREVIEW_ATLAS do - if ATLAS_VERSION == ATLASLOOT_PREVIEW_ATLAS[i] then - AtlasCheck = true; - AtlasLoot.db.profile.AtlasType = "Preview"; - end - end - if AtlasCheck == false then - AtlasLoot.db.profile.AtlasType = "Unknown"; - end + --Add the loot browser to the special frames tables to enable closing wih the ESC key tinsert(UISpecialFrames, "AtlasLootDefaultFrame"); --Set up options frame AtlasLootOptions_OnLoad(); AtlasLoot_CreateOptionsInfoTooltips(); - --Hook the necessary Atlas functions - Hooked_Atlas_Refresh = Atlas_Refresh; - Atlas_Refresh = AtlasLoot_Refresh; - Hooked_Atlas_OnShow = Atlas_OnShow; - Atlas_OnShow = AtlasLoot_Atlas_OnShow; - --Instead of hooking, replace the scrollbar driver function - Hooked_AtlasScrollBar_Update = AtlasScrollBar_Update; - AtlasScrollBar_Update = AtlasLoot_AtlasScrollBar_Update; - if( not AtlasLoot.db.profile.LootBrowserStyle ) then - AtlasLoot.db.profile.LootBrowserStyle = 1; - end --Set visual style for the loot browser if( not AtlasLoot.db.profile.CraftingLink ) then AtlasLoot.db.profile.CraftingLink = 1; @@ -269,28 +210,9 @@ function AtlasLoot_OnVariablesLoaded() else AtlasLootItemsFrame_Back:SetTexture(0, 0, 0, 0.65); end - --If Atlas is installed, set up for Atlas - if ( Hooked_Atlas_Refresh ) then - --If a first time user, set up options - if( (AtlasLoot.db.profile.AtlasLootVersion == nil) or (tonumber(AtlasLoot.db.profile.AtlasLootVersion) < 40500)) then - AtlasLoot.db.profile.SafeLinks = true; - AtlasLoot.db.profile.AllLinks = false; - AtlasLoot.db.profile.AtlasLootVersion = VERSION_MAJOR..VERSION_MINOR..VERSION_BOSSES; - StaticPopup_Show ("ATLASLOOT_SETUP"); - end - --If not the expected Atlas version, nag the user once - if( AtlasLoot.db.profile.AtlasType == "Unknown" and AtlasLoot.db.profile.AtlasNaggedVersion ~= ATLAS_VERSION ) then - StaticPopup_Show ("ATLASLOOT_OLD_ATLAS"); - AtlasLoot.db.profile.AtlasNaggedVersion = ATLAS_VERSION; - end - if AtlasLoot.db.profile.AtlasType == "Preview" then - AtlasLootBossButtons = AtlasLootNewBossButtons; - end - Hooked_Atlas_Refresh(); - else - --If we are not using Atlas, keep the items frame out of the way - AtlasLootItemsFrame:Hide(); - end + + AtlasLootItemsFrame:Hide(); + --Check and migrate old WishList entry format to the newer one if(((AtlasLootCharDB.AtlasLootVersion == nil) or (tonumber(AtlasLootCharDB.AtlasLootVersion) < 40301)) and AtlasLootCharDB and AtlasLootCharDB["WishList"] and #AtlasLootCharDB["WishList"]~=0) then --Check if we really need to do a migration since it will load all modules @@ -617,6 +539,7 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) IDfound = AL_FindId(dataSource[dataID][tablenum][i][2], ItemindexID) or dataSource[dataID][tablenum][i][2]; if string.sub(IDfound, 1, 1) == "s" then isItem = false; + IDfound = AL_FindId(dataSource[dataID][tablenum][i][2], ItemindexID) or dataSource[dataID][tablenum][i][2]; else isItem = true; end @@ -722,11 +645,9 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) extraFrame:SetText(extra); extraFrame:Show(); --For convenience, we store information about the objects in the objects so that it can be easily accessed later - if((string.sub(IDfound, 1, 1) == "s") and (AtlasLoot.db.profile.CraftingLink ~= 1) and (tonumber(dataSource[dataID][tablenum][i][3]))) then - itemButton.itemID = dataSource[dataID][tablenum][i][3]; - itemButton.spellitemID = dataSource[dataID][tablenum][i][3]; - elseif ((string.sub(IDfound, 1, 1) == "s") and notPattern == true and (tonumber(dataSource[dataID][tablenum][i][3]))) then - itemButton.itemID = dataSource[dataID][tablenum][i][3]; + if((string.sub(IDfound, 1, 1) == "s") and (ItemindexID ~= "Pattern") and (tonumber(dataSource[dataID][tablenum][i][3]))) then + IDfound = AL_FindId(tonumber(dataSource[dataID][tablenum][i][3]), ItemindexID) or tonumber(dataSource[dataID][tablenum][i][3]); + itemButton.itemID = IDfound; itemButton.spellitemID = dataSource[dataID][tablenum][i][3]; else itemButton.itemID = IDfound; @@ -745,10 +666,10 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) itemButton.storeID = IDfound; itemButton.dressingroomID = IDfound; else - itemButton.iteminfo.idcore = dataSource[dataID][tablenum][i][3]; - itemButton.iteminfo.icontexture = GetItemIcon(dataSource[dataID][tablenum][i][3]); - itemButton.storeID = dataSource[dataID][tablenum][i][3]; - itemButton.dressingroomID = dataSource[dataID][tablenum][i][3]; + itemButton.iteminfo.idcore = IDfound; + itemButton.iteminfo.icontexture = GetItemIcon(IDfound); + itemButton.storeID = IDfound; + itemButton.dressingroomID = IDfound; end if dataSource[dataID][tablenum][i][5] then itemButton.desc = dataSource[dataID][tablenum][i][5]; @@ -861,22 +782,11 @@ If no pFrame is specified, the Atlas Frame is used if Atlas is installed. ]] function AtlasLoot_SetItemInfoFrame(pFrame) if ( pFrame ) then - --If a pFrame is specified, use it - if(pFrame==AtlasFrame and AtlasFrame) then - AtlasLootItemsFrame:ClearAllPoints(); - AtlasLootItemsFrame:SetParent(AtlasFrame); - AtlasLootItemsFrame:SetPoint("TOPLEFT", "AtlasFrame", "TOPLEFT", 18, -84); - else - AtlasLootItemsFrame:ClearAllPoints(); - AtlasLootItemsFrame:SetParent(pFrame[2]); - AtlasLootItemsFrame:ClearAllPoints(); - AtlasLootItemsFrame:SetPoint(pFrame[1], pFrame[2], pFrame[3], pFrame[4], pFrame[5]); - end - elseif ( AtlasFrame ) then - --If no pFrame is specified and Atlas is installed, anchor in Atlas + --Load pFrame AtlasLootItemsFrame:ClearAllPoints(); - AtlasLootItemsFrame:SetParent(AtlasFrame); - AtlasLootItemsFrame:SetPoint("TOPLEFT", "AtlasFrame", "TOPLEFT", 18, -84); + AtlasLootItemsFrame:SetParent(pFrame[2]); + AtlasLootItemsFrame:ClearAllPoints(); + AtlasLootItemsFrame:SetPoint(pFrame[1], pFrame[2], pFrame[3], pFrame[4], pFrame[5]); else --Last resort, dump the items frame in the middle of the screen AtlasLootItemsFrame:ClearAllPoints(); @@ -886,28 +796,6 @@ function AtlasLoot_SetItemInfoFrame(pFrame) AtlasLootItemsFrame:Show(); end ---[[ -AtlasLootItemsFrame_OnCloseButton: -Called when the close button on the item frame is clicked -]] -function AtlasLootItemsFrame_OnCloseButton() - --Set no loot table as currently selected - AtlasLootItemsFrame.activeBoss = nil; - --Fix the boss buttons so the correct icons are displayed - if AtlasFrame and AtlasFrame:IsVisible() then - if ATLAS_CUR_LINES then - for i=1,ATLAS_CUR_LINES do - if getglobal("AtlasBossLine"..i.."_Selected"):IsVisible() then - getglobal("AtlasBossLine"..i.."_Selected"):Hide(); - getglobal("AtlasBossLine"..i.."_Loot"):Show(); - end - end - end - end - --Hide the item frame - AtlasLootItemsFrame:Hide(); -end - --[[ AtlasLoot_NavButton_OnClick: Called when <-, -> are pressed and calls up the appropriate loot page @@ -1118,7 +1006,7 @@ Querys all valid items on the current loot page. function AtlasLoot_QueryLootPage() for i = 1, 30, 1 do button = getglobal("AtlasLootItem_"..i); - queryitem = button.itemID; + local queryitem = button.itemID; if (queryitem) and (queryitem ~= nil) and (queryitem ~= "") and (queryitem ~= 0) and (string.sub(queryitem, 1, 1) ~= "s") then local item = Item:CreateFromID(queryitem); item:ContinueOnLoad(function(itemId) diff --git a/AtlasLoot/Core/WishList.lua b/AtlasLoot/Core/WishList.lua index b8b4f1d..f69f279 100644 --- a/AtlasLoot/Core/WishList.lua +++ b/AtlasLoot/Core/WishList.lua @@ -139,7 +139,7 @@ function AtlasLoot_WishListAddDropClick(typ, arg2, arg3, arg4) table.insert(AtlasLootWishList["Own"][playerName][arg2], { 0, itemID, itemTexture, itemName, lootPage, "", "", sourcePage}); DEFAULT_CHAT_FRAME:AddMessage(RED..AL["AtlasLoot"]..": "..AtlasLoot_FixText(itemName)..GREY..AL[" added to the WishList."]..WHITE.." ("..AtlasLootWishList["Own"][playerName][arg2]["info"][1]..")"); - AtlasLoot_WishList = AtlasLoot_CategorizeWishList(AtlasLootWishList["Own"][playerName][arg2]); + AtlasLoot_WishList = AtlasLootWishList["Own"][playerName][arg2]; AtlasLoot_WishListDrop:Close(1) elseif typ == "addOther" then @@ -151,7 +151,7 @@ function AtlasLoot_WishListAddDropClick(typ, arg2, arg3, arg4) table.insert(AtlasLootWishList["Own"][arg2][arg3], { 0, itemID, itemTexture, itemName, lootPage, "", "", sourcePage, [AtlasLoot_Difficulty.DIF_SEARCH] = difficulty}); DEFAULT_CHAT_FRAME:AddMessage(RED..AL["AtlasLoot"]..": "..AtlasLoot_FixText(itemName)..GREY..AL[" added to the WishList."]..WHITE.." ("..AtlasLootWishList["Own"][arg2][arg3]["info"][1].." - "..arg2..")"); - AtlasLoot_WishList = AtlasLoot_CategorizeWishList(AtlasLootWishList["Own"][arg2][arg3]); + AtlasLoot_WishList = AtlasLootWishList["Own"][arg2][arg3]; AtlasLoot_WishListDrop:Close(1) elseif typ == "addShared" then @@ -163,7 +163,7 @@ function AtlasLoot_WishListAddDropClick(typ, arg2, arg3, arg4) table.insert(AtlasLootWishList["Shared"][arg2][arg3], { 0, itemID, itemTexture, itemName, lootPage, "", "", sourcePage, [AtlasLoot_Difficulty.DIF_SEARCH] = difficulty}); DEFAULT_CHAT_FRAME:AddMessage(RED..AL["AtlasLoot"]..": "..AtlasLoot_FixText(itemName)..GREY..AL[" added to the WishList."]..WHITE.." ("..AtlasLootWishList["Shared"][arg2][arg3]["info"][1].." - "..arg2..")"); - AtlasLoot_WishList = AtlasLoot_CategorizeWishList(AtlasLootWishList["Shared"][arg2][arg3]); + AtlasLoot_WishList = AtlasLootWishList["Shared"][arg2][arg3]; AtlasLoot_WishListDrop:Close(1) end diff --git a/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame.lua b/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame.lua index 2d51935..5dac144 100644 --- a/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame.lua +++ b/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame.lua @@ -108,11 +108,12 @@ function AtlasLoot_DewDropSubMenuClick(tablename) --Show the select loot table local tablenum = AtlasLoot_Data[tablename].Loadfirst or 1; ItemindexID = ItemindexID or 2; + if AtlasLoot_Data[tablename].Type == "Crafting" then + ItemindexID = "Pattern"; + end + --Show the table that has been selected AtlasLoot_ShowItemsFrame(tablename, AtlasLoot_Data, AtlasLoot_Data[tablename][tablenum].Name, pFrame, tablenum); AtlasLootDefaultFrame_SubTableScrollFrameUpdate(tablename, AtlasLoot_Data, pFrame, tablenum); - --Save needed info for fuure re-display of the table - -- AtlasLoot.db.profile.LastBoss = {tablename, AtlasLoot_Data, AtlasLoot_Data[tablename][tablenum].Name, pFrame, tablenum, ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE}; - --Show the table that has been selected AtlasLoot_DewdropSubMenu:Close(1); end diff --git a/AtlasLoot_Crafting/craftingTBC.lua b/AtlasLoot_Crafting/craftingTBC.lua index 1b6a098..505f79f 100644 --- a/AtlasLoot_Crafting/craftingTBC.lua +++ b/AtlasLoot_Crafting/craftingTBC.lua @@ -1099,25 +1099,7 @@ local SPELLFIRE = GetSpellInfo(26797); Type = "Crafting"; { Name = AL["Leather Armor"].." - Back"; - { 1, "s60640", "43565", "=q4=Durable Nerubhide Cape", "=ds="..AL["Trainer"]}; - { 2, "s60637", "43566", "=q4=Ice Striker's Cloak", "=ds="..AL["Trainer"]}; - { 3, "s42546", "33122", "=q4=Cloak of Darkness", "=ds=#sr# 360"}; - { 4, "s22926", "18509", "=q4=Chromatic Cloak", "=ds=#sr# 300"}; - { 5, "s22928", "18511", "=q4=Shifting Cloak", "=ds=#sr# 300"}; - { 6, "s55199", "41238", "=q3=Cloak of Tormented Skies", "=ds="..AL["Trainer"]}; - { 7, "s60631", "38441", "=q3=Cloak of Harsh Winds", "=ds="..AL["Trainer"]}; - { 8, "s19093", "15138", "=q3=Onyxia Scale Cloak", "=ds=#sr# 300"}; - { 9, "s10574", "8215", "=q2=Wild Leather Cloak", "=ds=#sr# 250"}; - { 10, "s10562", "8216", "=q2=Big Voodoo Cloak", "=ds=#sr# 240"}; - { 11, "s7153", "5965", "=q2=Guardian Cloak", "=ds=#sr# 185"}; - { 12, "s9198", "7377", "=q2=Frost Leather Cloak", "=ds=#sr# 180"}; - { 13, "s9070", "7283", "=q2=Black Whelp Cloak", "=ds=#sr# 100"}; - { 14, "s7953", "6466", "=q2=Deviate Scale Cloak", "=ds=#sr# 90"}; - { 15, "s2159", "2308", "=q2=Fine Leather Cloak", "=ds=#sr# 85"}; - { 16, "s3760", "3719", "=q1=Hillman's Cloak", "=ds=#sr# 150"}; - { 17, "s2168", "2316", "=q1=Dark Leather Cloak", "=ds=#sr# 110"}; - { 18, "s2162", "2310", "=q1=Embossed Leather Cloak", "=ds=#sr# 60"}; - + { 1, "s42546", "33122", "=q4=Cloak of Darkness", "=ds=#sr# 360"}; }; { Name = AL["Leather Armor"].." - Chest";