diff --git a/AtlasLoot/Core/AtlasLoot.lua b/AtlasLoot/Core/AtlasLoot.lua index cf844dc..b5b00d0 100644 --- a/AtlasLoot/Core/AtlasLoot.lua +++ b/AtlasLoot/Core/AtlasLoot.lua @@ -399,7 +399,6 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource_backup, tablenum) local spellName, spellIcon; SearchPrevData = {dataID, dataSource_backup, tablenum}; - --If the loot table name has not been passed, throw up a debugging statement if dataID == nil then @@ -444,6 +443,13 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource_backup, tablenum) AtlasLootDefaultFrame_MapButton:Disable(); AtlasLootDefaultFrame_MapSelectButton:SetText("No Map"); end + + if dataSource_backup == "AtlasLoot_CurrentWishList" then + ATLASLOOT_CURRENT_WISHLIST_NUM = AtlasLoot_CurrentWishList["Show"].ListNum; + else + ATLASLOOT_ITEM_UNLOCK = false; + end + local difType = false; -- Checks to see if type is the same if ATLASLOOT_CURRENTTYPE ~= dataSource[dataID].Type then @@ -465,7 +471,11 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource_backup, tablenum) ATLASLOOT_CURRENTTYPE = dataSource[dataID].Type or "Default"; -- Loads the difficultys into the scrollFrame - AtlasLoot:ScrollFrameUpdate(); + if dataSource[dataID].ListType then + AtlasLoot:ScrollFrameUpdate(nil,dataSource[dataID].ListType); + else + AtlasLoot:ScrollFrameUpdate(); + end -- Sets the main page lable AtlasLoot_BossName:SetText(dataSource[dataID][tablenum].Name); @@ -476,6 +486,12 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource_backup, tablenum) AtlasLootDefaultFrameScrollScrollBar:SetValue(ItemindexID * (max / #AtlasLoot_Difficulty[dataSource[dataID].Type])); end + -- Moves the difficulty scrollslider if wishlist + if dataSource_backup == "AtlasLoot_CurrentWishList" and dataSource[dataID].ListNum > 5 then + local min, max = AtlasLootDefaultFrameScrollScrollBar:GetMinMaxValues(); + AtlasLootDefaultFrameScrollScrollBar:SetValue(tablenum * (max / #AtlasLootWishList[dataSource[dataID].ListType][dataSource[dataID].ListNum])); + end + --For stopping the subtable from changing if its a token table if dataSource[dataID].NoSubt == nil and dataID ~= "FilterList" then if dataSource[dataID].DisplayName then @@ -542,7 +558,7 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource_backup, tablenum) end -- Create the loottable - if (dataID == "SearchResult") or (dataID == "WishList") or dataSource[dataID][tablenum] then + if (dataID == "SearchResult") or (dataSource_backup == "AtlasLoot_CurrentWishList") or dataSource[dataID][tablenum] then --Iterate through each item object and set its properties for i = 1, 30, 1 do --Check for a valid object (that it exists, and that it has a name @@ -583,7 +599,7 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource_backup, tablenum) AtlasLootItemsFrame.refreshFilter = {dataID, dataSource_backup, tablenum}; end - if dataID ~= "WishList" and dataID ~= "FilterList" and dataSource[dataID].Back ~= true then + if dataID ~= "FilterList" and dataSource[dataID].Back ~= true then AtlasLootItemsFrame.refreshOri = {dataID, dataSource_backup, tablenum}; end @@ -604,7 +620,9 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource_backup, tablenum) extraFrame = _G["AtlasLootItem_"..dataSource[dataID][tablenum][i][1].."_Extra"]; --If there is no data on the texture an item should have, show a big red question mark - if dataSource[dataID][tablenum][i][3] == "?" then + if dataSource[dataID][tablenum][i][3] == "Blank" then + iconFrame:SetTexture(nil); + elseif dataSource[dataID][tablenum][i][3] == "?" then iconFrame:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark"); elseif dataSource[dataID][tablenum][i][3] == "" then iconFrame:SetTexture(GetItemIcon(IDfound)); @@ -623,14 +641,14 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource_backup, tablenum) iconFrame:SetTexture("Interface\\Icons\\"..dataSource[dataID][tablenum][i][3]); end itemButton.itemTexture = dataSource[dataID][tablenum][i][3]; - if iconFrame:GetTexture() == nil then + if iconFrame:GetTexture() == nil and dataSource[dataID][tablenum][i][3] ~= "Blank" then iconFrame:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark"); end itemButton.name = text; itemButton.extra = extra; --Highlight items in the wishlist - if IDfound ~= "" and IDfound ~= 0 and dataSource_backup ~= "AtlasLootWishList" and AtlasLootWishList["Options"][UnitName("player")]["Mark"] == true then + if IDfound ~= "" and IDfound ~= 0 and dataSource_backup ~= "AtlasLoot_CurrentWishList" and AtlasLootWishList["Options"][UnitName("player")]["Mark"] == true then local xitemexistwish, itemwishicons = AtlasLoot_WishListCheck(IDfound, true) if xitemexistwish then text = itemwishicons.." "..text; @@ -675,7 +693,7 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource_backup, tablenum) itemButton.price = dataSource[dataID][tablenum][i][6] or nil; itemButton.droprate = dataSource[dataID][tablenum][i][7] or nil; - if (dataID == "SearchResult" or dataSource_backup == "AtlasLootWishList") and dataSource[dataID][tablenum][i][8] then + if (dataID == "SearchResult" or dataSource_backup == "AtlasLoot_CurrentWishList") and dataSource[dataID][tablenum][i][8] then itemButton.sourcePage = dataSource[dataID][tablenum][i][8]; elseif dataSource[dataID][tablenum][i][8] ~= nil and dataSource[dataID][tablenum][i][8]:match("=LT=") then itemButton.sourcePage = string.sub(dataSource[dataID][tablenum][i][8], 5); @@ -702,8 +720,11 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource_backup, tablenum) AtlasLootItemsFrame.refreshFilter = {dataID, dataSource_backup, tablenum}; end - if dataSource_backup ~= "AtlasLootWishList" and dataID ~= "FilterList" and dataSource[dataID].Back ~= true and dataID ~= "EmptyTable" then + if dataID ~= "FilterList" and dataSource[dataID].Back ~= true and dataID ~= "EmptyTable" then AtlasLootItemsFrame.refreshOri = {dataID, dataSource_backup, tablenum}; + end + + if dataSource_backup ~= "AtlasLoot_CurrentWishList" and dataID ~= "FilterList" and dataSource[dataID].Back ~= true and dataID ~= "EmptyTable" then AtlasLoot.db.profile.LastBoss = {dataID, dataSource_backup, tablenum, ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE}; AtlasLoot.db.profile[ATLASLOOT_CURRENTTABLE] = {dataID, dataSource_backup, tablenum, ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE}; end @@ -724,7 +745,7 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource_backup, tablenum) end -- Show the Filter Check-Box - if dataID ~= "SearchResult" and filterCheck(dataID) ~= true and dataSource_backup ~= "AtlasLoot_TokenData" and dataSource_backup ~= "AtlasLootWishList" then + if dataID ~= "SearchResult" and filterCheck(dataID) ~= true and dataSource_backup ~= "AtlasLoot_TokenData" and dataSource_backup ~= "AtlasLoot_CurrentWishList" then AtlasLootFilterCheck:Show(); end @@ -735,15 +756,17 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource_backup, tablenum) _G["AtlasLootItemsFrame_Wishlist_Options"]:Hide(); _G["AtlasLootItemsFrame_Wishlist_Share"]:Hide(); _G["AtlasLootItemsFrame_Wishlist_Swap"]:Hide(); + _G["AtlasLootItemsFrame_Wishlist_UnLock"]:Hide(); -- Show Wishlist buttons when a wishlist in showing - if dataSource_backup == "AtlasLootWishList" then + if dataSource_backup == "AtlasLoot_CurrentWishList" then _G["AtlasLootItemsFrame_Wishlist_Options"]:Show(); _G["AtlasLootItemsFrame_Wishlist_Share"]:Show(); _G["AtlasLootItemsFrame_Wishlist_Swap"]:Show(); - if dataID == "Shared" then + _G["AtlasLootItemsFrame_Wishlist_UnLock"]:Show(); + if dataSource[dataID].ListType == "Shared" then AtlasLootItemsFrame_Wishlist_Swap:SetText("Own"); - elseif dataID == "Own" then + elseif dataSource[dataID].ListType == "Own" then AtlasLootItemsFrame_Wishlist_Swap:SetText("Shared"); end end @@ -892,7 +915,11 @@ function AtlasLoot:ShowQuickLooks(button) "tooltipTitle", AL["QuickLook"].." 1", "tooltipText", AL["Assign this loot table\n to QuickLook"].." 1", "func", function() - AtlasLootCharDB["QuickLooks"][1]={AtlasLootItemsFrame.refreshOri[1], AtlasLootItemsFrame.refreshOri[2], AtlasLootItemsFrame.refreshOri[3], ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE, _G[AtlasLootItemsFrame.refreshOri[2]][AtlasLootItemsFrame.refreshOri[1]][AtlasLootItemsFrame.refreshOri[3]].Name}; + if AtlasLootItemsFrame.refresh[2] == "AtlasLoot_CurrentWishList" then + AtlasLootCharDB["QuickLooks"][1]={AtlasLoot_CurrentWishList["Show"].ListType, "AtlasLootWishList", AtlasLoot_CurrentWishList["Show"].ListNum, ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE, _G["AtlasLootWishList"][AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Name}; + else + AtlasLootCharDB["QuickLooks"][1]={AtlasLootItemsFrame.refreshOri[1], AtlasLootItemsFrame.refreshOri[2], AtlasLootItemsFrame.refreshOri[3], ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE, _G[AtlasLootItemsFrame.refreshOri[2]][AtlasLootItemsFrame.refreshOri[1]][AtlasLootItemsFrame.refreshOri[3]].Name}; + end AtlasLoot:RefreshQuickLookButtons(); dewdrop:Close(1); end @@ -902,8 +929,12 @@ function AtlasLoot:ShowQuickLooks(button) "tooltipTitle", AL["QuickLook"].." 2", "tooltipText", AL["Assign this loot table\n to QuickLook"].." 2", "func", function() - AtlasLootCharDB["QuickLooks"][2]={AtlasLootItemsFrame.refreshOri[1], AtlasLootItemsFrame.refreshOri[2], AtlasLootItemsFrame.refreshOri[3], ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE, _G[AtlasLootItemsFrame.refreshOri[2]][AtlasLootItemsFrame.refreshOri[1]][AtlasLootItemsFrame.refreshOri[3]].Name}; - AtlasLoot:RefreshQuickLookButtons(); + if AtlasLootItemsFrame.refresh[2] == "AtlasLoot_CurrentWishList" then + AtlasLootCharDB["QuickLooks"][2]={AtlasLoot_CurrentWishList["Show"].ListType, "AtlasLootWishList", AtlasLoot_CurrentWishList["Show"].ListNum, ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE, _G["AtlasLootWishList"][AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Name}; + else + AtlasLootCharDB["QuickLooks"][2]={AtlasLootItemsFrame.refreshOri[1], AtlasLootItemsFrame.refreshOri[2], AtlasLootItemsFrame.refreshOri[3], ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE, _G[AtlasLootItemsFrame.refreshOri[2]][AtlasLootItemsFrame.refreshOri[1]][AtlasLootItemsFrame.refreshOri[3]].Name}; + end + AtlasLoot:RefreshQuickLookButtons(); dewdrop:Close(1); end ); @@ -912,8 +943,12 @@ function AtlasLoot:ShowQuickLooks(button) "tooltipTitle", AL["QuickLook"].." 3", "tooltipText", AL["Assign this loot table\n to QuickLook"].." 3", "func", function() - AtlasLootCharDB["QuickLooks"][3]={AtlasLootItemsFrame.refreshOri[1], AtlasLootItemsFrame.refreshOri[2], AtlasLootItemsFrame.refreshOri[3], ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE, _G[AtlasLootItemsFrame.refreshOri[2]][AtlasLootItemsFrame.refreshOri[1]][AtlasLootItemsFrame.refreshOri[3]].Name}; - AtlasLoot:RefreshQuickLookButtons(); + if AtlasLootItemsFrame.refresh[2] == "AtlasLoot_CurrentWishList" then + AtlasLootCharDB["QuickLooks"][3]={AtlasLoot_CurrentWishList["Show"].ListType, "AtlasLootWishList", AtlasLoot_CurrentWishList["Show"].ListNum, ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE, _G["AtlasLootWishList"][AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Name}; + else + AtlasLootCharDB["QuickLooks"][3]={AtlasLootItemsFrame.refreshOri[1], AtlasLootItemsFrame.refreshOri[2], AtlasLootItemsFrame.refreshOri[3], ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE, _G[AtlasLootItemsFrame.refreshOri[2]][AtlasLootItemsFrame.refreshOri[1]][AtlasLootItemsFrame.refreshOri[3]].Name}; + end + AtlasLoot:RefreshQuickLookButtons(); dewdrop:Close(1); end ); @@ -922,8 +957,12 @@ function AtlasLoot:ShowQuickLooks(button) "tooltipTitle", AL["QuickLook"].." 4", "tooltipText", AL["Assign this loot table\n to QuickLook"].." 4", "func", function() - AtlasLootCharDB["QuickLooks"][4]={AtlasLootItemsFrame.refreshOri[1], AtlasLootItemsFrame.refreshOri[2], AtlasLootItemsFrame.refreshOri[3], ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE, _G[AtlasLootItemsFrame.refreshOri[2]][AtlasLootItemsFrame.refreshOri[1]][AtlasLootItemsFrame.refreshOri[3]].Name}; - AtlasLoot:RefreshQuickLookButtons(); + if AtlasLootItemsFrame.refresh[2] == "AtlasLoot_CurrentWishList" then + AtlasLootCharDB["QuickLooks"][4]={AtlasLoot_CurrentWishList["Show"].ListType, "AtlasLootWishList", AtlasLoot_CurrentWishList["Show"].ListNum, ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE, _G["AtlasLootWishList"][AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Name}; + else + AtlasLootCharDB["QuickLooks"][4]={AtlasLootItemsFrame.refreshOri[1], AtlasLootItemsFrame.refreshOri[2], AtlasLootItemsFrame.refreshOri[3], ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE, _G[AtlasLootItemsFrame.refreshOri[2]][AtlasLootItemsFrame.refreshOri[1]][AtlasLootItemsFrame.refreshOri[3]].Name}; + end + AtlasLoot:RefreshQuickLookButtons(); dewdrop:Close(1); end ); diff --git a/AtlasLoot/Core/LootButtons.lua b/AtlasLoot/Core/LootButtons.lua index 8cf5f6a..5ccbbf2 100644 --- a/AtlasLoot/Core/LootButtons.lua +++ b/AtlasLoot/Core/LootButtons.lua @@ -221,7 +221,14 @@ function AtlasLootItem_OnClick(self ,arg1) local iteminfo = GetItemInfo(self.itemID); local itemName, itemLink, itemQuality, itemLevel, itemMinLevel, itemType, itemSubType, itemCount, itemEquipLoc, itemTexture = GetItemInfo(self.itemID); --If shift-clicked, link in the chat window - if(arg1=="RightButton" and not iteminfo and self.itemID ~= 0) then + if arg1=="RightButton" and ATLASLOOT_ITEM_UNLOCK then + AtlasLoot:MoveWishlistItem("Down",self.number); + elseif IsAltKeyDown() and arg1=="LeftButton" and ATLASLOOT_ITEM_UNLOCK then + StaticPopup_Show ("ATLASLOOT_ADD_DIVIDER"); + StaticPopupDialogs.ATLASLOOT_ADD_DIVIDER.num = self.number; + elseif (arg1=="LeftButton") and ATLASLOOT_ITEM_UNLOCK then + AtlasLoot:MoveWishlistItem("Up",self.number); + elseif(arg1=="RightButton" and not iteminfo and self.itemID ~= 0) then AtlasLootTooltip:SetHyperlink("item:"..self.itemID..":0:0:0:0:0:0:0"); if not AtlasLoot.db.profile.ItemSpam then DEFAULT_CHAT_FRAME:AddMessage(AL["Server queried for "]..color.."["..name.."]".."|r"..AL[". Right click on any other item to refresh the loot page."]); @@ -239,9 +246,9 @@ function AtlasLootItem_OnClick(self ,arg1) --If control-clicked, use the dressing room elseif(IsControlKeyDown() and iteminfo) then DressUpItemLink(itemLink); - elseif(IsAltKeyDown() and (self.itemID ~= 0)) then - if AtlasLootItemsFrame.refresh[2] == "AtlasLootWishList" then - AtlasLoot_DeleteFromWishList(self.itemID); + elseif IsAltKeyDown() then + if AtlasLootItemsFrame.refresh[2] == "AtlasLoot_CurrentWishList" then + AtlasLoot_DeleteFromWishList(self.itemID,self.number); else if(AtlasLootItemsFrame.refresh[1] == "SearchResult") then local datID, _, datPage = strsplit("|", self.sourcePage); @@ -252,7 +259,7 @@ function AtlasLootItem_OnClick(self ,arg1) AtlasLoot_BossName:GetText(), self.dataID .. "|" .. "AtlasLoot_Data" .. "|" .. tostring(self.tablenum), self); end end - elseif((AtlasLootItemsFrame.refresh[1] == "SearchResult" or AtlasLootItemsFrame.refresh[2] == "AtlasLootWishList") and self.sourcePage) then + elseif((AtlasLootItemsFrame.refresh[1] == "SearchResult" or AtlasLootItemsFrame.refresh[2] == "AtlasLoot_CurrentWishList") and self.sourcePage) then local dataID, dataSource, dataPage = strsplit("|", self.sourcePage); if(dataID and dataSource) then AtlasLoot:ShowItemsFrame(dataID, "AtlasLoot_Data", tonumber(dataPage)); @@ -269,9 +276,9 @@ function AtlasLootItem_OnClick(self ,arg1) if IsShiftKeyDown() then spellID = string.sub(self.itemID, 2); ChatEdit_InsertLink(AtlasLoot_GetEnchantLink(spellID)); - elseif(IsAltKeyDown() and (self.itemID ~= 0)) then - if AtlasLootItemsFrame.refresh[2] == "AtlasLootWishList" then - AtlasLoot_DeleteFromWishList(self.itemID); + elseif IsAltKeyDown() then + if AtlasLootItemsFrame.refresh[2] == "AtlasLoot_CurrentWishList" then + AtlasLoot_DeleteFromWishList(self.itemID, self.number); else spellName, _, _, _, _, _, _, _, _ = GetSpellInfo(string.sub(self.itemID, 2)); --spellIcon = GetItemIcon(self.dressingroomID); diff --git a/AtlasLoot/Core/WishList.lua b/AtlasLoot/Core/WishList.lua index 25cd679..fe4a210 100644 --- a/AtlasLoot/Core/WishList.lua +++ b/AtlasLoot/Core/WishList.lua @@ -39,6 +39,26 @@ local PURPLE = "|cff9F3FFF"; local BLUE = "|cff0070dd"; local ORANGE = "|cffFF8400"; +function AtlasLoot:ShowWishList(listType,arg2,arg3) + AtlasLoot_CurrentWishList = {["Show"] = {ListType = listType, ListNum = arg2 ,Name = "WishLists", Icon = AtlasLootWishList[listType][arg2].Icon}}; + if AtlasLootWishList["Options"][playerName]["AutoSortWishlist"] then + AtlasLoot:SortWishList(true); + end + local numPages = math.ceil(#AtlasLootWishList[listType][arg2]/30); + for n = 1 ,numPages, 1 do + table.insert(AtlasLoot_CurrentWishList["Show"], {Name = "Page "..n}) + end + for i,v in ipairs(AtlasLootWishList[listType][arg2]) do + local itemNum = v[1]; + if v[1] >= 31 then + itemNum = v[1]-(math.floor(v[1]/30)*30); + end + table.insert(AtlasLoot_CurrentWishList["Show"][math.ceil(v[1]/30)], {itemNum,v[2],v[3],v[4],v[5],v[6],v[7],v[8]}); + end + AtlasLoot:ShowItemsFrame("Show", "AtlasLoot_CurrentWishList", arg3 or 1); + AtlasLoot_WishListDrop:Close(1) +end + --[[ AtlasLoot_WishListAddDropClick(typ, arg2, arg3, arg4) Add a item too the wishlist or show the selected wishlist @@ -46,11 +66,9 @@ Add a item too the wishlist or show the selected wishlist function AtlasLoot_WishListAddDropClick(typ, arg2, arg3, arg4) if arg4 == true then if typ == "addOwn" then - AtlasLoot:ShowItemsFrame("Own", "AtlasLootWishList", arg2); - AtlasLoot_WishListDrop:Close(1) + AtlasLoot:ShowWishList("Own",arg2); elseif typ == "addShared" then - AtlasLoot:ShowItemsFrame("Shared", "AtlasLootWishList", arg2); - AtlasLoot_WishListDrop:Close(1) + AtlasLoot:ShowWishList("Shared",arg2); end else xtyp = typ @@ -60,7 +78,7 @@ function AtlasLoot_WishListAddDropClick(typ, arg2, arg3, arg4) DEFAULT_CHAT_FRAME:AddMessage(BLUE..AL["AtlasLoot"]..": "..AtlasLoot_FixText(itemName)..RED..AL[" already in the WishList!"]..WHITE.." ("..AtlasLootWishList["Own"][arg2].Name..")"); return; end - table.insert(AtlasLootWishList["Own"][arg2], { #AtlasLootWishList["Own"][arg2] + 1, itemID, itemTexture, itemName, lootPage, "", "", sourcePage}); + table.insert(AtlasLootWishList["Own"][arg2], { #AtlasLootWishList["Own"][arg2] + 1, itemID, itemTexture, itemName, AtlasLoot_Data[AtlasLootItemsFrame.refresh[1]].Name, "", "", sourcePage}); DEFAULT_CHAT_FRAME:AddMessage(RED..AL["AtlasLoot"]..": "..AtlasLoot_FixText(itemName)..GREY..AL[" added to the WishList."]..WHITE.." ("..AtlasLootWishList["Own"][arg2].Name..")"); AtlasLoot_WishListDrop:Close(1) elseif typ == "addShared" then @@ -81,23 +99,87 @@ local function CloneTable(t) -- return a copy of the table t while i do if type(v)=="table" then v=CloneTable(v); - end + end new[i] = v; i, v = next(t, i); -- get next index end return new; end +-- Add divider +function AtlasLoot:AddItemDivider(num,text) + for i,v in ipairs(AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum]) do + if num <= v[1] then + v[1] = v[1] + 1; + end + end + if text == "" or text == nil then + table.insert(AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum],{num, 0, "Blank", WHITE..text, ""}); + else + table.insert(AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum],{num, 0, "INV_Box_01", WHITE..text, ""}); + end + AtlasLoot:ShowWishList(AtlasLoot_CurrentWishList["Show"].ListType, AtlasLoot_CurrentWishList["Show"].ListNum,AtlasLootItemsFrame.refresh[3]); +end + -- Opens edit wishlist name/icon window function AtlasLoot:EditWishList() AtlasLootWishList_AddFrame:Show() AtlasLottAddEditWishList:SetText(AL["Edit Wishlist"]); - AtlasLootWishListNewName:SetText(AtlasLootWishList[AtlasLootItemsFrame.refresh[1]][AtlasLootItemsFrame.refresh[3]].Name); - curaddicon = AtlasLootWishList[AtlasLootItemsFrame.refresh[1]][AtlasLootItemsFrame.refresh[3]].Icon; + AtlasLootWishListNewName:SetText(AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Name); + curaddicon = AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Icon; editName = true; AtlasLoot_WishListDrop:Close(1); end +-- Moves wishlist item +function AtlasLoot:MoveWishlistItem(pos,itemNum,replaceNum,replaceNum2) + itemNum = itemNum + ((AtlasLootItemsFrame.refresh[3]-1)*30); + if pos == "Up" then replaceNum = itemNum - 1; replaceNum2 = 1 elseif pos == "Down" then replaceNum = itemNum + 1; replaceNum2 = -1 end + if replaceNum ~= 0 then + for i,v in ipairs(AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum]) do + if itemNum == v[1] then + v[1] = replaceNum; + elseif v[1] == replaceNum then + v[1] = v[1] + replaceNum2; + end + end + AtlasLoot:ShowWishList(AtlasLoot_CurrentWishList["Show"].ListType, AtlasLoot_CurrentWishList["Show"].ListNum,AtlasLootItemsFrame.refresh[3]); + end +end + +--Sort wishlist +function AtlasLoot:SortWishList(refresh) + local sorted = {}; + local name = AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Name; + local icon = AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Icon; + for i,v in ipairs(AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum]) do + if sorted[v[5]] and v[2] ~= 0 then + table.insert(sorted[v[5]],v); + elseif v[2] ~= 0 then + sorted[v[5]] = {}; + table.insert(sorted[v[5]],{0, 0, "INV_Box_01", WHITE..v[5], ""}); + table.insert(sorted[v[5]],v); + end + end + AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum] = {}; + local num = 1 + for i,v in pairs(sorted) do + for n,t in ipairs(v) do + if num ~= 1 and t[3] == "INV_Box_01" then + table.insert(AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum],{num, 0, "Blank", WHITE.." ", ""}); + num = num + 1; + end + table.insert(AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum],{num,t[2],t[3],t[4],t[5],t[6],t[7],t[8]}); + num = num + 1; + end + end + AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Name = name; + AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Icon = icon; + if refresh == nil then + AtlasLoot:ShowWishList(AtlasLoot_CurrentWishList["Show"].ListType, AtlasLoot_CurrentWishList["Show"].ListNum); + end +end + -- Opens add wishlist name/icon window function AtlasLoot:AddWishList() AtlasLootWishList_AddFrame:Show(); @@ -113,15 +195,15 @@ end -- Clones a shared wishlist to personal table function AtlasLoot:SetDefaultWishList() - if AtlasLootItemsFrame.refresh[1] == "Own" then - AtlasLootWishList["Options"][playerName]["DefaultWishList"] = {AtlasLootItemsFrame.refresh[1], AtlasLootItemsFrame.refresh[2], AtlasLootItemsFrame.refresh[3]}; + if AtlasLoot_CurrentWishList["Show"].ListType == "Own" then + AtlasLootWishList["Options"][playerName]["DefaultWishList"] = {AtlasLoot_CurrentWishList["Show"].ListType, "AtlasLootWishList", AtlasLoot_CurrentWishList["Show"].ListNum}; end AtlasLoot_WishListDrop:Close(1); end -- Deletes current wishlist function AtlasLoot:DeleteWishList() - if AtlasLootItemsFrame.refresh[2] == "AtlasLootWishList" then + if AtlasLootItemsFrame.refresh[2] == "AtlasLoot_CurrentWishList" then StaticPopup_Show("ATLASLOOT_DELETE_WISHLIST"); AtlasLoot_WishListDrop:Close(1); end @@ -129,7 +211,7 @@ end -- Share current wishlist function AtlasLoot:ShareWishList() - StaticPopup_Show ("ATLASLOOT_SEND_WISHLIST",AtlasLootWishList["Own"][AtlasLootItemsFrame.refresh[3]].Name); + StaticPopup_Show ("ATLASLOOT_SEND_WISHLIST",AtlasLootWishList["Own"][AtlasLoot_CurrentWishList["Show"].ListNum].Name); end --[[ @@ -137,12 +219,12 @@ AtlasLoot:WishListSwapButton Main panel wishlistswap button ]] function AtlasLoot:WishListSwapButton(xitemID, xitemTexture, xitemName, xlootPage, xsourcePage, button, show) - if AtlasLootItemsFrame.refresh[1] == "Own" then + if AtlasLoot_CurrentWishList["Show"].ListType == "Own" then if AtlasLootWishList["Shared"][1] then AtlasLoot_WishListAddDropClick("addShared", 1, "", show); AtlasLootItemsFrame_Wishlist_Swap:SetText("Own"); end - elseif AtlasLootItemsFrame.refresh[1] == "Shared" then + elseif AtlasLoot_CurrentWishList["Show"].ListType == "Shared" then AtlasLoot_WishListAddDropClick("addOwn", AtlasLootWishList["Options"][playerName]["DefaultWishList"][3] or 1, "", show); AtlasLootItemsFrame_Wishlist_Swap:SetText("Shared"); end @@ -257,24 +339,27 @@ end AtlasLoot_DeleteFromWishList(itemID) Deletes the specified items from the wishlist ]] -function AtlasLoot_DeleteFromWishList(itemID) - if itemID and itemID == 0 then return end - if AtlasLootItemsFrame.refresh[2] == "AtlasLootWishList" then - for i, v in ipairs(_G[AtlasLootItemsFrame.refresh[2]][AtlasLootItemsFrame.refresh[1]][AtlasLootItemsFrame.refresh[3]]) do - if v[2] == itemID then - DEFAULT_CHAT_FRAME:AddMessage(RED..AL["AtlasLoot"]..": "..AtlasLoot_FixText(v[4])..GREY..AL[" deleted from the WishList."]..WHITE.." (".._G[AtlasLootItemsFrame.refresh[2]][AtlasLootItemsFrame.refresh[1]][AtlasLootItemsFrame.refresh[3]].Name..")"); - table.remove(_G[AtlasLootItemsFrame.refresh[2]][AtlasLootItemsFrame.refresh[1]][AtlasLootItemsFrame.refresh[3]], i); - --Sort wishlist after deleting an item - for n,table in ipairs(_G[AtlasLootItemsFrame.refresh[2]][AtlasLootItemsFrame.refresh[1]][AtlasLootItemsFrame.refresh[3]]) do - table[1] = n; +function AtlasLoot_DeleteFromWishList(itemID,btnNumber) + btnNumber = btnNumber + ((AtlasLootItemsFrame.refresh[3] - 1) * 30); + if AtlasLootItemsFrame.refresh[2] == "AtlasLoot_CurrentWishList" then + for i, v in ipairs(AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum]) do + if v[1] == btnNumber then + local numPos = v[1]; + DEFAULT_CHAT_FRAME:AddMessage(RED..AL["AtlasLoot"]..": "..AtlasLoot_FixText(v[4])..GREY..AL[" deleted from the WishList."]..WHITE.." ("..AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Name..")"); + table.remove(AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum], i); + --Sort wishlist after deleting an item + for n,table in ipairs(AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum]) do + if numPos <= table[1] then + table[1] = table[1] - 1; end + end break; end - end + end end AtlasLootItemsFrame:Hide(); - AtlasLoot:ShowItemsFrame(AtlasLootItemsFrame.refresh[1], AtlasLootItemsFrame.refresh[2], AtlasLootItemsFrame.refresh[3]); -end + AtlasLoot:ShowWishList(AtlasLoot_CurrentWishList["Show"].ListType, AtlasLoot_CurrentWishList["Show"].ListNum,AtlasLootItemsFrame.refresh[3]); + end --[[ AtlasLoot_WishListCheck(itemID, all): @@ -372,14 +457,19 @@ function AtlasLoot:WishListOptionsRegister() "func", function() AtlasLoot:EditWishList() end, "notCheckable", true ); - if AtlasLootItemsFrame.refresh[1] == "Shared" then + AtlasLoot_WishListOptions:AddLine( + "text", AL["Sort Wishlist"], + "func", function() AtlasLoot:SortWishList() end, + "notCheckable", true + ); + if AtlasLootItemsFrame.refresh[2] == "AtlasLoot_CurrentWishList" and AtlasLoot_CurrentWishList["Show"].ListType == "Shared" then AtlasLoot_WishListOptions:AddLine( "text", AL["Copy Wishlist To Own"], "func", function() AtlasLoot:CloneSharedWishList() end, "notCheckable", true ); end - if AtlasLootItemsFrame.refresh[1] == "Own" then + if AtlasLootItemsFrame.refresh[2] == "AtlasLoot_CurrentWishList" and AtlasLoot_CurrentWishList["Show"].ListType == "Own" then AtlasLoot_WishListOptions:AddLine( "text", AL["Make Wishlist Default"], "func", function() AtlasLoot:SetDefaultWishList() end, @@ -434,12 +524,12 @@ StaticPopupDialogs["ATLASLOOT_DELETE_WISHLIST"] = { this:SetFrameStrata("TOOLTIP"); end, OnAccept = function() - table.remove(AtlasLootWishList[AtlasLootItemsFrame.refresh[1]], AtlasLootItemsFrame.refresh[3]); + table.remove(AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType], AtlasLoot_CurrentWishList["Show"].ListNum); AtlasLootWishList["Options"][playerName]["DefaultWishList"][3] = 1; - if AtlasLootWishList[AtlasLootItemsFrame.refresh[1]][1] == nil then + if AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][1] == nil then AtlasLoot:ShowItemsFrame("EmptyTable", "AtlasLoot_Data", 1); else - AtlasLoot:ShowItemsFrame(AtlasLootItemsFrame.refresh[1], AtlasLootItemsFrame.refresh[2], 1); + AtlasLoot:ShowWishList(AtlasLoot_CurrentWishList["Show"].ListType, 1); end AtlasLoot_WishListDrop:Close(1); end, @@ -519,8 +609,7 @@ function AtlasLoot:WishlistSetup() if AtlasLootWishList["Options"][playerName]["AllowShareWishlist"] ~= true and AtlasLootWishList["Options"][playerName]["AllowShareWishlist"] ~= false then AtlasLootWishList["Options"][playerName]["AllowShareWishlist"] = true end if AtlasLootWishList["Options"][playerName]["AllowShareWishlistInCombat"] ~= true and AtlasLootWishList["Options"][playerName]["AllowShareWishlistInCombat"] ~= false then AtlasLootWishList["Options"][playerName]["AllowShareWishlistInCombat"] = true end if AtlasLootWishList["Options"][playerName]["UseDefaultWishlist"] ~= true and AtlasLootWishList["Options"][playerName]["UseDefaultWishlist"] ~= false then AtlasLootWishList["Options"][playerName]["UseDefaultWishlist"] = false end - if AtlasLootWishList["Options"][playerName]["DefaultWishList"] ~= true then AtlasLootWishList["Options"][playerName]["DefaultWishList"] = {"Own", "AtlasLootWishList", 1} end - + if not AtlasLootWishList["Options"][playerName]["DefaultWishList"] then AtlasLootWishList["Options"][playerName]["DefaultWishList"] = {"Own", "AtlasLootWishList", 1} end end --[[ AtlasLoot_CreateWishlistOptions() @@ -606,10 +695,10 @@ function AtlasLoot_CreateWishlistOptions() if curaddicon == "" then curaddicon = "Interface\\Icons\\INV_Misc_QuestionMark" elseif curaddicon ~= "" then - AtlasLootWishList[AtlasLootItemsFrame.refresh[1]][AtlasLootItemsFrame.refresh[3]].Name = curaddname; - AtlasLootWishList[AtlasLootItemsFrame.refresh[1]][AtlasLootItemsFrame.refresh[3]].Icon = curaddicon; + AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Name = curaddname; + AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Icon = curaddicon; WishListAddFrame:Hide(); - AtlasLoot:ShowItemsFrame(AtlasLootItemsFrame.refresh[1], AtlasLootItemsFrame.refresh[2], AtlasLootItemsFrame.refresh[3]); + AtlasLoot:ShowWishList(AtlasLoot_CurrentWishList["Show"].ListType, AtlasLoot_CurrentWishList["Show"].ListNum); end else if curaddicon == "" then @@ -617,8 +706,8 @@ function AtlasLoot_CreateWishlistOptions() elseif curaddicon ~= "" then table.insert( AtlasLootWishList["Own"],{Name = curaddname, Icon = curaddicon}) WishListAddFrame:Hide(); - if AtlasLootItemsFrame.refresh[2] == "AtlasLootWishList" then - AtlasLoot:ShowItemsFrame(AtlasLootItemsFrame.refresh[1], AtlasLootItemsFrame.refresh[2], AtlasLootItemsFrame.refresh[3]); + if AtlasLootItemsFrame.refresh[2] == "AtlasLoot_CurrentWishList" then + AtlasLoot:ShowWishList(AtlasLoot_CurrentWishList["Show"].ListType, AtlasLoot_CurrentWishList["Show"].ListNum); end end end @@ -791,6 +880,26 @@ function AtlasLoot_CreateWishlistOptions() AtlasLootWishList["Options"][playerName]["UseDefaultWishlist"] = true; end end) + + local WishListAutoSort = CreateFrame("CheckButton", "AtlasLootOptionsWishListAutoSort", WishlistOptionsFrame, "OptionsCheckButtonTemplate") + WishListAutoSort:SetPoint("LEFT", WishlistOptionsFrame, "TOPLEFT", 5, -135) + WishListAutoSort:SetWidth(25) + WishListAutoSort:SetHeight(25) + WishListAutoSort:SetScript("OnShow", function() + _G[this:GetName().."Text"]:SetText(AL["Auto Sort WishLists"]); + if AtlasLootWishList["Options"][playerName]["AutoSortWishlist"] == true then + this:SetChecked(1); + else + this:SetChecked(nil); + end + end) + WishListAutoSort:SetScript("OnClick", function() + if AtlasLootWishList["Options"][playerName]["AutoSortWishlist"] then + AtlasLootWishList["Options"][playerName]["AutoSortWishlist"] = false; + else + AtlasLootWishList["Options"][playerName]["AutoSortWishlist"] = true; + end + end) InterfaceOptions_AddCategory(WishlistOptionsFrame) OptionsLoadet = true @@ -926,7 +1035,7 @@ StaticPopupDialogs["ATLASLOOT_SEND_WISHLIST"] = { else if SpamProtect(string.lower(name)) then - curtable = {AtlasLootItemsFrame.refresh[1], AtlasLootItemsFrame.refresh[2], AtlasLootItemsFrame.refresh[3]}; + curtable = {AtlasLoot_CurrentWishList["Show"].ListType, "AtlasLootWishList", AtlasLoot_CurrentWishList["Show"].ListNum}; ALModule:SendCommMessage("AtlasLootWishlist", "WishlistRequest", "WHISPER", name); else local _,_,timeleft = string.find( 10-(GetTime() - SpamFilter[string.lower(name)]), "(%d+)%.") @@ -939,3 +1048,24 @@ StaticPopupDialogs["ATLASLOOT_SEND_WISHLIST"] = { whileDead = 1, hideOnEscape = 1 }; + +--[[ +StaticPopupDialogs["ATLASLOOT_ADD_DIVIDER"] +This is shown, if you want too add a divider to a wishlist +]] +StaticPopupDialogs["ATLASLOOT_ADD_DIVIDER"] = { + text = "Add text for a divider or leave blank for a blank", + button1 = "Set Text", + button2 = AL["Cancel"], + OnShow = function(self) + self:SetFrameStrata("TOOLTIP"); + end, + OnAccept = function() + local text = _G[this:GetParent():GetName().."EditBox"]:GetText(); + AtlasLoot:AddItemDivider(StaticPopupDialogs.ATLASLOOT_ADD_DIVIDER.num,text); + end, + hasEditBox = 1, + timeout = 0, + whileDead = 1, + hideOnEscape = 1 +}; diff --git a/AtlasLoot/DefaultFrame/AtlaslootDefaultFrameCreate.lua b/AtlasLoot/DefaultFrame/AtlaslootDefaultFrameCreate.lua index 112c131..2318613 100644 --- a/AtlasLoot/DefaultFrame/AtlaslootDefaultFrameCreate.lua +++ b/AtlasLoot/DefaultFrame/AtlaslootDefaultFrameCreate.lua @@ -105,6 +105,7 @@ local function createLootItemButtons(num) button.extra:SetPoint("TOPLEFT","AtlasLootItem_"..num.."_Name","BOTTOMLEFT",0,-1); button.extra:SetJustifyH("LEFT"); button:RegisterForClicks("AnyDown"); + button.number = num; button:SetScript("OnEnter", function(self) AtlasLootItem_OnEnter(self) end); button:SetScript("OnLeave", function(self) AtlasLootItem_OnLeave(self) end); button:SetScript("OnClick", function(self, arg1) AtlasLootItem_OnClick(self, arg1) end); @@ -179,7 +180,7 @@ local backbtn = CreateFrame("Button", "AtlasLootItemsFrame_BACK", AtlasLootItems -- Wishlist Own/Swap button local swapbtn = CreateFrame("Button", "AtlasLootItemsFrame_Wishlist_Swap", AtlasLootItemsFrame, "OptionsButtonTemplate"); - swapbtn:SetPoint("BOTTOM", "AtlasLootItemsFrame", "BOTTOM",0,4); + swapbtn:SetPoint("BOTTOM", "AtlasLootItemsFrame", "BOTTOM",50,4); swapbtn:SetScript("OnClick", function(self) AtlasLoot:WishListSwapButton("","","","","",self,true) end) swapbtn:Hide(); @@ -187,7 +188,7 @@ local swapbtn = CreateFrame("Button", "AtlasLootItemsFrame_Wishlist_Swap", Atlas local optionsbtn = CreateFrame("Button", "AtlasLootItemsFrame_Wishlist_Options", AtlasLootItemsFrame, "OptionsButtonTemplate"); optionsbtn:SetPoint("BOTTOM", "AtlasLootItemsFrame_Wishlist_Swap", "BOTTOM",-100,0); optionsbtn:SetText(AL["Options"]); - optionsbtn:SetScript("OnClick", function(self) + optionsbtn:SetScript("OnClick", function(self) if AtlasLoot_WishListOptions:IsOpen() then AtlasLoot_WishListOptions:Close(); else @@ -196,13 +197,41 @@ local optionsbtn = CreateFrame("Button", "AtlasLootItemsFrame_Wishlist_Options", end); optionsbtn:Hide(); - -- Wishlist Share button + -- Wishlist Item Lock button +ATLASLOOT_ITEM_UNLOCK = false; +local lockbtn = CreateFrame("Button", "AtlasLootItemsFrame_Wishlist_UnLock", AtlasLootItemsFrame, "OptionsButtonTemplate"); + lockbtn:SetPoint("BOTTOM", "AtlasLootItemsFrame_Wishlist_Options", "BOTTOM",-100,0); + lockbtn:SetScript("OnClick", function(self) + if ATLASLOOT_ITEM_UNLOCK then + ATLASLOOT_ITEM_UNLOCK = false; + lockbtn:SetText("Locked"); + else + ATLASLOOT_ITEM_UNLOCK = true; + lockbtn:SetText("UnLocked"); + end + end) + lockbtn:SetScript("OnEnter", function(self) + GameTooltip:ClearLines(); + GameTooltip:SetOwner(self, "ANCHOR_RIGHT", -(self:GetWidth() / 2), 5); + GameTooltip:AddLine("Toggle Item Moving"); + GameTooltip:AddLine("Left Click to move item up"); + GameTooltip:AddLine("Right Click to move item down"); + GameTooltip:AddLine("Alt + Left Click to add a divider"); + GameTooltip:Show(); + end); + lockbtn:SetScript("OnLeave", function() + if(GameTooltip:IsVisible()) then + GameTooltip:Hide(); + end + end); + lockbtn:SetText("Locked"); + lockbtn:Hide(); + -- Wishlist Share button local sharebtn = CreateFrame("Button", "AtlasLootItemsFrame_Wishlist_Share", AtlasLootItemsFrame, "OptionsButtonTemplate"); sharebtn:SetPoint("BOTTOM", "AtlasLootItemsFrame_Wishlist_Swap", "BOTTOM",100,0); sharebtn:SetText(AL["Share"]); sharebtn:SetScript("OnClick", function() AtlasLoot:ShareWishList() end) sharebtn:Hide(); - -- Filter Button local filterbtn = CreateFrame("CheckButton","AtlasLootFilterCheck",AtlasLootItemsFrame,"OptionsCheckButtonTemplate"); filterbtn:SetPoint("BOTTOM", "AtlasLootItemsFrame", "BOTTOM",85 ,27); @@ -351,7 +380,11 @@ local function presetcreate(preset,num) if AtlasLoot:IsLootTableAvailable(AtlasLootCharDB["QuickLooks"][num][4]) then ATLASLOOT_LASTMODULE = AtlasLootCharDB["QuickLooks"][num][4]; ATLASLOOT_CURRENTTABLE = AtlasLootCharDB["QuickLooks"][num][5]; - AtlasLoot:ShowItemsFrame(AtlasLootCharDB["QuickLooks"][num][1], AtlasLootCharDB["QuickLooks"][num][2], AtlasLootCharDB["QuickLooks"][num][3]); + if AtlasLootCharDB["QuickLooks"][num][2] == "AtlasLootWishList" then + AtlasLoot:ShowWishList(AtlasLootCharDB["QuickLooks"][num][1], AtlasLootCharDB["QuickLooks"][num][3]); + else + AtlasLoot:ShowItemsFrame(AtlasLootCharDB["QuickLooks"][num][1], AtlasLootCharDB["QuickLooks"][num][2], AtlasLootCharDB["QuickLooks"][num][3]); + end end end); preset:SetScript("OnShow", function(self) @@ -458,17 +491,40 @@ local scrollFrame = CreateFrame("Frame", "Atlasloot_Difficulty_ScrollFrame", Atl scrollFrame.Lable:SetJustifyH("LEFT"); scrollFrame.Lable:SetFont("GameFontNormal", 24); -function AtlasLoot:ScrollFrameUpdate(hide) - if AtlasLoot_Difficulty then - local maxValue = #AtlasLoot_Difficulty[ATLASLOOT_CURRENTTYPE]; +function AtlasLoot:ScrollFrameUpdate(hide,wishlist) + local maxValue,offset,row,value; + scrollFrame.wishList = nil; + if wishlist then + scrollFrame.wishList = wishlist; + maxValue = #AtlasLootWishList[wishlist]; FauxScrollFrame_Update(scrollFrame.scrollBar, maxValue, MAX_ROWS, ROW_HEIGHT); - local offset = FauxScrollFrame_GetOffset(scrollFrame.scrollBar); + offset = FauxScrollFrame_GetOffset(scrollFrame.scrollBar); for i = 1, MAX_ROWS do - local value = i + offset + value = i + offset + scrollFrame.rows[i]:SetChecked(false); + scrollFrame.rows[i]:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD"); + if value <= maxValue and AtlasLootWishList[wishlist][value] then + row = scrollFrame.rows[i] + row:SetText("|cffFFd200"..AtlasLootWishList[wishlist][value].Name); + row.itemIndex = value; + if row.itemIndex == ATLASLOOT_CURRENT_WISHLIST_NUM then + row:SetChecked(true); + end + row:Show() + else + scrollFrame.rows[i]:Hide() + end + end + elseif AtlasLoot_Difficulty then + maxValue = #AtlasLoot_Difficulty[ATLASLOOT_CURRENTTYPE]; + FauxScrollFrame_Update(scrollFrame.scrollBar, maxValue, MAX_ROWS, ROW_HEIGHT); + offset = FauxScrollFrame_GetOffset(scrollFrame.scrollBar); + for i = 1, MAX_ROWS do + value = i + offset scrollFrame.rows[i]:SetChecked(false); scrollFrame.rows[i]:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD"); if value <= maxValue and AtlasLoot_Difficulty[ATLASLOOT_CURRENTTYPE][value] and hide == nil then - local row = scrollFrame.rows[i] + row = scrollFrame.rows[i] row:SetText("|cffFFd200"..AtlasLoot_Difficulty[ATLASLOOT_CURRENTTYPE][value][1]); row.itemIndex = AtlasLoot_Difficulty[ATLASLOOT_CURRENTTYPE][value][2]; if row.itemIndex == ItemindexID then @@ -483,15 +539,23 @@ function AtlasLoot:ScrollFrameUpdate(hide) end local scrollSlider = CreateFrame("ScrollFrame","AtlasLootDefaultFrameScroll", Atlasloot_Difficulty_ScrollFrame, "FauxScrollFrameTemplate"); - scrollSlider:SetPoint("TOPLEFT", 0, -8) - scrollSlider:SetPoint("BOTTOMRIGHT", -30, 8) + scrollSlider:SetPoint("TOPLEFT", 0, -8); + scrollSlider:SetPoint("BOTTOMRIGHT", -30, 8); scrollSlider:SetScript("OnVerticalScroll", function(self, offset) - self.offset = math.floor(offset / ROW_HEIGHT + 0.5) - AtlasLoot:ScrollFrameUpdate() + self.offset = math.floor(offset / ROW_HEIGHT + 0.5); + if scrollFrame.wishList then + AtlasLoot:ScrollFrameUpdate(nil,scrollFrame.wishList); + else + AtlasLoot:ScrollFrameUpdate(); + end end) scrollSlider:SetScript("OnShow", function() - AtlasLoot:ScrollFrameUpdate() + if scrollFrame.wishList then + AtlasLoot:ScrollFrameUpdate(nil,scrollFrame.wishList); + else + AtlasLoot:ScrollFrameUpdate() + end end) scrollFrame.scrollBar = scrollSlider @@ -502,11 +566,18 @@ local rows = setmetatable({}, { __index = function(t, i) row:SetNormalFontObject(GameFontHighlightLeft); row:SetCheckedTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD"); row:SetScript("OnClick", function() - ItemindexID = row.itemIndex; - if not AtlasLootDefaultFrame_AdvancedSearchPanel:IsVisible() then - AtlasLoot:ShowItemsFrame(AtlasLootItemsFrame.refresh[1], AtlasLootItemsFrame.refresh[2], AtlasLootItemsFrame.refresh[3]); + if scrollFrame.wishList then + AtlasLoot:ShowWishList(scrollFrame.wishList,row.itemIndex); + AtlasLoot_CurrentWishList["Show"].ListNum = row.itemIndex; + AtlasLoot:ScrollFrameUpdate(nil,scrollFrame.wishList); + else + ItemindexID = row.itemIndex; + if not AtlasLootDefaultFrame_AdvancedSearchPanel:IsVisible() then + AtlasLoot:ShowItemsFrame(AtlasLootItemsFrame.refresh[1], AtlasLootItemsFrame.refresh[2], AtlasLootItemsFrame.refresh[3]); + end + AtlasLoot:ScrollFrameUpdate(); end - AtlasLoot:ScrollFrameUpdate(); + end) if i == 1 then row:SetPoint("TOPLEFT", scrollFrame, 8, -8) diff --git a/AtlasLoot/Locales/constants.en.lua b/AtlasLoot/Locales/constants.en.lua index 3162e85..1c2b992 100644 --- a/AtlasLoot/Locales/constants.en.lua +++ b/AtlasLoot/Locales/constants.en.lua @@ -299,6 +299,8 @@ if AL then AL["Always use default Wishlist"] = true; AL["Add Wishlist"] = true; AL["Edit Wishlist"] = true; + AL["Sort Wishlist"] = true; + AL["Auto Sort WishLists"] = true; AL["Copy Wishlist To Own"] = true; AL["Make Wishlist Default"] = true; AL["Delete Wishlist"] = true;