diff --git a/AtlasLoot/AtlasLoot.toc b/AtlasLoot/AtlasLoot.toc index 249f274..e26e58b 100644 --- a/AtlasLoot/AtlasLoot.toc +++ b/AtlasLoot/AtlasLoot.toc @@ -43,5 +43,6 @@ Core\AtlasLoot.xml Menus\Menus.xml DefaultFrame\AtlaslootDefaultFrame.lua DefaultFrame\AtlaslootDefaultFrameCreate.lua +DefaultFrame\AtlaslootAdvancedSearchCreate.lua modules.xml diff --git a/AtlasLoot/Core/AtlasLoot.lua b/AtlasLoot/Core/AtlasLoot.lua index f387bfc..41bba72 100644 --- a/AtlasLoot/Core/AtlasLoot.lua +++ b/AtlasLoot/Core/AtlasLoot.lua @@ -481,7 +481,7 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) SearchPrevData = {dataID, dataSource, boss, pFrame, tablenum}; --If the loot table name has not been passed, throw up a debugging statement - if dataID==nil then + if dataID == nil then DEFAULT_CHAT_FRAME:AddMessage("No dataID!"); return; end @@ -491,7 +491,7 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) end --Hide Advanced search if it is up and reshow Querybutton - AtlasLootAdvancedSearch:Hide(); + AtlasLootDefaultFrame_AdvancedSearchPanel:Hide(); --Ditch the Quicklook selector AtlasLoot_QuickLooks:Hide(); @@ -502,9 +502,10 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) if dataID ~= "SearchResult" and dataID ~= "WishList" then dataSource = AtlasLoot_Data; + else + dataSource = AtlasLootCharDB; end - AtlasLoot_CurrentType = dataSource[dataID].Type or ""; AtlasLootDefaultFrame_ScrollFrameUpdate(); @@ -516,26 +517,12 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) getglobal("AtlasLootItem_"..i).spellitemID = 0; end - - - -- Create the loottable if (dataID == "SearchResult") or (dataID == "WishList") 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) - local toShow = true; + --Check for a valid object (that it exists, and that it has a name if(dataSource[dataID][tablenum][i] ~= nil and dataSource[dataID][tablenum][i][4] ~= "") then - --Checks if an item has a Minimum difficulty, this is to hide items that shouldn't show on lower difficulties - if dataSource[dataID][tablenum][i][AtlasLoot_Difficulty.MIN_DIF] then - if dataSource[dataID][tablenum][i][AtlasLoot_Difficulty.MIN_DIF] > ItemindexID then toShow = false end; - end - else - toShow = false; - end - - if(toShow) then IDfound = AL_FindId(dataSource[dataID][tablenum][i][2], ItemindexID) or dataSource[dataID][tablenum][i][2]; if string.sub(IDfound, 1, 1) == "s" then isItem = false; @@ -578,11 +565,11 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) else spellName, _, spellIcon, _, _, _, _, _, _ = GetSpellInfo(string.sub(IDfound, 2)); if spellName then - text = AtlasLoot_FixText(string.sub(dataSource[dataID][tablenum][i][4], 1, 4)..spellName); - else - text = dataSource[dataID][tablenum][i][4]; - text = AtlasLoot_FixText(text); - end + text = AtlasLoot_FixText(string.sub(dataSource[dataID][tablenum][i][4], 1, 4)..spellName); + else + text = dataSource[dataID][tablenum][i][4]; + text = AtlasLoot_FixText(text); + end end --Store data about the state of the items frame to allow minor tweaks or a recall of the current loot page @@ -592,13 +579,13 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) end --Insert the item description - if dataSource[dataID][tablenum][i][6] and dataSource[dataID][tablenum][i][6] ~= "" then - extra = dataSource[dataID][tablenum][i][6]; - elseif dataSource[dataID][tablenum][i][5] then - extra = dataSource[dataID][tablenum][i][5]; - else - extra = ""; - end + if dataSource[dataID][tablenum][i][6] and dataSource[dataID][tablenum][i][6] ~= "" then + extra = dataSource[dataID][tablenum][i][6]; + elseif dataSource[dataID][tablenum][i][5] then + extra = dataSource[dataID][tablenum][i][5]; + else + extra = ""; + end extra = AtlasLoot_FixText(extra); --Use shortcuts for easier reference to parts of the item button @@ -617,7 +604,7 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) iconFrame:SetTexture(GetItemIcon(tonumber(dataSource[dataID][tablenum][i][3]))); elseif dataSource[dataID][tablenum][i][3] == "" then iconFrame:SetTexture(spellIcon); - elseif type(dataSource[dataID][tablenum][i][3]) == "string" then + elseif type(dataSource[dataID][tablenum][i][3]) == "string" then iconFrame:SetTexture("Interface\\Icons\\"..dataSource[dataID][tablenum][i][3]); else iconFrame:SetTexture(spellIcon); @@ -627,20 +614,20 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, 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 then iconFrame:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark"); end - itemButton.name = text; - itemButton.extra = extra; + itemButton.name = text; + itemButton.extra = extra; - --Highlight items in the wishlist - if IDfound ~= "" and IDfound ~= 0 and dataID ~= "WishList" and AtlasLootWishList["Options"][UnitName("player")]["Mark"] == true then + --Highlight items in the wishlist + if IDfound ~= "" and IDfound ~= 0 and dataID ~= "WishList" and AtlasLootWishList["Options"][UnitName("player")]["Mark"] == true then local xitemexistwish, itemwishicons = AtlasLoot_WishListCheck(IDfound, true) - if xitemexistwish then - text = itemwishicons.." "..text; - end - end - --Set the name and description of the item + if xitemexistwish then + text = itemwishicons.." "..text; + end + end + --Set the name and description of the item nameFrame:SetText(text); extraFrame:SetText(extra); extraFrame:Show(); @@ -658,8 +645,8 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) itemButton.spellitemID = 0; end - end - itemButton.iteminfo = {}; + end + itemButton.iteminfo = {}; if isItem then itemButton.iteminfo.idcore = IDfound; itemButton.iteminfo.icontexture = IDfound; @@ -671,28 +658,19 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) itemButton.storeID = IDfound; itemButton.dressingroomID = IDfound; end - if dataSource[dataID][tablenum][i][5] then - itemButton.desc = dataSource[dataID][tablenum][i][5]; - else - itemButton.desc = nil; - end - if dataSource[dataID][tablenum][i][6] then - itemButton.price = dataSource[dataID][tablenum][i][6]; - else - itemButton.price = nil; - end - if dataSource[dataID][tablenum][i][7] and dataSource[dataID][tablenum][i][7] ~= "" then - itemButton.droprate = dataSource[dataID][tablenum][i][7]; - else - itemButton.droprate = nil; - end + + itemButton.desc = dataSource[dataID][tablenum][i][5] or nil; + itemButton.price = dataSource[dataID][tablenum][i][6] or nil; + itemButton.droprate = dataSource[dataID][tablenum][i][7] or nil; + if (dataID == "SearchResult" or dataID == "WishList") and dataSource[dataID][tablenum][i][8] then - itemButton.sourcePage = dataSource[dataID][tablenum][i][8]; + 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); else itemButton.sourcePage = nil; end + if dataSource[dataID][tablenum][i][AtlasLoot_Difficulty.DIF_SEARCH] then itemButton.difficulty = dataSource[dataID][tablenum][i][AtlasLoot_Difficulty.DIF_SEARCH]; else @@ -702,13 +680,12 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) itemButton.i = 1; itemButton:Show(); - if IDfound == 0 then getglobal("AtlasLootItem_"..i.."_Unsafe"):Hide(); end - - end + if IDfound == 0 then getglobal("AtlasLootItem_"..i.."_Unsafe"):Hide(); end + end end AtlasLootItemsFrame.refresh = {dataID, dataSource, boss, pFrame, tablenum}; - if dataID ~= "WishList" and dataID ~= "SearchResult" and dataID ~= "FilterList" and dataSource[dataID].Back ~= true then + if dataID ~= "WishList" and dataID ~= "FilterList" and dataID ~= "SearchResult" and dataSource[dataID].Back ~= true then AtlasLootItemsFrame.refreshOri = {dataID, dataSource, boss, pFrame, tablenum}; AtlasLoot.db.profile.LastBoss = {dataID, dataSource, boss, pFrame, tablenum, ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE}; end @@ -739,24 +716,24 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) getglobal("AtlasLootItemsFrame_NEXT"):Hide(); getglobal("AtlasLootItemsFrame_PREV"):Hide(); - AtlasLoot_BossName:SetText(dataSource[dataID][tablenum].Name); - AtlasLootDefaultFrame_SubMenu:SetText(dataSource[dataID].Name); + AtlasLoot_BossName:SetText(dataSource[dataID][tablenum].Name); + AtlasLootDefaultFrame_SubMenu:SetText(dataSource[dataID].Name); - if tablenum + 1 ~= AtlasLoot_GetNumOfRows(dataSource[dataID]) then - getglobal("AtlasLootItemsFrame_NEXT"):Show(); - if dataID ~= "FilterList" then - getglobal("AtlasLootItemsFrame_NEXT").tablenum = tablenum + 1; - end + if tablenum + 1 ~= AtlasLoot_GetNumOfRows(dataSource[dataID]) then + getglobal("AtlasLootItemsFrame_NEXT"):Show(); + if dataID ~= "FilterList" then + getglobal("AtlasLootItemsFrame_NEXT").tablenum = tablenum + 1; end - if tablenum -1 ~= 0 then - getglobal("AtlasLootItemsFrame_PREV"):Show(); - if dataID ~= "FilterList" then - getglobal("AtlasLootItemsFrame_PREV").tablenum = tablenum - 1; - end - end - if dataSource[dataID].Back then - getglobal("AtlasLootItemsFrame_BACK"):Show(); + end + if tablenum - 1 ~= 0 then + getglobal("AtlasLootItemsFrame_PREV"):Show(); + if dataID ~= "FilterList" then + getglobal("AtlasLootItemsFrame_PREV").tablenum = tablenum - 1; end + end + if dataSource[dataID].Back then + getglobal("AtlasLootItemsFrame_BACK"):Show(); + end end @@ -800,11 +777,10 @@ end AtlasLoot_NavButton_OnClick: Called when <-, -> are pressed and calls up the appropriate loot page ]] -function AtlasLoot_NavButton_OnClick() - local tablenum = this.tablenum; - AtlasLootDefaultFrame_SubTableScrollFrameUpdate(AtlasLootItemsFrame.refreshOri[1], AtlasLootItemsFrame.refreshOri[2], AtlasLootItemsFrame.refreshOri[4], tablenum); +function AtlasLoot_NavButton_OnClick(self) + local tablenum = self.tablenum; AtlasLoot_ShowItemsFrame(AtlasLootItemsFrame.refreshOri[1], AtlasLootItemsFrame.refreshOri[2], AtlasLootItemsFrame.refreshOri[3], AtlasLootItemsFrame.refreshOri[4], tablenum); - + AtlasLootDefaultFrame_SubTableScrollFrameUpdate(AtlasLootItemsFrame.refreshOri[1], AtlasLootItemsFrame.refreshOri[2], AtlasLootItemsFrame.refreshOri[4], tablenum); end --[[ diff --git a/AtlasLoot/Core/AtlasLoot.xml b/AtlasLoot/Core/AtlasLoot.xml index 8f7071e..6d18b3d 100644 --- a/AtlasLoot/Core/AtlasLoot.xml +++ b/AtlasLoot/Core/AtlasLoot.xml @@ -474,7 +474,7 @@ - AtlasLoot_NavButton_OnClick() + AtlasLoot_NavButton_OnClick(this); this:SetFrameLevel( (this:GetParent()):GetFrameLevel() + 1 ); @@ -541,7 +541,7 @@ - AtlasLoot_NavButton_OnClick() + AtlasLoot_NavButton_OnClick(this); this:SetFrameLevel( (this:GetParent()):GetFrameLevel() + 1 ); @@ -591,10 +591,19 @@ local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot"); getglobal("AtlasLootItemsFrame_BACK"):SetText(AL["Back"]); getglobal("AtlasLoot_QuickLooks"):SetText(AL["Add to QuickLooks:"]); + self:EnableMouseWheel(1); AtlasLoot_OnEvent(event, arg1, arg2); + + if(getglobal("AtlasLootItemsFrame_PREV"):IsVisible() and delta == 1) then + getglobal("AtlasLootItemsFrame_PREV"):Click(); + end + if(getglobal("AtlasLootItemsFrame_NEXT"):IsVisible() and delta == -1) then + getglobal("AtlasLootItemsFrame_NEXT"):Click(); + end + @@ -1549,444 +1558,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - this:SetAutoFocus(false); - this:SetTextInsets(0, 8, 0, 0); - - - AtlasLoot:AdvancedSearch(AtlasLootAdvancedSearch_SearchBox:GetText()); - this:ClearFocus(); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - this:SetAutoFocus(false); - this:SetTextInsets(0, 8, 0, 0); - - - this:ClearFocus(); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - this:SetAutoFocus(false); - this:SetTextInsets(0, 8, 0, 0); - - - this:ClearFocus(); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - this:SetAutoFocus(false); - this:SetTextInsets(0, 8, 0, 0); - - - this:ClearFocus(); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - this:SetAutoFocus(false); - this:SetTextInsets(0, 8, 0, 0); - - - this:ClearFocus(); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/AtlasLoot/Core/Search.lua b/AtlasLoot/Core/Search.lua index 3785c56..7a5b838 100644 --- a/AtlasLoot/Core/Search.lua +++ b/AtlasLoot/Core/Search.lua @@ -740,9 +740,9 @@ function AtlasLoot:Search(Text) local itemFilterErrorMessage = ""; if operator then itemFilterErrorMessage = [[ -Please check if you have a typo in the filter. -For help, type "/atlasloothelp". -You might also have to query the server for item informations to load them into your client's Cache.]]; + Please check if you have a typo in the filter. + For help, type "/atlasloothelp". + You might also have to query the server for item informations to load them into your client's Cache.]]; end DEFAULT_CHAT_FRAME:AddMessage(RED .. AL["AtlasLoot"] .. ": " .. WHITE .. AL["No match found for"] .. " \"" .. Text .. "\"." .. itemFilterErrorMessage); else diff --git a/AtlasLoot/Core/SearchAdvanced.lua b/AtlasLoot/Core/SearchAdvanced.lua index 62d5bb0..a839687 100644 --- a/AtlasLoot/Core/SearchAdvanced.lua +++ b/AtlasLoot/Core/SearchAdvanced.lua @@ -21,15 +21,8 @@ local BLUE = "|cff0070dd"; local ORANGE = "|cffFF8400"; local DEFAULT = "|cffFFd200"; -AdvSearchSubMenuEnabled = 0; -AdvSearchSubMenuText = ""; -AdvSearchSubMenu2Enabled = 0; -AdvSearchSubMenuText = ""; - -AdvSearchSetup = false; - AtlasLoot_FrameMenuList = { - ["EquipSubMenu"] = {AtlasLoot_EquipSubMenu, "AtlasLootAdvancedSearch_EquipSub", "Select Option", "type", ""} + ["EquipSubMenu"] = {AtlasLoot_EquipSubMenu, "AtlasLootDefaultFrame_AdvancedSearchPanel_EquipSubButton", "Select Option", "type", ""} } AtlasLoot_AdvancedSearchMenus = { @@ -181,7 +174,7 @@ AtlasLoot_AdvancedSearchArguments = { } } -AdvancedSearchOptions = { +AtlasLoot_AdvSearchOptions = { ["quality"] = "", ["equip"] = "", ["type"] = "", @@ -189,107 +182,36 @@ AdvancedSearchOptions = { } function AtlasLoot_AdvancedSearchSetup() - AtlasLoot_AdvancedSearchRegister(AtlasLoot_QualityMenu, AtlasLootAdvancedSearch_Quality, AtlasLoot_AdvancedSearchMenus["Quality"]); - AtlasLoot_AdvancedSearchRegister(AtlasLoot_EquipMenu, AtlasLootAdvancedSearch_Equip, AtlasLoot_AdvancedSearchMenus["Equip"]); - --AtlasLoot_AdvancedSearchRegister(AtlasLoot_DifficultyMenu, AtlasLootAdvancedSearch_Difficulty, AtlasLoot_AdvancedSearchMenus["Difficulty"]); - - local addArg = CreateFrame("Button", "AtlasLootAdvancedSearch_ArgumentContainerAddArgBtn", AtlasLootAdvancedSearch_ArgumentContainer, "OptionsButtonTemplate"); - addArg:SetPoint("BOTTOMLEFT", AtlasLootAdvancedSearch_ArgumentContainer, "TOPLEFT", 110, 2); - addArg:SetSize(20, 20); - addArg:SetText("+"); - addArg:SetScript("OnClick", function(self, button) - AddArgumentContainer(); - end) - - local remArg = CreateFrame("Button", "AtlasLootAdvancedSearch_ArgumentContainerRemArgBtn", AtlasLootAdvancedSearch_ArgumentContainer, "OptionsButtonTemplate") - remArg:SetPoint("LEFT", AtlasLootAdvancedSearch_ArgumentContainerAddArgBtn, "RIGHT", 10, 0); - remArg:SetSize(20, 20); - remArg:SetText("-"); - remArg:SetScript("OnClick", function(self, button) - RemoveArgumentContainer(); - end) - remArg:Disable(); + AtlasLoot_AdvancedSearchRegister(AtlasLoot_QualityMenu, AtlasLootDefaultFrame_AdvancedSearchPanel_QualityButton, AtlasLoot_AdvancedSearchMenus["Quality"]); + AtlasLoot_AdvancedSearchRegister(AtlasLoot_EquipMenu, AtlasLootDefaultFrame_AdvancedSearchPanel_EquipButton, AtlasLoot_AdvancedSearchMenus["Equip"]); + --AtlasLoot_AdvancedSearchRegister(AtlasLoot_DifficultyMenu, AtlasLootDefaultFrame_AdvancedSearchPanel_Difficulty, AtlasLoot_AdvancedSearchMenus["Difficulty"]); for n = 1, MAX_ARGUMENTS do AtlasLoot_ArgumentMenus[n] = AceLibrary("Dewdrop-2.0"); AtlasLoot_ArgumentSubMenus[n] = AceLibrary("Dewdrop-2.0"); - local btn = CreateFrame("Button", "AtlasLootAdvancedSearch_ArgumentContainer" .. tostring(n), AtlasLootAdvancedSearch_ArgumentContainer, "OptionsButtonTemplate"); - btn:SetPoint("TOPLEFT", AtlasLootAdvancedSearch_ArgumentContainer, "TOPLEFT", 0, -((n - 1) * 35)); - btn:SetSize(130, 20); - btn:SetScript("OnClick", function(self, button) - if AtlasLoot_ArgumentMenus[n]:IsOpen() then - AtlasLoot_ArgumentMenus[n]:Close(); - else - AtlasLoot_ArgumentMenus[n]:Open(self); - end - end) - btn:Hide(); - btn:SetText("Select Option"); - - local sub = CreateFrame("Button", "AtlasLootAdvancedSearch_ArgumentContainer" .. tostring(n) .. "Sub", AtlasLootAdvancedSearch_ArgumentContainer, "OptionsButtonTemplate"); - sub:SetPoint("LEFT", btn, "RIGHT", 15, 0); - sub:SetSize(130, 20); - sub:SetScript("OnClick", function(self, button) - if AtlasLoot_ArgumentSubMenus[n]:IsOpen() then - AtlasLoot_ArgumentSubMenus[n]:Close(); - else - AtlasLoot_ArgumentSubMenus[n]:Open(self); - end - end) - sub:Hide(); - sub:Disable(); - - local txt = CreateFrame("EditBox", "AtlasLootAdvancedSearch_ArgumentContainer" .. tostring(n) .. "Value", AtlasLootAdvancedSearch_ArgumentContainer, "InputBoxTemplate") - txt:SetPoint("LEFT", sub, "RIGHT", 15, 0); - txt:SetSize(65, 35); - txt:SetAutoFocus(false); - txt:SetTextInsets(0, 8, 0, 0); - txt:SetScript("OnEnterPressed", function(self) - self:ClearFocus(); - end) - txt:Hide(); - - AtlasLoot_AdvancedSearchArgumentRegister(AtlasLoot_ArgumentMenus[n], _G["AtlasLootAdvancedSearch_ArgumentContainer" .. tostring(n)], tostring(n), AtlasLoot_AdvancedSearchArguments["Arguments"]); - AtlasLoot_AdvancedSearchArgumentRegister(AtlasLoot_ArgumentSubMenus[n], _G["AtlasLootAdvancedSearch_ArgumentContainer" .. tostring(n) .. "Sub"], tostring(n), + AtlasLoot_AdvancedSearchArgumentRegister(AtlasLoot_ArgumentMenus[n], _G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(n)], tostring(n), AtlasLoot_AdvancedSearchArguments["Arguments"]); + AtlasLoot_AdvancedSearchArgumentRegister(AtlasLoot_ArgumentSubMenus[n], _G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(n) .. "Sub"], tostring(n), AtlasLoot_AdvancedSearchArguments["Operators"]); end -- Reset Search options to defualt AtlasLoot_AdvancedSearchReset(); - - AdvSearchSetup = true; end function AtlasLoot_AdvancedSearchShow() - if (AtlasLootAdvancedSearch:IsVisible()) then + if (AtlasLootDefaultFrame_AdvancedSearchPanel:IsVisible()) then AtlasLoot_AdvancedSearchClose(); return; end pFrame = {"TOPLEFT", "AtlasLootDefaultFrame_LootBackground", "TOPLEFT", "2", "-2"}; - if not (AdvSearchSetup) then - AtlasLoot_AdvancedSearchSetup() - end - -- Hide all elements that could be in the AtlasTable getglobal("AtlasLootItemsFrame_NEXT"):Hide(); getglobal("AtlasLootItemsFrame_PREV"):Hide(); getglobal("AtlasLootItemsFrame_BACK"):Hide(); - -- Clear these values to defualt - AdvSearchSubMenuEnabled = 0; - AdvSearchSubMenuText = ""; - AdvSearchSubMenu2Enabled = 0; - AdvSearchSubMenuText = ""; - - - - if AtlasLootDefaultFrame_SubMenu:IsEnabled() then - AdvSearchSubMenuEnabled = 1; - end - -- Ditch the Quicklook selector AtlasLoot_QuickLooks:Hide(); AtlasLootQuickLooksButton:Hide(); @@ -306,11 +228,11 @@ function AtlasLoot_AdvancedSearchShow() AtlasLoot_BossName:SetText("Advanced Search"); - AtlasLootAdvancedSearch:ClearAllPoints(); - AtlasLootAdvancedSearch:SetParent(pFrame[2]); - AtlasLootAdvancedSearch:ClearAllPoints(); - AtlasLootAdvancedSearch:SetPoint(pFrame[1], pFrame[2], pFrame[3], pFrame[4], pFrame[5]); - AtlasLootAdvancedSearch:Show(); + AtlasLootDefaultFrame_AdvancedSearchPanel:ClearAllPoints(); + AtlasLootDefaultFrame_AdvancedSearchPanel:SetParent(pFrame[2]); + AtlasLootDefaultFrame_AdvancedSearchPanel:ClearAllPoints(); + AtlasLootDefaultFrame_AdvancedSearchPanel:SetPoint(pFrame[1], pFrame[2], pFrame[3], pFrame[4], pFrame[5]); + AtlasLootDefaultFrame_AdvancedSearchPanel:Show(); AtlasLoot_CurrentType = "Search"; AtlasLootDefaultFrame_ScrollFrameUpdate(); @@ -318,10 +240,7 @@ function AtlasLoot_AdvancedSearchShow() end function AtlasLoot_AdvancedSearchClose() - AtlasLootAdvancedSearch:Hide(); - - AdvSearchSubMenuEnabled = 0; - AdvSearchSubMenu2Enabled = 0; + AtlasLootDefaultFrame_AdvancedSearchPanel:Hide(); if (SearchPrevData[1] ~= "") then AtlasLoot_ShowItemsFrame(SearchPrevData[1], SearchPrevData[2], SearchPrevData[3], SearchPrevData[4], SearchPrevData[5]); @@ -329,7 +248,7 @@ function AtlasLoot_AdvancedSearchClose() end function AtlasLoot_AdvancedSearchReset() - AdvancedSearchOptions = { + AtlasLoot_AdvSearchOptions = { ["quality"] = "", ["equip"] = "", ["type"] = "", @@ -337,77 +256,74 @@ function AtlasLoot_AdvancedSearchReset() } for i = 1, MAX_ARGUMENTS do - AdvancedSearchOptions["arg" .. tostring(i)] = ""; - AdvancedSearchOptions["arg" .. tostring(i) .. "op"] = ""; + AtlasLoot_AdvSearchOptions["arg" .. tostring(i)] = ""; + AtlasLoot_AdvSearchOptions["arg" .. tostring(i) .. "op"] = ""; - RemoveArgumentContainer(); + AtlasLoot_RemoveArgumentContainer(); end local expansionLevels = {60, 70, 80} - AtlasLootAdvancedSearch_LevelMin:SetText(expansionLevels[GetAccountExpansionLevel() + 1]); - AtlasLootAdvancedSearch_LevelMax:SetText(expansionLevels[GetAccountExpansionLevel() + 1]); - AtlasLootAdvancedSearch_ILevelMin:SetText(""); - AtlasLootAdvancedSearch_ILevelMax:SetText(""); + AtlasLootDefaultFrame_AdvancedSearchPanel_LevelMin:SetText(expansionLevels[GetAccountExpansionLevel() + 1]); + AtlasLootDefaultFrame_AdvancedSearchPanel_LevelMax:SetText(expansionLevels[GetAccountExpansionLevel() + 1]); + AtlasLootDefaultFrame_AdvancedSearchPanel_iLevelMin:SetText(""); + AtlasLootDefaultFrame_AdvancedSearchPanel_iLevelMax:SetText(""); - AtlasLootAdvancedSearch_Quality:SetText("Select Quality"); + AtlasLootDefaultFrame_AdvancedSearchPanel_QualityButton:SetText("Select Quality"); - AtlasLootAdvancedSearch_Equip:SetText("Select Item Type"); - AtlasLootAdvancedSearch_EquipSub:Disable(); - AtlasLootAdvancedSearch_EquipSub:SetText("Select Option") - - --AtlasLootAdvancedSearch_Difficulty:SetText("Select Difficulty"); - AtlasLootAdvancedSearch_Difficulty:Hide(); + AtlasLootDefaultFrame_AdvancedSearchPanel_EquipButton:SetText("Select Item Type"); + AtlasLootDefaultFrame_AdvancedSearchPanel_EquipSubButton:Disable(); + AtlasLootDefaultFrame_AdvancedSearchPanel_EquipSubButton:SetText("Select Option"); end -function AddArgumentContainer() +function AtlasLoot_AddArgumentContainer() if ACTIVE_ARGUMENT == MAX_ARGUMENTS then - AdvSearchArgButtonToggle() + AtlasLoot_AdvSearchArgButtonToggle() return end ACTIVE_ARGUMENT = ACTIVE_ARGUMENT + 1; - _G["AtlasLootAdvancedSearch_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT)]:Show(); - _G["AtlasLootAdvancedSearch_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT)]:SetText("Select Option"); - _G["AtlasLootAdvancedSearch_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT) .. "Sub"]:Show(); + _G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT)]:Show(); + _G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT)]:SetText("Select Option"); + _G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT) .. "Sub"]:Show(); - AdvSearchArgButtonToggle() + AtlasLoot_AdvSearchArgButtonToggle() end -function RemoveArgumentContainer() +function AtlasLoot_RemoveArgumentContainer() if ACTIVE_ARGUMENT == 0 then - AdvSearchArgButtonToggle() + AtlasLoot_AdvSearchArgButtonToggle() return end - AdvancedSearchOptions["arg" .. tostring(ACTIVE_ARGUMENT)] = ""; - AdvancedSearchOptions["arg" .. tostring(ACTIVE_ARGUMENT) .. "op"] = ""; + AtlasLoot_AdvSearchOptions["arg" .. tostring(ACTIVE_ARGUMENT)] = ""; + AtlasLoot_AdvSearchOptions["arg" .. tostring(ACTIVE_ARGUMENT) .. "op"] = ""; - _G["AtlasLootAdvancedSearch_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT)]:Hide(); - _G["AtlasLootAdvancedSearch_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT) .. "Sub"]:Disable(); - _G["AtlasLootAdvancedSearch_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT) .. "Sub"]:Hide(); - _G["AtlasLootAdvancedSearch_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT) .. "Value"]:Hide(); + _G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT)]:Hide(); + _G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT) .. "Sub"]:Disable(); + _G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT) .. "Sub"]:Hide(); + _G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT) .. "Value"]:Hide(); ACTIVE_ARGUMENT = ACTIVE_ARGUMENT - 1; - AdvSearchArgButtonToggle() + AtlasLoot_AdvSearchArgButtonToggle() end -function AdvSearchArgButtonToggle() +function AtlasLoot_AdvSearchArgButtonToggle() if ACTIVE_ARGUMENT == MAX_ARGUMENTS then - AtlasLootAdvancedSearch_ArgumentContainerAddArgBtn:Disable() + AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainerAddArgBtn:Disable() else - AtlasLootAdvancedSearch_ArgumentContainerAddArgBtn:Enable() + AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainerAddArgBtn:Enable() end if ACTIVE_ARGUMENT == 0 then - AtlasLootAdvancedSearch_ArgumentContainerRemArgBtn:Disable() + AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainerRemArgBtn:Disable() else - AtlasLootAdvancedSearch_ArgumentContainerRemArgBtn:Enable() + AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainerRemArgBtn:Enable() end end -AdvSearchDefaultText = { +AtlasLoot_AdvSearchDefaultText = { ["quality"] = "Select Quality", ["equip"] = "Select Item Type", ["type"] = "Select Option", @@ -418,15 +334,15 @@ function AtlasLoot_AdvancedSearchMenuClick(Object, VariableToSet, VariableValue, -- Setups child menus and sets search options to default if (ChildMenu ~= nil) then if (ChildMenuRegister == "Disable") then - AdvancedSearchOptions[AtlasLoot_FrameMenuList[ChildMenu][4]] = AtlasLoot_FrameMenuList[ChildMenu][5]; + AtlasLoot_AdvSearchOptions[AtlasLoot_FrameMenuList[ChildMenu][4]] = AtlasLoot_FrameMenuList[ChildMenu][5]; getglobal(AtlasLoot_FrameMenuList[ChildMenu][2]):Disable(); -- Disable assigned children menus as well if (AtlasLoot_FrameMenuList[ChildMenu][6]) then getglobal(AtlasLoot_FrameMenuList[ChildMenu][6]):Disable(); end if VariableValue == "reset" then - AdvancedSearchOptions[VariableToSet] = ""; - Object[1]:SetText(AdvSearchDefaultText[VariableToSet]); + AtlasLoot_AdvSearchOptions[VariableToSet] = ""; + Object[1]:SetText(AtlasLoot_AdvSearchDefaultText[VariableToSet]); Object[2]:Close(); getglobal(AtlasLoot_FrameMenuList[ChildMenu][2]):SetText(AtlasLoot_FrameMenuList[ChildMenu][3]) @@ -434,7 +350,7 @@ function AtlasLoot_AdvancedSearchMenuClick(Object, VariableToSet, VariableValue, end else AtlasLoot_AdvancedSearchRegister(AtlasLoot_FrameMenuList[ChildMenu][1], getglobal(AtlasLoot_FrameMenuList[ChildMenu][2]), AtlasLoot_AdvancedSearchMenus[ChildMenuRegister]); - AdvancedSearchOptions[AtlasLoot_FrameMenuList[ChildMenu][4]] = AtlasLoot_FrameMenuList[ChildMenu][5]; + AtlasLoot_AdvSearchOptions[AtlasLoot_FrameMenuList[ChildMenu][4]] = AtlasLoot_FrameMenuList[ChildMenu][5]; getglobal(AtlasLoot_FrameMenuList[ChildMenu][2]):Enable(); getglobal(AtlasLoot_FrameMenuList[ChildMenu][2]):SetText(AtlasLoot_FrameMenuList[ChildMenu][3]); -- Disable assigned children menus as well @@ -444,12 +360,12 @@ function AtlasLoot_AdvancedSearchMenuClick(Object, VariableToSet, VariableValue, end end if VariableValue == "reset" then - AdvancedSearchOptions[VariableToSet] = ""; - Object[1]:SetText(AdvSearchDefaultText[VariableToSet]); + AtlasLoot_AdvSearchOptions[VariableToSet] = ""; + Object[1]:SetText(AtlasLoot_AdvSearchDefaultText[VariableToSet]); Object[2]:Close(); return end - AdvancedSearchOptions[VariableToSet] = VariableValue; + AtlasLoot_AdvSearchOptions[VariableToSet] = VariableValue; Object[1]:SetText(Object[3]); Object[2]:Close(); end @@ -496,41 +412,41 @@ end function AtlasLoot_AdvancedSearchArgumentClick(Object, VariableToSet, VariableValue, IsOperator) if IsOperator and VariableValue == "reset" then - AdvancedSearchOptions["arg" .. VariableToSet .. "op"] = ""; + AtlasLoot_AdvSearchOptions["arg" .. VariableToSet .. "op"] = ""; - getglobal("AtlasLootAdvancedSearch_ArgumentContainer" .. VariableToSet .. "Value"):SetText(""); - getglobal("AtlasLootAdvancedSearch_ArgumentContainer" .. VariableToSet .. "Value"):Hide(); + getglobal("AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"):SetText(""); + getglobal("AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"):Hide(); Object[1]:SetText("Select Option"); Object[2]:Close(); elseif IsOperator then - AdvancedSearchOptions["arg" .. VariableToSet .. "op"] = VariableValue; + AtlasLoot_AdvSearchOptions["arg" .. VariableToSet .. "op"] = VariableValue; - getglobal("AtlasLootAdvancedSearch_ArgumentContainer" .. VariableToSet .. "Value"):Show(); + getglobal("AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"):Show(); Object[1]:SetText(Object[3]); Object[2]:Close(); elseif VariableValue == "reset" then - getglobal("AtlasLootAdvancedSearch_ArgumentContainer" .. VariableToSet .. "Sub"):SetText("Select Option"); - getglobal("AtlasLootAdvancedSearch_ArgumentContainer" .. VariableToSet .. "Sub"):Disable(); + getglobal("AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Sub"):SetText("Select Option"); + getglobal("AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Sub"):Disable(); - getglobal("AtlasLootAdvancedSearch_ArgumentContainer" .. VariableToSet .. "Value"):SetText(""); - getglobal("AtlasLootAdvancedSearch_ArgumentContainer" .. VariableToSet .. "Value"):Hide(); + getglobal("AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"):SetText(""); + getglobal("AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"):Hide(); - AdvancedSearchOptions["arg" .. VariableToSet] = ""; - AdvancedSearchOptions["arg" .. VariableToSet .. "op"] = ""; + AtlasLoot_AdvSearchOptions["arg" .. VariableToSet] = ""; + AtlasLoot_AdvSearchOptions["arg" .. VariableToSet .. "op"] = ""; Object[1]:SetText("Select Option"); Object[2]:Close(); else - getglobal("AtlasLootAdvancedSearch_ArgumentContainer" .. VariableToSet .. "Sub"):SetText("Select Option"); - getglobal("AtlasLootAdvancedSearch_ArgumentContainer" .. VariableToSet .. "Sub"):Enable(); - AdvancedSearchOptions["arg" .. VariableToSet .. "op"] = ""; + getglobal("AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Sub"):SetText("Select Option"); + getglobal("AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Sub"):Enable(); + AtlasLoot_AdvSearchOptions["arg" .. VariableToSet .. "op"] = ""; - getglobal("AtlasLootAdvancedSearch_ArgumentContainer" .. VariableToSet .. "Value"):SetText(""); - getglobal("AtlasLootAdvancedSearch_ArgumentContainer" .. VariableToSet .. "Value"):Hide(); + getglobal("AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"):SetText(""); + getglobal("AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"):Hide(); - AdvancedSearchOptions["arg" .. VariableToSet] = VariableValue; + AtlasLoot_AdvSearchOptions["arg" .. VariableToSet] = VariableValue; Object[1]:SetText(Object[3]); Object[2]:Close(); end @@ -614,8 +530,8 @@ function AtlasLoot:AdvancedSearch(Text) end local function GetTextByName(name) - if (_G["AtlasLootAdvancedSearch_" .. name]) then - return _G["AtlasLootAdvancedSearch_" .. name]:GetText() + if (_G["AtlasLootDefaultFrame_AdvancedSearchPanel_" .. name]) then + return _G["AtlasLootDefaultFrame_AdvancedSearchPanel_" .. name]:GetText() end return nil; @@ -630,51 +546,57 @@ function AtlasLoot:AdvancedSearch(Text) return "ranged"; end - if AdvancedSearchOptions["quality"] ~= "" then - advSearchString = AppendSearchString(advSearchString, "quality=" .. AdvancedSearchOptions["quality"]); + if AtlasLoot_AdvSearchOptions["quality"] ~= "" then + advSearchString = AppendSearchString(advSearchString, "quality=" .. AtlasLoot_AdvSearchOptions["quality"]); end - if AdvancedSearchOptions["equip"] ~= "" then - if AdvancedSearchOptions["equip"] == "ranged" and AdvancedSearchOptions["type"] ~= "" then - AdvancedSearchOptions["equip"] = FixRangedSlot(AdvancedSearchOptions["type"]); + if AtlasLoot_AdvSearchOptions["equip"] ~= "" then + if AtlasLoot_AdvSearchOptions["equip"] == "ranged" and AtlasLoot_AdvSearchOptions["type"] ~= "" then + AtlasLoot_AdvSearchOptions["equip"] = FixRangedSlot(AtlasLoot_AdvSearchOptions["type"]); end - advSearchString = AppendSearchString(advSearchString, "slot=" .. AdvancedSearchOptions["equip"]); + advSearchString = AppendSearchString(advSearchString, "slot=" .. AtlasLoot_AdvSearchOptions["equip"]); end - if AdvancedSearchOptions["type"] ~= "" and AdvancedSearchOptions["type"] then - advSearchString = AppendSearchString(advSearchString, "type=" .. AdvancedSearchOptions["type"]); + if AtlasLoot_AdvSearchOptions["type"] ~= "" and AtlasLoot_AdvSearchOptions["type"] then + advSearchString = AppendSearchString(advSearchString, "type=" .. AtlasLoot_AdvSearchOptions["type"]); end - if AdvancedSearchOptions["difficulty"] ~= "" and AdvancedSearchOptions["difficulty"] ~= 2 then - advSearchString = AppendSearchString(advSearchString, "dif=" .. AdvancedSearchOptions["difficulty"]); + if AtlasLoot_AdvSearchOptions["difficulty"] ~= "" and AtlasLoot_AdvSearchOptions["difficulty"] ~= 2 then + advSearchString = AppendSearchString(advSearchString, "dif=" .. AtlasLoot_AdvSearchOptions["difficulty"]); end - if (GetTextByName("LevelMin") and GetTextByName("LevelMin") ~= "") then - advSearchString = AppendSearchString(advSearchString, "minlvl>=" .. GetTextByName("LevelMin")); + if(AtlasLootDefaultFrame_AdvancedSearchPanel_LevelToggle:GetChecked()) then + if (GetTextByName("LevelMin") and GetTextByName("LevelMin") ~= "") then + advSearchString = AppendSearchString(advSearchString, "minlvl>=" .. GetTextByName("LevelMin")); + end + + if (GetTextByName("LevelMax") and GetTextByName("LevelMax") ~= "") then + advSearchString = AppendSearchString(advSearchString, "minlvl<=" .. GetTextByName("LevelMax")); + end + else + advSearchString = AppendSearchString(advSearchString, "minlvl>=" .. UnitLevel("player")); + advSearchString = AppendSearchString(advSearchString, "minlvl<=" .. UnitLevel("player")); end - if (GetTextByName("LevelMax") and GetTextByName("LevelMax") ~= "") then - advSearchString = AppendSearchString(advSearchString, "minlvl<=" .. GetTextByName("LevelMax")); - end - - if (GetTextByName("ILevelMin") and GetTextByName("ILevelMin") ~= "") then + if (GetTextByName("iLevelMin") and GetTextByName("iLevelMin") ~= "") then advSearchString = AppendSearchString(advSearchString, "ilvl>=" .. GetTextByName("ILevelMin")); end - if (GetTextByName("ILevelMax") and GetTextByName("ILevelMax") ~= "") then + if (GetTextByName("iLevelMax") and GetTextByName("iLevelMax") ~= "") then advSearchString = AppendSearchString(advSearchString, "ilvl<=" .. GetTextByName("ILevelMax")); end for i = 1, ACTIVE_ARGUMENT, 1 do - if AdvancedSearchOptions["arg" .. i] ~= "" then - local arg = _G["AtlasLootAdvancedSearch_ArgumentContainer" .. tostring(i) .. "Value"]:GetText(); - if AdvancedSearchOptions["arg" .. i .. "op"] == "" then - AdvancedSearchOptions["arg" .. i .. "op"] = ">" + if AtlasLoot_AdvSearchOptions["arg" .. i] ~= "" then + local arg = _G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(i) .. "Value"]:GetText(); + if AtlasLoot_AdvSearchOptions["arg" .. i .. "op"] == "" then + AtlasLoot_AdvSearchOptions["arg" .. i .. "op"] = ">" arg = "0"; end - advSearchString = AppendSearchString(advSearchString, AdvancedSearchOptions["arg" .. i] .. AdvancedSearchOptions["arg" .. i .. "op"] .. arg); + advSearchString = AppendSearchString(advSearchString, AtlasLoot_AdvSearchOptions["arg" .. i] .. AtlasLoot_AdvSearchOptions["arg" .. i .. "op"] .. arg); end end + AtlasLoot_AdvancedSearchClose(); AtlasLoot:Search(string.lower(advSearchString)); end diff --git a/AtlasLoot/DefaultFrame/AtlasLootAdvancedSearchCreate.lua b/AtlasLoot/DefaultFrame/AtlasLootAdvancedSearchCreate.lua new file mode 100644 index 0000000..bc44b86 --- /dev/null +++ b/AtlasLoot/DefaultFrame/AtlasLootAdvancedSearchCreate.lua @@ -0,0 +1,224 @@ +local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot"); + +local MAX_ARGUMENTS = 6; + +local framename = "AtlasLootDefaultFrame_AdvancedSearchPanel"; + +--Create Main Search Panel +local searchpanel = CreateFrame("FRAME", framename, AtlasLootDefaultFrame, nil); +searchpanel:SetPoint("CENTER", 0, 0); +searchpanel:SetSize(510, 510); +searchpanel.closebtn = CreateFrame("Button", framename.."_CloseButton", searchpanel, "UIPanelCloseButton"); +searchpanel.closebtn:SetPoint("TOPRIGHT", searchpanel, "TOPRIGHT", -10, -10); +searchpanel:Hide(); +searchpanel.closebtn:SetScript("OnClick", function() AtlasLoot_AdvancedSearchClose(); end); +searchpanel.closebtn:SetScript("OnShow", function(self) self:SetFrameLevel( (self:GetParent()):GetFrameLevel() + 1 ) end); + +--Create search/name box +local searchbox = CreateFrame("EditBox", framename.."_SearchBox", searchpanel, "InputBoxTemplate"); +searchbox:SetSize(265, 35); +searchbox:SetPoint("TOPLEFT", searchpanel, "TOPLEFT", 30, -55); +searchbox:SetMaxLetters(100); +searchbox:SetAutoFocus(false); +searchbox:SetTextInsets(0, 8, 0, 0); +searchbox.title = searchbox:CreateFontString(nil, "ARTWORK", "GameFontNormal"); +searchbox.title:SetText("Name: "); +searchbox.title:SetPoint("TOPLEFT", searchbox, "TOPLEFT", -3, 8); +searchbox:SetScript("OnEnterPressed", function(self) + AtlasLoot:AdvancedSearch(AtlasLootDefaultFrame_AdvancedSearchPanel_SearchBox:GetText()); + self:ClearFocus(); +end); +searchbox:SetScript("OnShow", function(self) self:SetFrameLevel( (self:GetParent()):GetFrameLevel() + 1 ) end); +local searchbox_string = searchbox:CreateFontString(framename.."_SearchBoxString", "ARTWORK", "GameFontNormal"); + +--Create quality button +local qualitybtn = CreateFrame("Button", framename.."_QualityButton", searchpanel, "OptionsButtonTemplate"); +qualitybtn:SetSize(130, 20); +qualitybtn:SetPoint("LEFT", searchbox, "RIGHT", 15, 0); +qualitybtn.title = qualitybtn:CreateFontString(nil, "ARTWORK", "GameFontNormal"); +qualitybtn.title:SetText("Quality: "); +qualitybtn.title:SetPoint("TOPLEFT", qualitybtn, "TOPLEFT", 3, 15); +qualitybtn:SetScript("OnClick", function(self) + if AtlasLoot_QualityMenu:IsOpen() then + AtlasLoot_QualityMenu:Close(); + else + AtlasLoot_QualityMenu:Open(self); + end +end); +qualitybtn:SetScript("OnShow", function(self) self:SetFrameLevel( (self:GetParent()):GetFrameLevel() + 1 ) end); + +--Create equip type button +local equipbtn = CreateFrame("Button", framename.."_EquipButton", searchpanel, "OptionsButtonTemplate"); +equipbtn:SetSize(130, 20); +equipbtn:SetPoint("TOPLEFT", searchbox, "BOTTOMLEFT", -8, -25); +equipbtn.title = equipbtn:CreateFontString(nil, "ARTWORK", "GameFontNormal"); +equipbtn.title:SetText("Item Type: "); +equipbtn.title:SetPoint("TOPLEFT", equipbtn, "TOPLEFT", 3, 15); + +--Create equip sub type button +equipbtn.subbtn = CreateFrame("Button", framename.."_EquipSubButton", equipbtn, "OptionsButtonTemplate"); +equipbtn.subbtn:SetSize(130, 20); +equipbtn.subbtn:SetPoint("LEFT", equipbtn, "RIGHT", 15, 0); +equipbtn.subbtn.title = equipbtn.subbtn:CreateFontString(nil, "ARTWORK", "GameFontNormal"); +equipbtn.subbtn.title:SetText("Item Subtype: "); +equipbtn.subbtn.title:SetPoint("TOPLEFT", equipbtn.subbtn, "TOPLEFT", 3, 15); + +equipbtn:SetScript("OnClick", function(self) + if AtlasLoot_EquipMenu:IsOpen() then + AtlasLoot_EquipMenu:Close(); + else + AtlasLoot_EquipMenu:Open(self); + end +end); +equipbtn:SetScript("OnShow", function(self) self:SetFrameLevel( (self:GetParent()):GetFrameLevel() + 1 ) end); +equipbtn.subbtn:SetScript("OnClick", function(self) + if AtlasLoot_EquipSubMenu:IsOpen() then + AtlasLoot_EquipSubMenu:Close(); + else + AtlasLoot_EquipSubMenu:Open(self); + end +end); +equipbtn.subbtn:SetScript("OnShow", function(self) self:SetFrameLevel( (self:GetParent()):GetFrameLevel() + 1 ) end); + +local levelminbox = CreateFrame("EditBox", framename.."_LevelMin", searchpanel, "InputBoxTemplate"); +levelminbox:SetSize(47, 35); +levelminbox:SetPoint("TOPLEFT", searchbox, "BOTTOMLEFT", 0, -70); +local lmnb = levelminbox:CreateFontString(nil, "ARTWORK", "GameFontNormal"); +levelminbox:SetMaxLetters(3); +levelminbox:SetAutoFocus(false); +levelminbox:SetTextInsets(0, 8, 0, 0); +levelminbox.title = levelminbox:CreateFontString(nil, "ARTWORK", "GameFontNormal"); +levelminbox.title:SetText("Required Level: "); +levelminbox.title:SetPoint("TOPLEFT", levelminbox, "TOPLEFT", -3, 8); + +local levelmaxbox = CreateFrame("EditBox", framename.."_LevelMax", searchpanel, "InputBoxTemplate"); +levelmaxbox:SetSize(47, 35); +levelmaxbox:SetPoint("LEFT", levelminbox, "RIGHT", 25, 0); +local lmxb = levelmaxbox:CreateFontString(nil, "ARTWORK", "GameFontNormal"); +levelmaxbox:SetMaxLetters(3); +levelmaxbox:SetAutoFocus(false); +levelmaxbox:SetTextInsets(0, 8, 0, 0); + +local ilevelminbox = CreateFrame("EditBox", framename.."_iLevelMin", searchpanel, "InputBoxTemplate"); +ilevelminbox:SetSize(47, 35); +ilevelminbox:SetPoint("LEFT", levelmaxbox, "RIGHT", 25, 0); +local ilmnb = ilevelminbox:CreateFontString(nil, "ARTWORK", "GameFontNormal"); +ilevelminbox:SetMaxLetters(3); +ilevelminbox:SetAutoFocus(false); +ilevelminbox:SetTextInsets(0, 8, 0, 0); +ilevelminbox.title = ilevelminbox:CreateFontString(nil, "ARTWORK", "GameFontNormal"); +ilevelminbox.title:SetText("Item Level: "); +ilevelminbox.title:SetPoint("TOPLEFT", ilevelminbox, "TOPLEFT", -3, 8); + +local ilevelmaxbox = CreateFrame("EditBox", framename.."_iLevelMax", searchpanel, "InputBoxTemplate"); +ilevelmaxbox:SetSize(47, 35); +ilevelmaxbox:SetPoint("LEFT", ilevelminbox, "RIGHT", 25, 0); +local ilmxb = ilevelmaxbox:CreateFontString(nil, "ARTWORK", "GameFontNormal"); +ilevelmaxbox:SetMaxLetters(3); +ilevelmaxbox:SetAutoFocus(false); +ilevelmaxbox:SetTextInsets(0, 8, 0, 0); + +local useleveltick = CreateFrame("CheckButton", framename.."_LevelToggle", searchpanel, "ChatConfigCheckButtonTemplate"); +useleveltick:SetSize(20, 20); +useleveltick:SetPoint("TOPRIGHT", levelmaxbox, "BOTTOMRIGHT", 0, 5); +useleveltick.title = useleveltick:CreateFontString(nil, "ARTWORK", "GameFontNormal"); +useleveltick.title:SetText("Use Current Lv: "); +useleveltick.title:SetPoint("TOPLEFT", levelminbox, "BOTTOMLEFT", 0, 5); + +useleveltick:SetScript("OnClick", function(self, button) + if(self:GetChecked()) then levelmaxbox:Hide(); levelminbox:Hide(); + else levelmaxbox:Show(); levelminbox:Show(); + end +end) + +local argpanel = CreateFrame("Frame", framename.."_ArgumentContainer", searchpanel); +argpanel:SetSize(450, 340); +argpanel:SetPoint("TOPLEFT", levelminbox, "BOTTOMLEFT", 0, -40); +argpanel.title = argpanel:CreateFontString(nil, "ARTWORK", "GameFontNormal"); +argpanel.title:SetText("Additional Filters: "); +argpanel.title:SetPoint("TOPLEFT", argpanel, "TOPLEFT", 0, 0); + +local addArg = CreateFrame("Button", "AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainerAddArgBtn", AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer, "OptionsButtonTemplate"); +addArg:SetPoint("TOP", useleveltick, "BOTTOM", 0, -20); +addArg:SetSize(20, 20); +addArg:SetText("+"); +addArg:SetScript("OnClick", function(self, button) + AtlasLoot_AddArgumentContainer(); +end) + +local remArg = CreateFrame("Button", "AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainerRemArgBtn", AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer, "OptionsButtonTemplate") +remArg:SetPoint("LEFT", AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainerAddArgBtn, "RIGHT", 10, 0); +remArg:SetSize(20, 20); +remArg:SetText("-"); +remArg:SetScript("OnClick", function(self, button) + AtlasLoot_RemoveArgumentContainer(); +end) +remArg:Disable(); + +for n = 1, MAX_ARGUMENTS do + local btn = CreateFrame("Button", "AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(n), AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer, "OptionsButtonTemplate"); + btn:SetPoint("TOPLEFT", AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer, "TOPLEFT", 0, -((n - 1) * 35)-20); + btn:SetSize(130, 20); + btn:SetScript("OnClick", function(self, button) + if AtlasLoot_ArgumentMenus[n]:IsOpen() then + AtlasLoot_ArgumentMenus[n]:Close(); + else + AtlasLoot_ArgumentMenus[n]:Open(self); + end + end) + btn:Hide(); + btn:SetText("Select Option"); + + local sub = CreateFrame("Button", "AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(n) .. "Sub", AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer, "OptionsButtonTemplate"); + sub:SetPoint("LEFT", btn, "RIGHT", 15, 0); + sub:SetSize(130, 20); + sub:SetScript("OnClick", function(self, button) + if AtlasLoot_ArgumentSubMenus[n]:IsOpen() then + AtlasLoot_ArgumentSubMenus[n]:Close(); + else + AtlasLoot_ArgumentSubMenus[n]:Open(self); + end + end) + sub:Hide(); + sub:Disable(); + + local txt = CreateFrame("EditBox", "AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(n) .. "Value", AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer, "InputBoxTemplate") + txt:SetPoint("LEFT", sub, "RIGHT", 15, 0); + txt:SetSize(65, 35); + txt:SetAutoFocus(false); + txt:SetTextInsets(0, 8, 0, 0); + txt:SetScript("OnEnterPressed", function(self) + self:ClearFocus(); + end) + txt:Hide(); +end + +--Search Button +local searchbtn = CreateFrame("Button", framename.."_SearchButton", searchpanel, "UIPanelButtonTemplate2"); +searchbtn:SetSize(70,32); +searchbtn:SetPoint("BOTTOMLEFT", searchpanel, "BOTTOMLEFT", 20, 20); + +searchbtn:SetScript("OnShow", function(self) + self:SetText(AL["Search"]); + self:SetFrameLevel( (self:GetParent()):GetFrameLevel() + 1 ); +end); +searchbtn:SetScript("OnClick", function() + AtlasLoot:AdvancedSearch(AtlasLootDefaultFrame_AdvancedSearchPanel_SearchBox:GetText()); + AtlasLootDefaultFrame_AdvancedSearchPanel_SearchBox:ClearFocus(); +end); + +local clearbtn = CreateFrame("Button", framename.."_ClearButton", searchpanel, "UIPanelButtonTemplate2"); +clearbtn:SetSize(70,32); +clearbtn:SetPoint("LEFT", searchbtn, "RIGHT", 20, 0); + +clearbtn:SetScript("OnShow", function(self) + self:SetText(AL["Clear"]); + self:SetFrameLevel( (self:GetParent()):GetFrameLevel() + 1 ); +end); +clearbtn:SetScript("OnClick", function() + AtlasLoot_AdvancedSearchReset(); + AtlasLootDefaultFrame_AdvancedSearchPanel_SearchBox:SetText(""); + AtlasLootDefaultFrame_AdvancedSearchPanel_SearchBox:ClearFocus(); +end); + +AtlasLoot_AdvancedSearchSetup() \ No newline at end of file diff --git a/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame.lua b/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame.lua index 5dac144..3072b4c 100644 --- a/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame.lua +++ b/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame.lua @@ -292,6 +292,11 @@ function AtlasLoot_SetNewStyle(style) "AtlasLootDefaultFrameLastResultButton", "AtlasLootDefaultFrameWishListButton", "AtlasLootDefaultFrameAdvancedSearchButton", + "AtlasLootDefaultFrame_AdvancedSearchPanel_EquipButton", + "AtlasLootDefaultFrame_AdvancedSearchPanel_EquipSubButton", + "AtlasLootDefaultFrame_AdvancedSearchPanel_QualityButton", + "AtlasLootDefaultFrame_AdvancedSearchPanel_SearchButton", + "AtlasLootDefaultFrame_AdvancedSearchPanel_ClearButton", } if style == "new" then diff --git a/AtlasLoot/DefaultFrame/AtlaslootDefaultFrameCreate.lua b/AtlasLoot/DefaultFrame/AtlaslootDefaultFrameCreate.lua index c4df693..07c9903 100644 --- a/AtlasLoot/DefaultFrame/AtlaslootDefaultFrameCreate.lua +++ b/AtlasLoot/DefaultFrame/AtlaslootDefaultFrameCreate.lua @@ -321,7 +321,7 @@ function AtlasLootDefaultFrame_ScrollFrameUpdate() end end -local scrollSlider = CreateFrame("ScrollFrame","AtlasLootDefaultFrameScroll",Atlasloot_Difficulty_ScrollFrame,"FauxScrollFrameTemplate"); +local scrollSlider = CreateFrame("ScrollFrame","AtlasLootDefaultFrameScroll", Atlasloot_Difficulty_ScrollFrame, "FauxScrollFrameTemplate"); scrollSlider:SetPoint("TOPLEFT", 0, -8) scrollSlider:SetPoint("BOTTOMRIGHT", -30, 8) scrollSlider:SetScript("OnVerticalScroll", function(self, offset) @@ -342,7 +342,7 @@ local rows = setmetatable({}, { __index = function(t, i) row:SetCheckedTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD"); row:SetScript("OnClick", function() ItemindexID = row.itemIndex; - if not AtlasLootAdvancedSearch:IsVisible() then + if not AtlasLootDefaultFrame_AdvancedSearchPanel:IsVisible() then AtlasLoot_ShowItemsFrame(AtlasLootItemsFrame.refresh[1], AtlasLootItemsFrame.refresh[2], AtlasLootItemsFrame.refresh[3], AtlasLootItemsFrame.refresh[4], AtlasLootItemsFrame.refresh[5]); end AtlasLootDefaultFrame_ScrollFrameUpdate(); @@ -373,6 +373,7 @@ local subtableFrame = CreateFrame("Frame", "Atlasloot_SubTableFrame", AtlasLootD function AtlasLootDefaultFrame_SubTableScrollFrameUpdate(tablename, dataSource, pFrame, currenttablenum) if dataSource ~= nil then + if(string.find(tablename, "SearchResult")) then tablename = "SearchResult"; end local maxValue = AtlasLoot_GetNumOfRows(dataSource[tablename]); subtableFrame.tablename = tablename; FauxScrollFrame_Update(subtableFrame.scrollBar, maxValue, MAX_ROWS2, ROW_HEIGHT);