diff --git a/AtlasLoot/Core/AtlasLoot.lua b/AtlasLoot/Core/AtlasLoot.lua index e93fd61..d6f5456 100644 --- a/AtlasLoot/Core/AtlasLoot.lua +++ b/AtlasLoot/Core/AtlasLoot.lua @@ -143,8 +143,8 @@ function AtlasLoot:OnEnable() if IsAddOnLoaded("Atlas") then AtlasLoot:LoadMapData(); ATLASLOOT_ATLASLOADED = true; - AtlasLootDefaultFrame_MapButton:Show(); - AtlasLootDefaultFrame_MapSelectButton:Show(); + AtlasLootDefaultFrame_MapButton:Enable(); + AtlasLootDefaultFrame_MapSelectButton:Enable(); end --Add the loot browser to the special frames tables to enable closing wih the ESC key @@ -230,6 +230,12 @@ function AtlasLoot:OnEnable() LibStub("LibAboutPanel").new(AL["AtlasLoot"], "AtlasLoot"); end AtlasLoot_UpdateLootBrowserScale(); + local playerName = UnitName("player"); + if AtlasLootWishList["Options"][playerName]["AutoSortWishlist"] then + AtlasLootItemsFrame_Wishlist_UnLock:Disable(); + else + AtlasLootItemsFrame_Wishlist_UnLock:Enable(); + end end function AtlasLoot_Reset(data) @@ -405,7 +411,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 @@ -450,6 +455,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 @@ -471,15 +483,33 @@ 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); + -- Finds the tablenumber to set where the difficulty slider should be. + local typeNumber = 1; + local function findTypeNumber() + for i,v in ipairs(AtlasLoot_Difficulty[dataSource[dataID].Type]) do + if v[2] == ItemindexID then + typeNumber = i; + return i; + end + end + end -- Moves the difficulty scrollslider if the difficulty has changed - if dataSource[dataID].Type and difType and #AtlasLoot_Difficulty[dataSource[dataID].Type] > 5 then + if dataSource[dataID].Type and difType and #AtlasLoot_Difficulty[dataSource[dataID].Type] > 5 and findTypeNumber() > 5 then local min, max = AtlasLootDefaultFrameScrollScrollBar:GetMinMaxValues(); - AtlasLootDefaultFrameScrollScrollBar:SetValue(ItemindexID * (max / #AtlasLoot_Difficulty[dataSource[dataID].Type])); + AtlasLootDefaultFrameScrollScrollBar:SetValue(typeNumber * (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(dataSource[dataID].ListNum * (max / #AtlasLootWishList[dataSource[dataID].ListType][dataSource[dataID].ListNum])); end --For stopping the subtable from changing if its a token table @@ -500,6 +530,14 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource_backup, tablenum) _G["AtlasLootItem_"..i].spellitemID = 0; end + -- Sets the main page lable + if dataSource[dataID][tablenum] and dataSource[dataID][tablenum].Name then + AtlasLoot_BossName:SetText(dataSource[dataID][tablenum].Name); + else + AtlasLoot_BossName:SetText("This Is Empty"); + return + end + local function getProperItemConditionals(item) isValid = false; toShow = true; @@ -548,7 +586,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 @@ -589,7 +627,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 @@ -610,7 +648,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)); @@ -629,14 +669,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; @@ -681,7 +721,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); @@ -708,8 +748,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 @@ -730,7 +773,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 @@ -741,15 +784,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 @@ -898,7 +943,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 @@ -908,8 +957,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 ); @@ -918,8 +971,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 ); @@ -928,8 +985,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..c0f7489 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_CUSTOMHEADER"); + StaticPopupDialogs.ATLASLOOT_ADD_CUSTOMHEADER.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..bc328c1 100644 --- a/AtlasLoot/Core/WishList.lua +++ b/AtlasLoot/Core/WishList.lua @@ -39,6 +39,25 @@ 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}}; + 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 + if (v[1]-(math.floor(v[1]/30)*30)) == 0 then + itemNum = 30; + else + 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 +65,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 +77,10 @@ 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}); + if AtlasLootWishList["Options"][playerName]["AutoSortWishlist"] then + AtlasLoot:SortWishList(nil,"Own", arg2); + end 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 @@ -69,6 +89,9 @@ function AtlasLoot_WishListAddDropClick(typ, arg2, arg3, arg4) return; end table.insert(AtlasLootWishList["Shared"][arg2], { #AtlasLootWishList["Shared"][arg2] + 1, itemID, itemTexture, itemName, lootPage, "", "", sourcePage}); + if AtlasLootWishList["Options"][playerName]["AutoSortWishlist"] then + AtlasLoot:SortWishList(nil,"Shared", arg2); + end DEFAULT_CHAT_FRAME:AddMessage(RED..AL["AtlasLoot"]..": "..AtlasLoot_FixText(itemName)..GREY..AL[" added to the WishList."]..WHITE.." ("..AtlasLootWishList["Shared"][arg2].Name..")"); AtlasLoot_WishListDrop:Close(1) end @@ -81,23 +104,92 @@ 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 CustomHeader +function AtlasLoot:AddItemCustomHeader(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,type,tNumb) + local sorted = {}; + local name = AtlasLootWishList[type][tNumb].Name; + local icon = AtlasLootWishList[type][tNumb].Icon; + for i,v in ipairs(AtlasLootWishList[type][tNumb]) do + local function tableCheck() + for n,t in ipairs(sorted) do + if t[2][5] == v[5] then + return t + end + end + end + if v[2] ~= 0 and tableCheck() then + table.insert(tableCheck(),v); + elseif v[2] ~= 0 then + table.insert(sorted,{{0, 0, "INV_Box_01", WHITE..v[5], ""},v}); + end + end + AtlasLootWishList[type][tNumb] = {}; + local num = 1 + for i,v in ipairs(sorted) do + for n,t in ipairs(v) do + if num ~= 1 and t[3] == "INV_Box_01" then + table.insert(AtlasLootWishList[type][tNumb],{num, 0, "Blank", WHITE.." ", ""}); + num = num + 1; + end + table.insert(AtlasLootWishList[type][tNumb],{num,t[2],t[3],t[4],t[5],t[6],t[7],t[8]}); + num = num + 1; + end + end + AtlasLootWishList[type][tNumb].Name = name; + AtlasLootWishList[type][tNumb].Icon = icon; + if refresh then + AtlasLoot:ShowWishList(type, tNumb); + end +end + -- Opens add wishlist name/icon window function AtlasLoot:AddWishList() AtlasLootWishList_AddFrame:Show(); @@ -113,15 +205,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 +221,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 +229,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 +349,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 +467,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(true,AtlasLoot_CurrentWishList["Show"].ListType,AtlasLoot_CurrentWishList["Show"].ListNum) 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 +534,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 +619,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 +705,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 +716,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 +890,28 @@ 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; + AtlasLootItemsFrame_Wishlist_UnLock:Enable(); + else + AtlasLootWishList["Options"][playerName]["AutoSortWishlist"] = true; + AtlasLootItemsFrame_Wishlist_UnLock:Disable(); + end + end) InterfaceOptions_AddCategory(WishlistOptionsFrame) OptionsLoadet = true @@ -926,7 +1047,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 +1060,24 @@ StaticPopupDialogs["ATLASLOOT_SEND_WISHLIST"] = { whileDead = 1, hideOnEscape = 1 }; + +--[[ +StaticPopupDialogs["ATLASLOOT_ADD_CUSTOMHEADER"] +This is shown, if you want too add a CustomHeader to a wishlist +]] +StaticPopupDialogs["ATLASLOOT_ADD_CUSTOMHEADER"] = { + text = "Add text for a Custom Header 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:AddItemCustomHeader(StaticPopupDialogs.ATLASLOOT_ADD_CUSTOMHEADER.num,text); + end, + hasEditBox = 1, + timeout = 0, + whileDead = 1, + hideOnEscape = 1 +}; diff --git a/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame.lua b/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame.lua index 7aec4b5..63a5a02 100644 --- a/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame.lua +++ b/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame.lua @@ -35,28 +35,11 @@ Called whenever the loot browser is shown and sets up buttons and loot tables function AtlasLootDefaultFrame_OnShow() --Definition of where I want the loot table to be shown --Remove the selection of a loot table in Atlas - AtlasLootItemsFrame.activeBoss = nil; - -- checks to see if there is an instance to auto load its loottable - local function findInstance() - for i,v in pairs(AtlasLoot_SubMenus) do - for n,t in ipairs(v) do - if t[4] == BabbleZone[GetRealZoneText()] then - ATLASLOOT_CURRENTTABLE = v.SubMenu; - ATLASLOOT_LASTMODULE = v.Module; - AtlasLoot:IsLootTableAvailable(ATLASLOOT_LASTMODULE); - AtlasLoot:ShowItemsFrame(t[2], "AtlasLoot_Data", 1); - AtlasLoot_DewdropSubMenu:Unregister(AtlasLootDefaultFrame_SubMenu); - AtlasLoot:DewdropSubMenuRegister(AtlasLoot_SubMenus[ATLASLOOT_CURRENTTABLE]); - AtlasLoot:WishListOptionsRegister(); - return true; - end - end - end - end + AtlasLootItemsFrame.activeBoss = nil; --Set the item table to the loot table --Show the last displayed loot table local lastboss = AtlasLoot.db.profile.LastBoss; - if AtlasLoot.db.profile.AutoCurrentInstance and findInstance() then elseif lastboss and lastboss[4] then + if AtlasLoot.db.profile.AutoCurrentInstance and AtlasLoot:ShowInstance() then elseif lastboss and lastboss[4] then ATLASLOOT_CURRENTTABLE = lastboss[5]; ATLASLOOT_LASTMODULE = lastboss[4]; AtlasLoot:IsLootTableAvailable(lastboss[4]); @@ -69,6 +52,24 @@ function AtlasLootDefaultFrame_OnShow() end end +-- Show the Instance you are in +function AtlasLoot:ShowInstance() + for i,v in pairs(AtlasLoot_SubMenus) do + for n,t in ipairs(v) do + if t[4] == BabbleZone[GetRealZoneText()] then + ATLASLOOT_CURRENTTABLE = v.SubMenu; + ATLASLOOT_LASTMODULE = v.Module; + AtlasLoot:IsLootTableAvailable(ATLASLOOT_LASTMODULE); + AtlasLoot:ShowItemsFrame(t[2], "AtlasLoot_Data", 1); + AtlasLoot_DewdropSubMenu:Unregister(AtlasLootDefaultFrame_SubMenu); + AtlasLoot:DewdropSubMenuRegister(AtlasLoot_SubMenus[ATLASLOOT_CURRENTTABLE]); + AtlasLoot:WishListOptionsRegister(); + return true; + end + end + end +end + --[[ AtlasLootDefaultFrame_OnHide: When we close the loot browser, re-bind the item table to Atlas @@ -306,6 +307,7 @@ function AtlasLoot:SetNewStyle(style) "AtlasLootDefaultFrame_AdvancedSearchPanel_ClearButton", "AtlasLootDefaultFrame_MapButton", "AtlasLootDefaultFrame_MapSelectButton", + "AtlasLootDefaultFrame_LoadInstanceButton", } if style == "new" then diff --git a/AtlasLoot/DefaultFrame/AtlaslootDefaultFrameCreate.lua b/AtlasLoot/DefaultFrame/AtlaslootDefaultFrameCreate.lua index 112c131..02afffe 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 Custom Header"); + 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 @@ -499,14 +563,22 @@ scrollFrame.scrollBar = scrollSlider local rows = setmetatable({}, { __index = function(t, i) local row = CreateFrame("CheckButton", "$parentRow"..i, scrollFrame) row:SetSize(230, ROW_HEIGHT); + row:SetFrameStrata("Dialog"); 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) @@ -584,8 +656,9 @@ local scrollSlider2 = CreateFrame("ScrollFrame","AtlasLootDefaultFrameSubTableSc local rows2 = setmetatable({}, { __index = function(t, i) local row = CreateFrame("CheckButton", "$parentRow"..i, subtableFrame) - row:SetSize(230, ROW_HEIGHT) - row:SetNormalFontObject(GameFontHighlightLeft) + row:SetSize(230, ROW_HEIGHT); + row:SetFrameStrata("Dialog"); + row:SetNormalFontObject(GameFontHighlightLeft); row:SetCheckedTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD"); row.Text = row:CreateFontString("$parentRow"..i.."Text","OVERLAY","GameFontNormal"); row.Text:SetSize(230, ROW_HEIGHT); @@ -631,7 +704,6 @@ local mapbtn = CreateFrame("Button","AtlasLootDefaultFrame_MapButton", AtlasLoot mapbtn:SetPoint("BOTTOMLEFT",Atlasloot_SubTableFrame,0,-27.5); mapbtn:SetText("Map"); mapbtn:SetScript("OnClick", function() AtlasLoot:MapOnShow(); end) - mapbtn:Hide(); -- Map Select Button local mapSelbtn = CreateFrame("Button","AtlasLootDefaultFrame_MapSelectButton", AtlasLootDefaultFrame,"OptionsButtonTemplate"); @@ -645,4 +717,10 @@ local mapSelbtn = CreateFrame("Button","AtlasLootDefaultFrame_MapSelectButton", end end); mapSelbtn:SetText("No Map"); - mapSelbtn:Hide(); \ No newline at end of file + + -- Load Current Instance Button +local currentInstance = CreateFrame("Button","AtlasLootDefaultFrame_LoadInstanceButton", AtlasLootDefaultFrame,"OptionsButtonTemplate"); + currentInstance:SetSize(283,24); + currentInstance:SetPoint("BOTTOMRIGHT",Atlasloot_SubTableFrame,10,-58); + currentInstance:SetScript("OnClick", function() AtlasLoot:ShowInstance(); end) + currentInstance:SetText("Load Current Instance"); \ No newline at end of file diff --git a/AtlasLoot/Locales/constants.en.lua b/AtlasLoot/Locales/constants.en.lua index 629b0b7..6da31e1 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;