diff --git a/ARLFrame.lua b/ARLFrame.lua
index b221b3b..50909fc 100644
--- a/ARLFrame.lua
+++ b/ARLFrame.lua
@@ -410,390 +410,382 @@ end
-- Expected result:
-- Input:
-- Output:
--- This sets the tooltip on the button during a recipelist update
-local function SetRecipeButtonTooltip(bIndex)
+local function GenerateTooltipContent(owner, rIndex, playerFaction, exclude)
- local pButton = addon.PlusListButton[bIndex]
- local rButton = addon.RecipeListButton[bIndex]
- local dStringIndex = rButton.sI
- local rIndex = DisplayStrings[dStringIndex].sID
- local playerFaction = playerData.playerFaction
- local exclude = addon.db.profile.exclusionlist
+ local clr1, clr2 = "", ""
- pButton:SetScript("OnEnter",
- function (pButton)
- GenerateTooltipContent(pButton, rIndex, playerFaction, exclude)
- end
- )
+ arlTooltip:ClearLines()
+ arlTooltip:SetOwner(owner, "ANCHOR_RIGHT")
+ gttAdd(0, 1, 0, 0, recipeDB[rIndex]["Name"], addon:hexcolor("HIGH"))
- pButton:SetScript("OnLeave",
- function()
- arlTooltip:Hide()
- arlTooltip2:Hide()
- end
- )
+ -- check if the recipe is excluded
+ if (exclude[rIndex] == true) then
- rButton:SetScript("OnEnter",
- function (rButton)
- GenerateTooltipContent(rButton, rIndex, playerFaction, exclude)
- end
- )
+ clr1 = addon:hexcolor("RED")
+ gttAdd(0, -1, 1, 0, L["RECIPE_EXCLUDED"], clr1)
- rButton:SetScript("OnLeave",
- function()
- arlTooltip:Hide()
- arlTooltip2:Hide()
- end
- )
+ end
-end
+ -- Add in skill level requirement, colored correctly
+ clr1 = addon:hexcolor("NORMAL")
+ local recipeSkill = recipeDB[rIndex]["Level"]
+ local playerSkill = playerData.playerProfessionLevel
--- Description:
--- Expected result:
--- Input:
--- Output:
+ if (recipeSkill > playerSkill) then
-local function CheckDisplayFaction(filterDB, faction)
+ clr2 = addon:hexcolor("RED")
- if (filterDB.general.faction ~= true) then
+ elseif ((playerSkill - recipeSkill) < 20) then
- if ((faction == BFAC[myFaction]) or (faction == BFAC["Neutral"]) or (faction == nil)) then
+ clr2 = addon:hexcolor("ORANGE")
- return true
- else
+ elseif ((playerSkill - recipeSkill) < 30) then
- return false
+ clr2 = addon:hexcolor("YELLOW")
- end
+ elseif ((playerSkill - recipeSkill) < 40) then
+
+ clr2 = addon:hexcolor("GREEN")
else
- return true
+ clr2 = addon:hexcolor("MIDGREY")
end
-end
+ gttAdd(0, -1, 0, 0, L["Required Skill"] .. " :", clr1, recipeDB[rIndex]["Level"], clr2)
--- Description:
--- Expected result:
--- Input:
--- Output:
--- Scrollframe update stuff
+ -- spacer
+ gttAdd(0, 0, 0, 0, ".", addon:hexcolor("BLACK"))
-local function RecipeList_Update()
+ -- Binding info
+ clr1 = addon:hexcolor("NORMAL")
- -- Clear out the current buttons
- for i = 1, maxVisibleRecipes do
+ if (recipeDB[rIndex]["Flags"][36]) then
- addon.RecipeListButton[i]:SetText("")
- addon.RecipeListButton[i].sI = 0
- addon.PlusListButton[i]:Hide()
- ClearRecipeButtonTooltip(i)
+ gttAdd(0, -1, 1, 0, L["BOEFilter"], clr1)
end
- local entries = #DisplayStrings
+ if (recipeDB[rIndex]["Flags"][37]) then
- FauxScrollFrame_Update(ARL_RecipeScrollFrame, entries, maxVisibleRecipes, 16)
+ gttAdd(0, -1, 1, 0, L["BOPFilter"], clr1)
- if (entries > 0) then
+ end
- -- now fill in our buttons
- local listOffset = FauxScrollFrame_GetOffset(ARL_RecipeScrollFrame)
- local buttonIndex = 1
- local stringsIndex = buttonIndex + listOffset
+ if (recipeDB[rIndex]["Flags"][38]) then
- local stayInLoop = true
+ gttAdd(0, -1, 1, 0, L["BOAFilter"], clr1)
- while (stayInLoop == true) do
+ end
- if (DisplayStrings[stringsIndex].IsRecipe) then
+ if (recipeDB[rIndex]["Flags"][40]) then
- -- display the + symbol
- addon.PlusListButton[buttonIndex]:Show()
+ gttAdd(0, -1, 1, 0, L["RecipeBOEFilter"], clr1)
- -- Is it expanded or not?
- if (DisplayStrings[stringsIndex].IsExpanded) then
+ end
- addon.PlusListButton[buttonIndex]:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up")
- addon.PlusListButton[buttonIndex]:SetPushedTexture("Interface\\Buttons\\UI-MinusButton-Down")
- addon.PlusListButton[buttonIndex]:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
- addon.PlusListButton[buttonIndex]:SetDisabledTexture("Interface\\Buttons\\UI-MinusButton-Disabled")
+ if (recipeDB[rIndex]["Flags"][41]) then
- else
+ gttAdd(0, -1, 1, 0, L["RecipeBOPFilter"], clr1)
- addon.PlusListButton[buttonIndex]:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up")
- addon.PlusListButton[buttonIndex]:SetPushedTexture("Interface\\Buttons\\UI-PlusButton-Down")
- addon.PlusListButton[buttonIndex]:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
- addon.PlusListButton[buttonIndex]:SetDisabledTexture("Interface\\Buttons\\UI-PlusButton-Disabled")
+ end
- end
+ if (recipeDB[rIndex]["Flags"][42]) then
- else
+ gttAdd(0, -1, 1, 0, L["RecipeBOAFilter"], clr1)
- addon.PlusListButton[buttonIndex]:Hide()
+ end
- end
+ -- spacer
+ gttAdd(0, 0, 0, 0, ".", addon:hexcolor("BLACK"))
- addon.RecipeListButton[buttonIndex]:SetText(DisplayStrings[stringsIndex].String)
- addon.RecipeListButton[buttonIndex].sI = stringsIndex
+ -- obtain info
+ gttAdd(0, -1, 0, 0, L["Obtained From"] .. " : ", addon:hexcolor("NORMAL"))
- -- Set the tooltip on the button
- SetRecipeButtonTooltip(buttonIndex)
+ -- loop through acquire methods, display each
+ for k, v in pairs(recipeDB[rIndex]["Acquire"]) do
- buttonIndex = buttonIndex + 1
- stringsIndex = stringsIndex + 1
+ -- Trainer
+ if (v["Type"] == 1) then
- if ((buttonIndex > maxVisibleRecipes) or (stringsIndex > entries)) then
+ -- Trainer: TrainerName
+ -- TrainerZone TrainerCoords
+ local trnr = trainerDB[v["ID"]]
+ local cStr = ""
+ -- Do we want to display this trainer?
+ local displaytt = false
- stayInLoop = false
+ clr1 = addon:hexcolor("TRAINER")
- end
+ if (trnr["Faction"] == BFAC["Horde"]) then
- end
+ clr2 = addon:hexcolor("HORDE")
- -- Entries are 0 here, so we have 0 to display
- else
+ if (playerFaction == BFAC["Horde"]) then
- -- If the recipe total is at 0, it means we have not scanned the profession yet
- if (playerData.recipes_total == 0) then
+ displaytt = true
- StaticPopup_Show("ARL_NOTSCANNED")
+ end
- -- We know all the recipes
- elseif (playerData.recipes_known == playerData.recipes_total) then
+ elseif (trnr["Faction"] == BFAC["Alliance"]) then
- StaticPopup_Show("ARL_ALLKNOWN")
+ clr2 = addon:hexcolor("ALLIANCE")
- -- Our filters are actually filtering something
- elseif ((playerData.recipes_total_filtered - playerData.recipes_known_filtered) ~= 0) then
+ if (playerFaction == BFAC["Alliance"]) then
- StaticPopup_Show("ARL_ALLFILTERED")
+ displaytt = true
- -- Our exclusion list is preventing something from being displayed
- elseif (playerData.excluded_recipes_unknown ~= 0) then
+ end
- StaticPopup_Show("ARL_ALLEXCLUDED")
+ else
- else
+ clr2 = addon:hexcolor("NEUTRAL")
- addon:Print(L["NO_DISPLAY"])
+ end
- end
+ if (displaytt) then
- end
+ -- Add the trainer information to the tooltip
+ gttAdd(0, -2, 0, 0, L["Trainer"], clr1, trnr["Name"], clr2)
- -- Make sure our apply button gets disabled
- ApplyFilterState = nil
- ARL_ApplyButton:SetNormalFontObject("GameFontDisableSmall")
- ARL_ApplyButton:Disable()
-
-end
+ -- If we have a coordinate, add the coordinates to the tooltop
+ if (trnr["Coordx"] ~= 0) and (trnr["Coordy"] ~= 0) then
--- Under various conditions, I'm going to have to redisplay my recipe list
--- This could happen because a filter changes, a new profession is chosen, or
--- a new search occurred. Use this function to do all the dirty work
+ cStr = "(" .. trnr["Coordx"] .. ", " .. trnr["Coordy"] .. ")"
--- Description:
--- Expected result:
--- Input:
--- Output:
+ end
-local function ReDisplay()
+ clr1 = addon:hexcolor("NORMAL")
+ clr2 = addon:hexcolor("HIGH")
+ gttAdd(1, -2, 1, 0, trnr["Location"], clr1, cStr, clr2)
- addon:UpdateFilters(recipeDB, allSpecTable, playerData)
- sortedRecipeIndex = addon:SortMissingRecipes(recipeDB)
+ end
- if (not addon.db.profile.ignoreexclusionlist) then
+ -- Vendor
+ elseif (v["Type"] == 2) then
- addon:GetExclusions(recipeDB)
+ -- Vendor: VendorName
+ -- VendorZone VendorCoords
+ local vndr = vendorDB[v["ID"]]
+ local cStr = ""
- end
+ if (vndr["Coordx"] ~= 0) and (vndr["Coordy"] ~= 0) then
- initDisplayStrings()
+ cStr = "(" .. vndr["Coordx"] .. ", " .. vndr["Coordy"] .. ")"
- SetProgressBar(playerData)
+ end
- -- Make sure our expand all button is set to expandall
- ARL_ExpandButton:SetText(L["EXPANDALL"])
- addon:TooltipDisplay(ARL_ExpandButton, L["EXPANDALL_DESC"])
+ clr1 = addon:hexcolor("VENDOR")
- -- And update our scrollframe
- RecipeList_Update()
+ if (vndr["Faction"] == BFAC["Horde"]) then
+ clr2 = addon:hexcolor("HORDE")
+ elseif (vndr["Faction"] == BFAC["Alliance"]) then
+ clr2 = addon:hexcolor("ALLIANCE")
+ else
+ clr2 = addon:hexcolor("NEUTRAL")
+ end
-end
+ gttAdd(0, -1, 0, 0, L["Vendor"], clr1, vndr["Name"], clr2)
+ clr1 = addon:hexcolor("NORMAL")
+ clr2 = addon:hexcolor("HIGH")
+ gttAdd(1, -2, 1, 0, vndr["Location"], clr1, cStr, clr2)
--- Description:
--- Expected result:
--- Input:
--- Output:
+ -- Mob Drop
+ elseif (v["Type"] == 3) then
-function addon:CreateScanButton()
+ -- Mob Drop: Mob Name
+ -- MobZone MobCoords
+ local mob = mobDB[v["ID"]]
+ local cStr = ""
- -- Create the scan button
- if (not addon.ScanButton) then
-
- addon.ScanButton = CreateFrame("Button","addon.ScanButton",UIParent,"UIPanelButtonTemplate")
+ if (mob["Coordx"] ~= 0) and (mob["Coordy"] ~= 0) then
- end
+ cStr = "(" .. mob["Coordx"] .. ", " .. mob["Coordy"] .. ")"
- -- Add to Skillet interface
- if (Skillet and Skillet:IsActive()) then
+ end
- addon.ScanButton:SetParent(SkilletFrame)
- addon.ScanButton:Show()
- Skillet:AddButtonToTradeskillWindow(addon.ScanButton)
- addon.ScanButton:SetWidth(80)
+ clr1 = addon:hexcolor("MOBDROP")
+ clr2 = addon:hexcolor("HORDE")
+ gttAdd(0, -1, 0, 0, L["Mob Drop"], clr1, mob["Name"], clr2)
+ clr1 = addon:hexcolor("NORMAL")
+ clr2 = addon:hexcolor("HIGH")
+ gttAdd(1, -2, 1, 0, mob["Location"], clr1, cStr, clr2)
- end
+ -- Quest
+ elseif (v["Type"] == 4) then
- -- Set some of the common button properties
- addon.ScanButton:SetHeight(20)
- addon.ScanButton:RegisterForClicks("LeftButtonUp")
- addon.ScanButton:SetScript("OnClick",
- function()
- addon:ToggleFrame()
- end
- )
+ -- Quest: QuestName
+ -- QuestZone QuestCoords
+ local qst = questDB[v["ID"]]
- addon.ScanButton:SetScript("OnEnter",
- function(this)
- GameTooltip_SetDefaultAnchor(GameTooltip, this)
- GameTooltip:SetText(L["SCAN_RECIPES_DESC"])
- GameTooltip:Show()
- end
- )
+ if (qst ~= nil) then
- addon.ScanButton:SetScript("OnLeave",
- function()
- GameTooltip:Hide()
- end
- )
+ local cStr = ""
- addon.ScanButton:SetText(L["Scan"])
+ if (qst["Coordx"] ~= 0) and (qst["Coordy"] ~= 0) then
- local buttonparent = addon.ScanButton:GetParent()
- local framelevel = buttonparent:GetFrameLevel()
- local framestrata = buttonparent:GetFrameStrata()
+ cStr = "(" .. qst["Coordx"] .. ", " .. qst["Coordy"] .. ")"
- -- Set the frame level of the button to be 1 deeper than its parent
- addon.ScanButton:SetFrameLevel(framelevel + 1)
- addon.ScanButton:SetFrameStrata(framestrata)
+ end
- addon.ScanButton:Enable()
+ clr1 = addon:hexcolor("QUEST")
-end
+ if (qst["Faction"] == BFAC["Horde"]) then
+ clr2 = addon:hexcolor("HORDE")
+ elseif (qst["Faction"] == BFAC["Alliance"]) then
+ clr2 = addon:hexcolor("ALLIANCE")
+ else
+ clr2 = addon:hexcolor("NEUTRAL")
+ end
--- Description:
--- Expected result:
--- Input:
--- Output:
+ gttAdd(0, -1, 0, 0, L["Quest"], clr1, qst["Name"], clr2)
+ clr1 = addon:hexcolor("NORMAL")
+ clr2 = addon:hexcolor("HIGH")
+ gttAdd(1, -2, 1, 0, qst["Location"], clr1, cStr, clr2)
-function addon:ShowScanButton()
+ end
- -- Anchor to ATSW
- if (ATSWFrame) then
+ -- Seasonal
+ elseif (v["Type"] == 5) then
- addon.ScanButton:SetParent(ATSWFrame)
- addon.ScanButton:ClearAllPoints()
- addon.ScanButton:SetPoint("RIGHT", ATSWOptionsButton, "LEFT", 0, 0)
- addon.ScanButton:SetHeight(ATSWOptionsButton:GetHeight())
- addon.ScanButton:SetWidth(90)
+ -- Seasonal: SeasonEventName
+ local ssnname = seasonDB[v["ID"]]["Name"]
- -- Anchor to trade window
- else
+ clr1 = addon:hexcolor("SEASON")
+ gttAdd(0, -1, 0, 0, L["Seasonal"], clr1, ssnname, clr1)
- addon.ScanButton:SetParent(TradeSkillFrame)
- addon.ScanButton:ClearAllPoints()
- addon.ScanButton:SetPoint("RIGHT",TradeSkillFrameCloseButton,"LEFT",4,0)
- addon.ScanButton:SetWidth(addon.ScanButton:GetTextWidth() + 10)
+ -- Reputation
+ elseif (v["Type"] == 6) then
- end
+ -- Reputation: Faction
+ -- FactionLevel RepVendor
+ -- RepVendorZone RepVendorCoords
- addon.ScanButton:Show()
+ local repfac = repDB[v["ID"]]
+ local repname = repfac["Name"] -- name
+ local rplvl = v["RepLevel"]
+ local repvndr = vendorDB[v["RepVendor"]]
+ local cStr = ""
-end
+ if (repvndr["Coordx"] ~= 0) and (repvndr["Coordy"] ~= 0) then
--- Description:
--- Expected result:
--- Input:
--- Output:
+ cStr = "(" .. repvndr["Coordx"] .. ", " .. repvndr["Coordy"] .. ")"
-function addon:TooltipDisplay(this, textLabel)
+ end
+
+ clr1 = addon:hexcolor("REP")
+ clr2 = addon:hexcolor("NORMAL")
+ gttAdd(0, -1, 0, 0, L["Reputation"], clr1, repname, clr2)
- this:SetScript("OnEnter",
- function (this)
- GameTooltip_SetDefaultAnchor(GameTooltip, this)
- GameTooltip:SetText(textLabel, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b)
- GameTooltip:Show()
+ local rStr = ""
+ if (rplvl == 0) then
+ rStr = BFAC["Neutral"]
+ clr1 = addon:hexcolor("NEUTRAL")
+ elseif (rplvl == 1) then
+ rStr = BFAC["Neutral"]
+ clr1 = addon:hexcolor("FRIENDLY")
+ elseif (rplvl == 2) then
+ rStr = BFAC["Honored"]
+ clr1 = addon:hexcolor("HONORED")
+ elseif (rplvl == 3) then
+ rStr = BFAC["Revered"]
+ clr1 = addon:hexcolor("REVERED")
+ else
+ rStr = BFAC["Exalted"]
+ clr1 = addon:hexcolor("EXALTED")
end
- )
- this:SetScript("OnLeave",
- function(this)
- GameTooltip:Hide()
+ if (repvndr["Faction"] == BFAC["Horde"]) then
+ clr2 = addon:hexcolor("HORDE")
+ elseif (repvndr["Faction"] == BFAC["Alliance"]) then
+ clr2 = addon:hexcolor("ALLIANCE")
+ else
+ clr2 = addon:hexcolor("NEUTRAL")
end
- )
-end
+ gttAdd(1, -2, 0, 0, rStr, clr1, repvndr["Name"], clr2)
+ clr1 = addon:hexcolor("NORMAL")
+ clr2 = addon:hexcolor("HIGH")
+ gttAdd(2, -2, 1, 0, repvndr["Location"], clr1, cStr, clr2)
--- Description:
--- Expected result:
--- Input:
--- Output:
+ -- World Drop
+ elseif (v["Type"] == 7) then
-function addon.numFilters()
+ -- World Drop RarityLevel
+ if (v["ID"] == 1) then
- -- IMPORTANT: If the number of filters we're maintaining changes, you'll need to change the FilterValueMap
- -- at the end (of CreateFrame), as well as the following index value:
- local MaxFilters = 87
+ clr1 = addon:hexcolor("COMMON")
- local total = 0
- local active = 0
+ elseif (v["ID"] == 2) then
- for i = 1, MaxFilters do
- if ((FilterValueMap[i].svroot == "disabled") or
- (FilterValueMap[i].svroot == "special case")) then
- -- ignore these filters in the totals
- elseif (FilterValueMap[i].svroot[ FilterValueMap[i].svval ] == true) then
- active = active + 1
- total = total + 1
+ clr1 = addon:hexcolor("UNCOMMON")
+
+ elseif (v["ID"] == 3) then
+
+ clr1 = addon:hexcolor("RARE")
+
+ elseif (v["ID"] == 4) then
+
+ clr1 = addon:hexcolor("EPIC")
+
+ else
+
+ clr1 = addon:hexcolor("NORMAL")
+
+ end
+
+ gttAdd(0, -1, 0, 0, L["World Drop"], clr1)
+
+ -- Custom entry
+ elseif (v["Type"] == 8) then
+
+ -- Seasonal: SeasonEventName
+ local customname = customDB[v["ID"]]["Name"]
+
+ clr1 = addon:hexcolor("NORMAL")
+ gttAdd(0, -1, 0, 0, customname, clr1)
+
+ -- Unhandled
else
- total = total + 1
+
+ clr1 = addon:hexcolor("NORMAL")
+ gttAdd(0, -1, 0, 0, L["Unhandled Recipe"], clr1)
+
end
- end
- return active, total
-end
+ end
--- Description:
--- Expected result:
--- Input:
--- Output:
+ -- Spacer
+ gttAdd(0, 0, 0, 0, ".", addon:hexcolor("BLACK"))
-function addon.resetTitle()
+ clr1 = addon:hexcolor("NORMAL")
- -- reset the frame title line
- local myTitle = ""
- local addonversion = GetAddOnMetadata("AckisRecipeList", "Version")
+ gttAdd(0, -1, 0, 0, L["ALT_CLICK"], clr1)
+ gttAdd(0, -1, 0, 1, L["CTRL_CLICK"], clr1)
+ gttAdd(0, -1, 0, 1, L["SHIFT_CLICK"], clr1)
- if (addon.Frame._Expanded == true) then
+ local spelllink = recipeDB[rIndex]["RecipeLink"]
- local aFil, tFil = addon.numFilters()
+ if (spelllink) then
- myTitle = "ARL (v." .. addonversion .. ") - " .. currentProfession ..
- " (" .. aFil .. "/" .. tFil .. " " .. L["Filters"] .. ")"
+ arlTooltip2:SetOwner(arlTooltip, "ANCHOR_NONE")
+-- arlTooltip2:ClearAllPoints()
+ --arlTooltip2:SetPoint("TOPLEFT", arlTooltip, "TOPRIGHT")
+ arlTooltip2:SetPoint("TOPRIGHT", arlTooltip, "TOPLEFT")
+ arlTooltip2:SetHyperlink(spelllink)
+ arlTooltip2:Show()
else
- myTitle = "ARL (v." .. addonversion .. ") - " .. currentProfession
+ arlTooltip2:Hide()
end
- addon.Frame.HeadingText:SetText(addon:Normal(myTitle))
+ arlTooltip:Show()
end
@@ -801,210 +793,68 @@ end
-- Expected result:
-- Input:
-- Output:
+-- This sets the tooltip on the button during a recipelist update
-function addon.filterSwitch(val)
-
- -- This function is the all-encompassing checkbox handler for the ZJGUI
- local armordb = addon.db.profile.filters.item.armor
- local weapondb = addon.db.profile.filters.item.weapon
+local function SetRecipeButtonTooltip(bIndex)
- -- Special cases first, then general case
- if (val == 19) then
- -- Armor "All" checkbox
- if (ARL_ArmorAllCB:GetChecked()) then
- armordb.cloth = true
- armordb.leather = true
- armordb.mail = true
- armordb.plate = true
- armordb.cloak = true
- armordb.necklace = true
- armordb.ring = true
- armordb.trinket = true
- armordb.shield = true
- ARL_ArmorClothCB:SetChecked(true)
- ARL_ArmorLeatherCB:SetChecked(true)
- ARL_ArmorMailCB:SetChecked(true)
- ARL_ArmorPlateCB:SetChecked(true)
- ARL_ArmorCloakCB:SetChecked(true)
- ARL_ArmorNecklaceCB:SetChecked(true)
- ARL_ArmorRingCB:SetChecked(true)
- ARL_ArmorTrinketCB:SetChecked(true)
- ARL_ArmorShieldCB:SetChecked(true)
- ARL_ArmorNoneCB:SetChecked(false)
- end
- elseif (val == 20) then
- -- Armor "None" checkbox
- if (ARL_ArmorNoneCB:GetChecked()) then
- armordb.cloth = false
- armordb.leather = false
- armordb.mail = false
- armordb.plate = false
- armordb.cloak = false
- armordb.necklace = false
- armordb.ring = false
- armordb.trinket = false
- armordb.shield = false
- ARL_ArmorClothCB:SetChecked(false)
- ARL_ArmorLeatherCB:SetChecked(false)
- ARL_ArmorMailCB:SetChecked(false)
- ARL_ArmorPlateCB:SetChecked(false)
- ARL_ArmorCloakCB:SetChecked(false)
- ARL_ArmorNecklaceCB:SetChecked(false)
- ARL_ArmorRingCB:SetChecked(false)
- ARL_ArmorTrinketCB:SetChecked(false)
- ARL_ArmorShieldCB:SetChecked(false)
- ARL_ArmorAllCB:SetChecked(false)
- end
- elseif ((val == 21) or (val == 22) or (val == 23) or (val == 24) or
- (val == 64) or (val == 65) or (val == 66) or (val == 67) or (val == 85)) then
- -- in this case, we need to check if the checkbox we just hit either
- -- makes everthing checked, or everything empty. If so, we check the All/None
- -- checkboxes
- if (FilterValueMap[val].cb:GetChecked()) then
- FilterValueMap[val].svroot[ FilterValueMap[val].svval ] = true
- if ((armordb.cloth == true) and (armordb.leather == true) and
- (armordb.mail == true) and (armordb.plate == true) and
- (armordb.cloak == true) and (armordb.necklace == true) and
- (armordb.ring == true) and (armordb.trinket == true) and
- (armordb.shield == true)) then
- ARL_ArmorAllCB:SetChecked(true)
- end
- ARL_ArmorNoneCB:SetChecked(false)
- else
- FilterValueMap[val].svroot[ FilterValueMap[val].svval ] = false
- if ((armordb.cloth == false) and (armordb.leather == false) and
- (armordb.mail == false) and (armordb.plate == false) and
- (armordb.cloak == false) and (armordb.necklace == false) and
- (armordb.ring == false) and (armordb.trinket == false) and
- (armordb.shield == false)) then
- ARL_ArmorNoneCB:SetChecked(true)
- end
- ARL_ArmorAllCB:SetChecked(false)
- end
- elseif (val == 25) then
- -- Weapon "All" special case
- if (ARL_WeaponAllCB:GetChecked()) then
- weapondb.onehand = true
- weapondb.twohand = true
- weapondb.dagger = true
- weapondb.axe = true
- weapondb.mace = true
- weapondb.sword = true
- weapondb.polearm = true
- weapondb.wand = true
- weapondb.thrown = true
- weapondb.ammo = true
- weapondb.fist = true
- ARL_Weapon1HCB:SetChecked(true)
- ARL_Weapon2HCB:SetChecked(true)
- ARL_WeaponDaggerCB:SetChecked(true)
- ARL_WeaponAxeCB:SetChecked(true)
- ARL_WeaponMaceCB:SetChecked(true)
- ARL_WeaponSwordCB:SetChecked(true)
- ARL_WeaponPolearmCB:SetChecked(true)
- ARL_WeaponWandCB:SetChecked(true)
- ARL_WeaponThrownCB:SetChecked(true)
- ARL_WeaponAmmoCB:SetChecked(true)
- ARL_WeaponFistCB:SetChecked(true)
- ARL_WeaponNoneCB:SetChecked(false)
- end
- elseif (val == 26) then
- -- Weapon "None" special case
- if (ARL_WeaponNoneCB:GetChecked()) then
- weapondb.onehand = false
- weapondb.twohand = false
- weapondb.dagger = false
- weapondb.axe = false
- weapondb.mace = false
- weapondb.sword = false
- weapondb.polearm = false
- weapondb.wand = false
- weapondb.thrown = false
- weapondb.ammo = false
- weapondb.fist = false
- ARL_Weapon1HCB:SetChecked(false)
- ARL_Weapon2HCB:SetChecked(false)
- ARL_WeaponDaggerCB:SetChecked(false)
- ARL_WeaponAxeCB:SetChecked(false)
- ARL_WeaponMaceCB:SetChecked(false)
- ARL_WeaponSwordCB:SetChecked(false)
- ARL_WeaponPolearmCB:SetChecked(false)
- ARL_WeaponWandCB:SetChecked(false)
- ARL_WeaponThrownCB:SetChecked(false)
- ARL_WeaponAmmoCB:SetChecked(false)
- ARL_WeaponFistCB:SetChecked(false)
- ARL_WeaponAllCB:SetChecked(false)
- end
- elseif ((val == 34) or (val == 36) or (val == 37)) then
- -- Weapon disable case ... there's really no way to reach this code
- elseif ((val == 27) or (val == 28) or (val == 29) or (val == 30) or (val == 31) or
- (val == 32) or (val == 33) or (val == 68) or (val == 35) or (val == 38) or (val == 84)) then
- -- we've clicked on a weapon thinger. If all of them are either checked or unchecked,
- -- we should automagically check the "All" or "None" checkbox
- if (FilterValueMap[val].cb:GetChecked()) then
- FilterValueMap[val].svroot[ FilterValueMap[val].svval ] = true
- if ((weapondb.onehand == true) and (weapondb.twohand == true) and
- (weapondb.dagger == true) and (weapondb.axe == true) and
- (weapondb.mace == true) and (weapondb.sword == true) and
- (weapondb.polearm == true) and (weapondb.wand == true) and
- (weapondb.thrown == true) and (weapondb.ammo == true) and
- (weapondb.fist == true)) then
- ARL_WeaponAllCB:SetChecked(true)
+ local pButton = addon.PlusListButton[bIndex]
+ local rButton = addon.RecipeListButton[bIndex]
+ local dStringIndex = rButton.sI
+ local rIndex = DisplayStrings[dStringIndex].sID
+ local playerFaction = playerData.playerFaction
+ local exclude = addon.db.profile.exclusionlist
+
+ pButton:SetScript("OnEnter",
+ function (pButton)
+ GenerateTooltipContent(pButton, rIndex, playerFaction, exclude)
end
- ARL_WeaponNoneCB:SetChecked(false)
- else
- FilterValueMap[val].svroot[ FilterValueMap[val].svval ] = false
- if ((weapondb.onehand == false) and (weapondb.twohand == false) and
- (weapondb.dagger == false) and (weapondb.axe == false) and
- (weapondb.mace == false) and (weapondb.sword == false) and
- (weapondb.polearm == false) and (weapondb.wand == false) and
- (weapondb.thrown == false) and (weapondb.ammo == false) and
- (weapondb.fist == false)) then
- ARL_WeaponNoneCB:SetChecked(true)
+ )
+
+ pButton:SetScript("OnLeave",
+ function()
+ arlTooltip:Hide()
+ arlTooltip2:Hide()
end
- ARL_WeaponAllCB:SetChecked(false)
- end
- else
- -- General case
- if (FilterValueMap[val].cb:GetChecked()) then
- FilterValueMap[val].svroot[ FilterValueMap[val].svval ] = true
- else
- FilterValueMap[val].svroot[ FilterValueMap[val].svval ] = false
- end
- end
+ )
- addon.resetTitle()
+ rButton:SetScript("OnEnter",
+ function (rButton)
+ GenerateTooltipContent(rButton, rIndex, playerFaction, exclude)
+ end
+ )
- if (not ApplyFilterState) then
+ rButton:SetScript("OnLeave",
+ function()
+ arlTooltip:Hide()
+ arlTooltip2:Hide()
+ end
+ )
- ApplyFilterState = {}
+end
- end
- -- We have this toggled one way
- if (ApplyFilterState[val]) then
+-- Description:
+-- Expected result:
+-- Input:
+-- Output:
- ApplyFilterState[val] = not ApplyFilterState[val]
+local function CheckDisplayFaction(filterDB, faction)
- -- Hasn't been toggled
- else
+ if (filterDB.general.faction ~= true) then
- ApplyFilterState[val] = true
+ if ((faction == BFAC[myFaction]) or (faction == BFAC["Neutral"]) or (faction == nil)) then
- end
+ return true
- ARL_ApplyButton:SetNormalFontObject("GameFontDisableSmall")
- ARL_ApplyButton:Disable()
+ else
- for i,j in pairs(ApplyFilterState) do
+ return false
- if (j == true) then
+ end
- ARL_ApplyButton:SetNormalFontObject("GameFontNormalSmall")
- ARL_ApplyButton:Enable()
- break
+ else
- end
+ return true
end
@@ -1014,321 +864,209 @@ end
-- Expected result:
-- Input:
-- Output:
+-- Scrollframe update stuff
-local function HideARL_ExpOptCB(ignorevalue)
-
- ARL_ExpGeneralOptCB.text:SetText(addon:Yellow(ExpButtonText[1]))
- ARL_ExpObtainOptCB.text:SetText(addon:Yellow(ExpButtonText[2]))
- ARL_ExpBindingOptCB.text:SetText(addon:Yellow(ExpButtonText[3]))
- ARL_ExpItemOptCB.text:SetText(addon:Yellow(ExpButtonText[4]))
- ARL_ExpPlayerOptCB.text:SetText(addon:Yellow(ExpButtonText[5]))
- ARL_ExpRepOptCB.text:SetText(addon:White(ExpButtonText[6]))
-
- if (ignorevalue ~= "general") then
-
- ARL_ExpGeneralOptCB:SetChecked(false)
- ARL_ExpGeneralOptCB.text:SetText(addon:Yellow(ExpButtonText[1]))
+local function RecipeList_Update()
- else
+ -- Clear out the current buttons
+ for i = 1, maxVisibleRecipes do
- ARL_ExpGeneralOptCB.text:SetText(addon:White(ExpButtonText[1]))
+ addon.RecipeListButton[i]:SetText("")
+ addon.RecipeListButton[i].sI = 0
+ addon.PlusListButton[i]:Hide()
+ ClearRecipeButtonTooltip(i)
end
- if (ignorevalue ~= "obtain") then
-
- ARL_ExpObtainOptCB:SetChecked(false)
- ARL_ExpObtainOptCB.text:SetText(addon:Yellow(ExpButtonText[2]))
-
- else
-
- ARL_ExpObtainOptCB.text:SetText(addon:White(ExpButtonText[2]))
-
- end
+ local entries = #DisplayStrings
- if (ignorevalue ~= "binding") then
+ FauxScrollFrame_Update(ARL_RecipeScrollFrame, entries, maxVisibleRecipes, 16)
- ARL_ExpBindingOptCB:SetChecked(false)
- ARL_ExpBindingOptCB.text:SetText(addon:Yellow(ExpButtonText[3]))
+ if (entries > 0) then
- else
+ -- now fill in our buttons
+ local listOffset = FauxScrollFrame_GetOffset(ARL_RecipeScrollFrame)
+ local buttonIndex = 1
+ local stringsIndex = buttonIndex + listOffset
- ARL_ExpBindingOptCB.text:SetText(addon:White(ExpButtonText[3]))
+ local stayInLoop = true
- end
+ while (stayInLoop == true) do
- if (ignorevalue ~= "item") then
+ if (DisplayStrings[stringsIndex].IsRecipe) then
- ARL_ExpItemOptCB:SetChecked(false)
- ARL_ExpItemOptCB.text:SetText(addon:Yellow(ExpButtonText[4]))
+ -- display the + symbol
+ addon.PlusListButton[buttonIndex]:Show()
- else
+ -- Is it expanded or not?
+ if (DisplayStrings[stringsIndex].IsExpanded) then
- ARL_ExpItemOptCB.text:SetText(addon:White(ExpButtonText[4]))
+ addon.PlusListButton[buttonIndex]:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up")
+ addon.PlusListButton[buttonIndex]:SetPushedTexture("Interface\\Buttons\\UI-MinusButton-Down")
+ addon.PlusListButton[buttonIndex]:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
+ addon.PlusListButton[buttonIndex]:SetDisabledTexture("Interface\\Buttons\\UI-MinusButton-Disabled")
- end
+ else
- if (ignorevalue ~= "player") then
+ addon.PlusListButton[buttonIndex]:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up")
+ addon.PlusListButton[buttonIndex]:SetPushedTexture("Interface\\Buttons\\UI-PlusButton-Down")
+ addon.PlusListButton[buttonIndex]:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
+ addon.PlusListButton[buttonIndex]:SetDisabledTexture("Interface\\Buttons\\UI-PlusButton-Disabled")
- ARL_ExpPlayerOptCB:SetChecked(false)
- ARL_ExpPlayerOptCB.text:SetText(addon:Yellow(ExpButtonText[5]))
+ end
- else
+ else
- ARL_ExpPlayerOptCB.text:SetText(addon:White(ExpButtonText[5]))
+ addon.PlusListButton[buttonIndex]:Hide()
- end
+ end
- if (ignorevalue ~= "rep") then
+ addon.RecipeListButton[buttonIndex]:SetText(DisplayStrings[stringsIndex].String)
+ addon.RecipeListButton[buttonIndex].sI = stringsIndex
- ARL_ExpRepOptCB:SetChecked(false)
- ARL_ExpRepOptCB.text:SetText(addon:Yellow(ExpButtonText[6]))
+ -- Set the tooltip on the button
+ SetRecipeButtonTooltip(buttonIndex)
- else
+ buttonIndex = buttonIndex + 1
+ stringsIndex = stringsIndex + 1
- ARL_ExpRepOptCB.text:SetText(addon:White(ExpButtonText[6]))
+ if ((buttonIndex > maxVisibleRecipes) or (stringsIndex > entries)) then
- end
+ stayInLoop = false
-end
+ end
--- Description:
--- Expected result:
--- Input:
--- Output:
+ end
-function addon.ToggleFilters()
+ -- Entries are 0 here, so we have 0 to display
+ else
- local xPos = addon.Frame:GetLeft()
- local yPos = addon.Frame:GetBottom()
+ -- If the recipe total is at 0, it means we have not scanned the profession yet
+ if (playerData.recipes_total == 0) then
- if (addon.Frame._Expanded == true) then
- -- Adjust the frame size and texture
--- addon.Frame:Hide()
- addon.Frame:ClearAllPoints()
- addon.Frame:SetWidth(293)
- addon.Frame:SetHeight(447)
- addon.bgTexture:SetTexture([[Interface\Addons\AckisRecipeList\img\main]])
- addon.bgTexture:SetAllPoints(addon.Frame)
- addon.bgTexture:SetTexCoord(0, (293/512), 0, (447/512))
- addon.Frame._Expanded = false
- addon.Frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", xPos, yPos)
- -- Change the text and tooltip for the filter button
- ARL_FilterButton:SetText(L["FILTER_OPEN"])
- addon:TooltipDisplay(ARL_FilterButton, L["FILTER_OPEN_DESC"])
+ StaticPopup_Show("ARL_NOTSCANNED")
- -- Hide my 5 buttons
- ARL_ExpGeneralOptCB:Hide()
- ARL_ExpObtainOptCB:Hide()
- ARL_ExpBindingOptCB:Hide()
- ARL_ExpItemOptCB:Hide()
- ARL_ExpPlayerOptCB:Hide()
- ARL_ExpRepOptCB:Hide()
+ -- We know all the recipes
+ elseif (playerData.recipes_known == playerData.recipes_total) then
- -- Uncheck the five buttons
- HideARL_ExpOptCB()
+ StaticPopup_Show("ARL_ALLKNOWN")
- -- Hide the flyaway panel
- addon.Flyaway:Hide()
+ -- Our filters are actually filtering something
+ elseif ((playerData.recipes_total_filtered - playerData.recipes_known_filtered) ~= 0) then
- ARL_ResetButton:Hide()
- ARL_ApplyButton:Hide()
+ StaticPopup_Show("ARL_ALLFILTERED")
- -- and finally, show our frame
--- addon.Frame:Show()
- else
+ -- Our exclusion list is preventing something from being displayed
+ elseif (playerData.excluded_recipes_unknown ~= 0) then
- -- Adjust the frame size and texture
--- addon.Frame:Hide()
- addon.Frame:ClearAllPoints()
- addon.Frame:SetWidth(444)
- addon.Frame:SetHeight(447)
- addon.bgTexture:SetTexture([[Interface\Addons\AckisRecipeList\img\expanded]])
- addon.bgTexture:SetAllPoints(addon.Frame)
- addon.bgTexture:SetTexCoord(0, (444/512), 0, (447/512))
- addon.Frame._Expanded = true
- addon.Frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", xPos, yPos)
+ StaticPopup_Show("ARL_ALLEXCLUDED")
- -- Change the text and tooltip for the filter button
- ARL_FilterButton:SetText(L["FILTER_CLOSE"])
- addon:TooltipDisplay(ARL_FilterButton, L["FILTER_CLOSE_DESC"])
+ else
- -- Show my 5 buttons
- ARL_ExpGeneralOptCB:Show()
- ARL_ExpObtainOptCB:Show()
- ARL_ExpBindingOptCB:Show()
- ARL_ExpItemOptCB:Show()
- ARL_ExpPlayerOptCB:Show()
- ARL_ExpRepOptCB:Show()
+ addon:Print(L["NO_DISPLAY"])
- ARL_ResetButton:Show()
- ARL_ApplyButton:Show()
+ end
- -- and finally, show our frame
--- addon.Frame:Show()
end
- -- Reset our title
- addon.resetTitle()
-
+ -- Make sure our apply button gets disabled
+ ApplyFilterState = nil
+ ARL_ApplyButton:SetNormalFontObject("GameFontDisableSmall")
+ ARL_ApplyButton:Disable()
+
end
+-- Under various conditions, I'm going to have to redisplay my recipe list
+-- This could happen because a filter changes, a new profession is chosen, or
+-- a new search occurred. Use this function to do all the dirty work
+
-- Description:
-- Expected result:
-- Input:
-- Output:
-function addon:GenericMakeCB(cButton, anchorFrame, ttText, scriptVal, row, col, logo)
-
- local pushdown = {
- [64] = 1, [65] = 1, [66] = 1, [67] = 1, [25] = 1, [26] = 1, [27] = 1, [28] = 1, [29] = 1,
- [30] = 1, [31] = 1, [32] = 1, [33] = 1, [34] = 1, [68] = 1, [35] = 1, [36] = 1, [37] = 1,
- [38] = 1, [84] = 1, [85] = 1,
- }
- -- set the position of the new checkbox
- local xPos = 2 + ((col - 1) * 100)
- local yPos = -3 - ((row - 1) * 17)
- if (pushdown[scriptVal]) then yPos = yPos - 5 end
- cButton:SetPoint("TOPLEFT", anchorFrame, "TOPLEFT", xPos, yPos)
-
- -- depending if we're on the rep logo thingers or not, set the height and an OnClick method
- if (logo == 0) then
- cButton:SetHeight(24)
- cButton:SetWidth(24)
- cButton:SetScript("OnClick", function() addon.filterSwitch(scriptVal) end)
- else
- cButton:SetHeight(46)
- cButton:SetWidth(100)
- cButton:SetScript("OnClick", function() addon.filterSwitch(scriptVal) end)
- end
-
- addon:TooltipDisplay(cButton, ttText, 1)
-
-end
+local function ReDisplay()
--- Description:
--- Expected result:
--- Input:
--- Output:
+ addon:UpdateFilters(recipeDB, allSpecTable, playerData)
+ sortedRecipeIndex = addon:SortMissingRecipes(recipeDB)
-function addon:GenericCreateButton(
- bName, parentFrame, bHeight, bWidth,
- anchorFrom, anchorFrame, anchorTo, xOffset, yOffset,
- bNormFont, bHighFont, initText, tAlign, tooltipText, noTextures)
+ if (not addon.db.profile.ignoreexclusionlist) then
- -- I hate stretchy buttons. Thanks very much to ckknight for this code
- -- (found in RockConfig)
+ addon:GetExclusions(recipeDB)
- -- when pressed, the button should look pressed
- local function button_OnMouseDown(this)
- if this:IsEnabled() == 1 then
- this.left:SetTexture([[Interface\Buttons\UI-Panel-Button-Down]])
- this.middle:SetTexture([[Interface\Buttons\UI-Panel-Button-Down]])
- this.right:SetTexture([[Interface\Buttons\UI-Panel-Button-Down]])
- end
- end
- -- when depressed, return to normal
- local function button_OnMouseUp(this)
- if this:IsEnabled() == 1 then
- this.left:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
- this.middle:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
- this.right:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
- end
end
- local function button_Disable(this)
- this.left:SetTexture([[Interface\Buttons\UI-Panel-Button-Disabled]])
- this.middle:SetTexture([[Interface\Buttons\UI-Panel-Button-Disabled]])
- this.right:SetTexture([[Interface\Buttons\UI-Panel-Button-Disabled]])
- this:__Disable()
- this:EnableMouse(false)
- end
+ initDisplayStrings()
- local function button_Enable(this)
- this.left:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
- this.middle:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
- this.right:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
- this:__Enable()
- this:EnableMouse(true)
- end
+ SetProgressBar(playerData)
+
+ -- Make sure our expand all button is set to expandall
+ ARL_ExpandButton:SetText(L["EXPANDALL"])
+ addon:TooltipDisplay(ARL_ExpandButton, L["EXPANDALL_DESC"])
- local button = CreateFrame("Button", bName, parentFrame)
+ -- And update our scrollframe
+ RecipeList_Update()
- button:SetWidth(bWidth)
- button:SetHeight(bHeight)
+end
- if (noTextures == 1) then
- local left = button:CreateTexture(button:GetName() .. "_LeftTexture", "BACKGROUND")
- button.left = left
- local middle = button:CreateTexture(button:GetName() .. "_MiddleTexture", "BACKGROUND")
- button.middle = middle
- local right = button:CreateTexture(button:GetName() .. "_RightTexture", "BACKGROUND")
- button.right = right
+-- Description:
+-- Expected result:
+-- Input:
+-- Output:
- left:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
- middle:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
- right:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
+function addon:CreateScanButton()
- left:SetPoint("TOPLEFT")
- left:SetPoint("BOTTOMLEFT")
- left:SetWidth(12)
- left:SetTexCoord(0, 0.09375, 0, 0.6875)
+ -- Create the scan button
+ if (not addon.ScanButton) then
- right:SetPoint("TOPRIGHT")
- right:SetPoint("BOTTOMRIGHT")
- right:SetWidth(12)
- right:SetTexCoord(0.53125, 0.625, 0, 0.6875)
+ addon.ScanButton = CreateFrame("Button","addon.ScanButton",UIParent,"UIPanelButtonTemplate")
- middle:SetPoint("TOPLEFT", left, "TOPRIGHT")
- middle:SetPoint("BOTTOMRIGHT", right, "BOTTOMLEFT")
- middle:SetTexCoord(0.09375, 0.53125, 0, 0.6875)
+ end
- button:SetScript("OnMouseDown", button_OnMouseDown)
- button:SetScript("OnMouseUp", button_OnMouseUp)
- button:SetScript("OnEnter", SubControl_OnEnter)
- button:SetScript("OnLeave", SubControl_OnLeave)
+ -- Add to Skillet interface
+ if (Skillet and Skillet:IsActive()) then
- button.__Enable = button.Enable
- button.__Disable = button.Disable
- button.Enable = button_Enable
- button.Disable = button_Disable
+ addon.ScanButton:SetParent(SkilletFrame)
+ addon.ScanButton:Show()
+ Skillet:AddButtonToTradeskillWindow(addon.ScanButton)
+ addon.ScanButton:SetWidth(80)
- local highlight = button:CreateTexture(button:GetName() .. "_Highlight", "OVERLAY", "UIPanelButtonHighlightTexture")
- button:SetHighlightTexture(highlight)
- elseif (noTextures == 2) then
- button:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up")
- button:SetPushedTexture("Interface\\Buttons\\UI-PlusButton-Down")
- button:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
- button:SetDisabledTexture("Interface\\Buttons\\UI-PlusButton-Disabled")
- elseif (noTextures == 3) then
- button:SetNormalTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Up")
- button:SetPushedTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Down")
- button:SetHighlightTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Hilight")
- button:SetDisabledTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Disable")
end
- local text = button:CreateFontString(button:GetName() .. "_FontString", "ARTWORK")
- button:SetFontString(text)
- button.text = text
- text:SetPoint("LEFT", button, "LEFT", 7, 0)
- text:SetPoint("RIGHT", button, "RIGHT", -7, 0)
- text:SetJustifyH(tAlign)
-
- text:SetFontObject(bNormFont)
--- text:SetHighlightFontObject(bHighFont)
--- text:SetDisabledFontObject(GameFontDisableSmall)
+ -- Set some of the common button properties
+ addon.ScanButton:SetHeight(20)
+ addon.ScanButton:RegisterForClicks("LeftButtonUp")
+ addon.ScanButton:SetScript("OnClick",
+ function()
+ addon:ToggleFrame()
+ end
+ )
- text:SetText(initText)
+ addon.ScanButton:SetScript("OnEnter",
+ function(this)
+ GameTooltip_SetDefaultAnchor(GameTooltip, this)
+ GameTooltip:SetText(L["SCAN_RECIPES_DESC"])
+ GameTooltip:Show()
+ end
+ )
- button:SetPoint(anchorFrom, anchorFrame, anchorTo, xOffset, yOffset)
+ addon.ScanButton:SetScript("OnLeave",
+ function()
+ GameTooltip:Hide()
+ end
+ )
- if (tooltipText ~= "") then
+ addon.ScanButton:SetText(L["Scan"])
- addon:TooltipDisplay(button, tooltipText)
+ local buttonparent = addon.ScanButton:GetParent()
+ local framelevel = buttonparent:GetFrameLevel()
+ local framestrata = buttonparent:GetFrameStrata()
- end
+ -- Set the frame level of the button to be 1 deeper than its parent
+ addon.ScanButton:SetFrameLevel(framelevel + 1)
+ addon.ScanButton:SetFrameStrata(framestrata)
- return button
+ addon.ScanButton:Enable()
end
@@ -1336,99 +1074,30 @@ end
-- Expected result:
-- Input:
-- Output:
--- Generic function for creating my expanded panel buttons
-
-function addon:CreateExpCB(bName, bTex, panelIndex)
- local ExpTextureSize = 34
-
- if ((bName == "ARL_RepOldWorldCB") or (bName == "ARL_RepBCCB") or (bName == "ARL_RepLKCB")) then
- local cButton = CreateFrame("CheckButton", bName, addon.Fly_Rep) -- , "UICheckButtonTemplate")
- cButton:SetWidth(100)
- cButton:SetHeight(46)
- cButton:SetChecked(false)
-
- local iconTex = cButton:CreateTexture(cButton:GetName() .. "buttonTex", "BORDER")
- if (bName == "ARL_RepLKCB") then
- iconTex:SetTexture("Interface\\Addons\\AckisRecipeList\\img\\" .. bTex)
- else
- iconTex:SetTexture('Interface/Glues/Common/' .. bTex)
- end
- iconTex:SetWidth(100)
- iconTex:SetHeight(46)
- iconTex:SetAllPoints(cButton)
- local pushedTexture = cButton:CreateTexture(cButton:GetName() .. "pTex", "ARTWORK")
- pushedTexture:SetTexture('Interface/Buttons/UI-Quickslot-Depress')
- pushedTexture:SetAllPoints(cButton)
- cButton:SetPushedTexture(pushedTexture)
- local highlightTexture = cButton:CreateTexture()
- highlightTexture:SetTexture('Interface/Buttons/ButtonHilight-Square')
- highlightTexture:SetAllPoints(cButton)
- highlightTexture:SetBlendMode('ADD')
- cButton:SetHighlightTexture(highlightTexture)
- local checkedTexture = cButton:CreateTexture()
- checkedTexture:SetTexture('Interface/Buttons/CheckButtonHilight')
- checkedTexture:SetAllPoints(cButton)
- checkedTexture:SetBlendMode('ADD')
- cButton:SetCheckedTexture(checkedTexture)
+function addon:ShowScanButton()
- -- And throw up a tooltip
- if (bName == "ARL_RepOldWorldCB") then
- addon:TooltipDisplay(cButton, L["FILTERING_OLDWORLD_DESC"])
- elseif (bName == "ARL_RepBCCB") then
- addon:TooltipDisplay(cButton, L["FILTERING_BC_DESC"])
- else
- addon:TooltipDisplay(cButton, L["FILTERING_WOTLK_DESC"])
- end
+ -- Anchor to ATSW
+ if (ATSWFrame) then
- return cButton
- else
- local cButton = CreateFrame("CheckButton", bName, addon.Frame) -- , "UICheckButtonTemplate")
- cButton:SetWidth(ExpTextureSize)
- cButton:SetHeight(ExpTextureSize)
- cButton:SetScript("OnClick", function()
- addon.DoFlyaway(panelIndex)
- end)
+ addon.ScanButton:SetParent(ATSWFrame)
+ addon.ScanButton:ClearAllPoints()
+ addon.ScanButton:SetPoint("RIGHT", ATSWOptionsButton, "LEFT", 0, 0)
+ addon.ScanButton:SetHeight(ATSWOptionsButton:GetHeight())
+ addon.ScanButton:SetWidth(90)
- local bgTex = cButton:CreateTexture(cButton:GetName() .. "bgTex", "BACKGROUND")
- bgTex:SetTexture('Interface/SpellBook/UI-Spellbook-SpellBackground')
- bgTex:SetHeight(ExpTextureSize + 6)
- bgTex:SetWidth(ExpTextureSize + 4)
- bgTex:SetTexCoord(0, (43/64), 0, (43/64))
- bgTex:SetPoint("CENTER", cButton, "CENTER", 0, 0)
- local iconTex = cButton:CreateTexture(cButton:GetName() .. "iconTex", "BORDER")
- iconTex:SetTexture('Interface/Icons/' .. bTex)
- iconTex:SetAllPoints(cButton)
- local pushedTexture = cButton:CreateTexture(cButton:GetName() .. "pTex", "ARTWORK")
- pushedTexture:SetTexture('Interface/Buttons/UI-Quickslot-Depress')
- pushedTexture:SetAllPoints(cButton)
- cButton:SetPushedTexture(pushedTexture)
- local highlightTexture = cButton:CreateTexture()
- highlightTexture:SetTexture('Interface/Buttons/ButtonHilight-Square')
- highlightTexture:SetAllPoints(cButton)
- highlightTexture:SetBlendMode('ADD')
- cButton:SetHighlightTexture(highlightTexture)
- local checkedTexture = cButton:CreateTexture()
- checkedTexture:SetTexture('Interface/Buttons/CheckButtonHilight')
- checkedTexture:SetAllPoints(cButton)
- checkedTexture:SetBlendMode('ADD')
- cButton:SetCheckedTexture(checkedTexture)
- -- Create the text object to go along with it
- local cbText = cButton:CreateFontString("cbText", "OVERLAY", "GameFontHighlight")
- cbText:SetText(addon:Yellow(ExpButtonText[panelIndex]))
- cbText:SetPoint("LEFT", cButton, "RIGHT", 5, 0)
- cbText:SetHeight(14)
- cbText:SetWidth(100)
- cbText:SetJustifyH("LEFT")
- cButton.text = cbText
+ -- Anchor to trade window
+ else
- -- And throw up a tooltip
- addon:TooltipDisplay(cButton, ExpButtonTT[panelIndex])
- cButton:Hide()
- return cButton
+ addon.ScanButton:SetParent(TradeSkillFrame)
+ addon.ScanButton:ClearAllPoints()
+ addon.ScanButton:SetPoint("RIGHT",TradeSkillFrameCloseButton,"LEFT",4,0)
+ addon.ScanButton:SetWidth(addon.ScanButton:GetTextWidth() + 10)
end
+ addon.ScanButton:Show()
+
end
-- Description:
@@ -1436,17 +1105,21 @@ end
-- Input:
-- Output:
-function addon:ToggleFrame()
-
- if (addon.Frame and addon.Frame:IsVisible()) then
-
- addon.Frame:Hide()
-
- else
+function addon:TooltipDisplay(this, textLabel)
- addon:AckisRecipeList_Command()
+ this:SetScript("OnEnter",
+ function (this)
+ GameTooltip_SetDefaultAnchor(GameTooltip, this)
+ GameTooltip:SetText(textLabel, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b)
+ GameTooltip:Show()
+ end
+ )
- end
+ this:SetScript("OnLeave",
+ function(this)
+ GameTooltip:Hide()
+ end
+ )
end
@@ -1454,29 +1127,28 @@ end
-- Expected result:
-- Input:
-- Output:
--- Set the texture on the switcher button.
-local function SetSwitcherTexture(tex)
--- This is really only called the first time its displayed. It should reflect the first
--- profession the user has selected, or that shows up in his lists.
+function addon.numFilters()
--- For now, just display the first texture
- local ARL_S_NTexture = ARL_SwitcherButton:CreateTexture("ARL_S_NTexture", "BACKGROUND")
- ARL_S_NTexture:SetTexture([[Interface\Addons\AckisRecipeList\img\]] .. tex .. [[_up]])
- ARL_S_NTexture:SetTexCoord(0, 1, 0, 1)
- ARL_S_NTexture:SetAllPoints(ARL_SwitcherButton)
- local ARL_S_PTexture = ARL_SwitcherButton:CreateTexture("ARL_S_PTexture", "BACKGROUND")
- ARL_S_PTexture:SetTexture([[Interface\Addons\AckisRecipeList\img\]] .. tex .. [[_down]])
- ARL_S_PTexture:SetTexCoord(0, 1, 0, 1)
- ARL_S_PTexture:SetAllPoints(ARL_SwitcherButton)
- local ARL_S_DTexture = ARL_SwitcherButton:CreateTexture("ARL_S_DTexture", "BACKGROUND")
- ARL_S_DTexture:SetTexture([[Interface\Addons\AckisRecipeList\img\]] .. tex .. [[_up]])
- ARL_S_DTexture:SetTexCoord(0, 1, 0, 1)
- ARL_S_DTexture:SetAllPoints(ARL_SwitcherButton)
+ -- IMPORTANT: If the number of filters we're maintaining changes, you'll need to change the FilterValueMap
+ -- at the end (of CreateFrame), as well as the following index value:
+ local MaxFilters = 87
- ARL_SwitcherButton:SetNormalTexture(ARL_S_NTexture)
- ARL_SwitcherButton:SetPushedTexture(ARL_S_PTexture)
- ARL_SwitcherButton:SetDisabledTexture(ARL_S_DTexture)
+ local total = 0
+ local active = 0
+
+ for i = 1, MaxFilters do
+ if ((FilterValueMap[i].svroot == "disabled") or
+ (FilterValueMap[i].svroot == "special case")) then
+ -- ignore these filters in the totals
+ elseif (FilterValueMap[i].svroot[ FilterValueMap[i].svval ] == true) then
+ active = active + 1
+ total = total + 1
+ else
+ total = total + 1
+ end
+ end
+ return active, total
end
@@ -1484,13 +1156,27 @@ end
-- Expected result:
-- Input:
-- Output:
--- converting from hex to rgb (Thanks Maldivia)
-local function toRGB(hex)
+function addon.resetTitle()
- local r, g, b = hex:match("(..)(..)(..)")
+ -- reset the frame title line
+ local myTitle = ""
+ local addonversion = GetAddOnMetadata("AckisRecipeList", "Version")
- return (tonumber(r,16) / 256) , (tonumber(g,16) / 256) , (tonumber(b,16) / 256)
+ if (addon.Frame._Expanded == true) then
+
+ local aFil, tFil = addon.numFilters()
+
+ myTitle = "ARL (v." .. addonversion .. ") - " .. currentProfession ..
+ " (" .. aFil .. "/" .. tFil .. " " .. L["Filters"] .. ")"
+
+ else
+
+ myTitle = "ARL (v." .. addonversion .. ") - " .. currentProfession
+
+ end
+
+ addon.Frame.HeadingText:SetText(addon:Normal(myTitle))
end
@@ -1498,82 +1184,210 @@ end
-- Expected result:
-- Input:
-- Output:
--- I want to do a bit more comprehensive tooltip processing. Things like changing font sizes,
--- adding padding to the left hand side, and using better color handling. So... this function
--- will do that for me.
-
-local function gttAdd(
- leftPad, -- number of times to pad two spaces on left side
- textSize, -- negative number. subtract from 12 to get fontsize
- narrow, -- if 1, use ARIALN instead of FRITZQ
- wraptext, -- wraptext for AddLine (0 or 1)
- str1, -- left hand string
- hexcolor1, -- hex color code for left hand side
- str2, -- if present, this is a double line, and this is the right hand string
- hexcolor2) -- if present, hex color code for right hand side
-
- -- convert hex colors to r g b components. tooltips are dumb that way
-
- local a, b, c = toRGB(hexcolor1)
- local d, e, f = 0, 0, 0
- if (hexcolor2) then
+function addon.filterSwitch(val)
- d, e, f = toRGB(hexcolor2)
+ -- This function is the all-encompassing checkbox handler for the ZJGUI
+ local armordb = addon.db.profile.filters.item.armor
+ local weapondb = addon.db.profile.filters.item.weapon
+ -- Special cases first, then general case
+ if (val == 19) then
+ -- Armor "All" checkbox
+ if (ARL_ArmorAllCB:GetChecked()) then
+ armordb.cloth = true
+ armordb.leather = true
+ armordb.mail = true
+ armordb.plate = true
+ armordb.cloak = true
+ armordb.necklace = true
+ armordb.ring = true
+ armordb.trinket = true
+ armordb.shield = true
+ ARL_ArmorClothCB:SetChecked(true)
+ ARL_ArmorLeatherCB:SetChecked(true)
+ ARL_ArmorMailCB:SetChecked(true)
+ ARL_ArmorPlateCB:SetChecked(true)
+ ARL_ArmorCloakCB:SetChecked(true)
+ ARL_ArmorNecklaceCB:SetChecked(true)
+ ARL_ArmorRingCB:SetChecked(true)
+ ARL_ArmorTrinketCB:SetChecked(true)
+ ARL_ArmorShieldCB:SetChecked(true)
+ ARL_ArmorNoneCB:SetChecked(false)
+ end
+ elseif (val == 20) then
+ -- Armor "None" checkbox
+ if (ARL_ArmorNoneCB:GetChecked()) then
+ armordb.cloth = false
+ armordb.leather = false
+ armordb.mail = false
+ armordb.plate = false
+ armordb.cloak = false
+ armordb.necklace = false
+ armordb.ring = false
+ armordb.trinket = false
+ armordb.shield = false
+ ARL_ArmorClothCB:SetChecked(false)
+ ARL_ArmorLeatherCB:SetChecked(false)
+ ARL_ArmorMailCB:SetChecked(false)
+ ARL_ArmorPlateCB:SetChecked(false)
+ ARL_ArmorCloakCB:SetChecked(false)
+ ARL_ArmorNecklaceCB:SetChecked(false)
+ ARL_ArmorRingCB:SetChecked(false)
+ ARL_ArmorTrinketCB:SetChecked(false)
+ ARL_ArmorShieldCB:SetChecked(false)
+ ARL_ArmorAllCB:SetChecked(false)
+ end
+ elseif ((val == 21) or (val == 22) or (val == 23) or (val == 24) or
+ (val == 64) or (val == 65) or (val == 66) or (val == 67) or (val == 85)) then
+ -- in this case, we need to check if the checkbox we just hit either
+ -- makes everthing checked, or everything empty. If so, we check the All/None
+ -- checkboxes
+ if (FilterValueMap[val].cb:GetChecked()) then
+ FilterValueMap[val].svroot[ FilterValueMap[val].svval ] = true
+ if ((armordb.cloth == true) and (armordb.leather == true) and
+ (armordb.mail == true) and (armordb.plate == true) and
+ (armordb.cloak == true) and (armordb.necklace == true) and
+ (armordb.ring == true) and (armordb.trinket == true) and
+ (armordb.shield == true)) then
+ ARL_ArmorAllCB:SetChecked(true)
+ end
+ ARL_ArmorNoneCB:SetChecked(false)
+ else
+ FilterValueMap[val].svroot[ FilterValueMap[val].svval ] = false
+ if ((armordb.cloth == false) and (armordb.leather == false) and
+ (armordb.mail == false) and (armordb.plate == false) and
+ (armordb.cloak == false) and (armordb.necklace == false) and
+ (armordb.ring == false) and (armordb.trinket == false) and
+ (armordb.shield == false)) then
+ ARL_ArmorNoneCB:SetChecked(true)
+ end
+ ARL_ArmorAllCB:SetChecked(false)
+ end
+ elseif (val == 25) then
+ -- Weapon "All" special case
+ if (ARL_WeaponAllCB:GetChecked()) then
+ weapondb.onehand = true
+ weapondb.twohand = true
+ weapondb.dagger = true
+ weapondb.axe = true
+ weapondb.mace = true
+ weapondb.sword = true
+ weapondb.polearm = true
+ weapondb.wand = true
+ weapondb.thrown = true
+ weapondb.ammo = true
+ weapondb.fist = true
+ ARL_Weapon1HCB:SetChecked(true)
+ ARL_Weapon2HCB:SetChecked(true)
+ ARL_WeaponDaggerCB:SetChecked(true)
+ ARL_WeaponAxeCB:SetChecked(true)
+ ARL_WeaponMaceCB:SetChecked(true)
+ ARL_WeaponSwordCB:SetChecked(true)
+ ARL_WeaponPolearmCB:SetChecked(true)
+ ARL_WeaponWandCB:SetChecked(true)
+ ARL_WeaponThrownCB:SetChecked(true)
+ ARL_WeaponAmmoCB:SetChecked(true)
+ ARL_WeaponFistCB:SetChecked(true)
+ ARL_WeaponNoneCB:SetChecked(false)
+ end
+ elseif (val == 26) then
+ -- Weapon "None" special case
+ if (ARL_WeaponNoneCB:GetChecked()) then
+ weapondb.onehand = false
+ weapondb.twohand = false
+ weapondb.dagger = false
+ weapondb.axe = false
+ weapondb.mace = false
+ weapondb.sword = false
+ weapondb.polearm = false
+ weapondb.wand = false
+ weapondb.thrown = false
+ weapondb.ammo = false
+ weapondb.fist = false
+ ARL_Weapon1HCB:SetChecked(false)
+ ARL_Weapon2HCB:SetChecked(false)
+ ARL_WeaponDaggerCB:SetChecked(false)
+ ARL_WeaponAxeCB:SetChecked(false)
+ ARL_WeaponMaceCB:SetChecked(false)
+ ARL_WeaponSwordCB:SetChecked(false)
+ ARL_WeaponPolearmCB:SetChecked(false)
+ ARL_WeaponWandCB:SetChecked(false)
+ ARL_WeaponThrownCB:SetChecked(false)
+ ARL_WeaponAmmoCB:SetChecked(false)
+ ARL_WeaponFistCB:SetChecked(false)
+ ARL_WeaponAllCB:SetChecked(false)
+ end
+ elseif ((val == 34) or (val == 36) or (val == 37)) then
+ -- Weapon disable case ... there's really no way to reach this code
+ elseif ((val == 27) or (val == 28) or (val == 29) or (val == 30) or (val == 31) or
+ (val == 32) or (val == 33) or (val == 68) or (val == 35) or (val == 38) or (val == 84)) then
+ -- we've clicked on a weapon thinger. If all of them are either checked or unchecked,
+ -- we should automagically check the "All" or "None" checkbox
+ if (FilterValueMap[val].cb:GetChecked()) then
+ FilterValueMap[val].svroot[ FilterValueMap[val].svval ] = true
+ if ((weapondb.onehand == true) and (weapondb.twohand == true) and
+ (weapondb.dagger == true) and (weapondb.axe == true) and
+ (weapondb.mace == true) and (weapondb.sword == true) and
+ (weapondb.polearm == true) and (weapondb.wand == true) and
+ (weapondb.thrown == true) and (weapondb.ammo == true) and
+ (weapondb.fist == true)) then
+ ARL_WeaponAllCB:SetChecked(true)
+ end
+ ARL_WeaponNoneCB:SetChecked(false)
+ else
+ FilterValueMap[val].svroot[ FilterValueMap[val].svval ] = false
+ if ((weapondb.onehand == false) and (weapondb.twohand == false) and
+ (weapondb.dagger == false) and (weapondb.axe == false) and
+ (weapondb.mace == false) and (weapondb.sword == false) and
+ (weapondb.polearm == false) and (weapondb.wand == false) and
+ (weapondb.thrown == false) and (weapondb.ammo == false) and
+ (weapondb.fist == false)) then
+ ARL_WeaponNoneCB:SetChecked(true)
+ end
+ ARL_WeaponAllCB:SetChecked(false)
+ end
+ else
+ -- General case
+ if (FilterValueMap[val].cb:GetChecked()) then
+ FilterValueMap[val].svroot[ FilterValueMap[val].svval ] = true
+ else
+ FilterValueMap[val].svroot[ FilterValueMap[val].svval ] = false
+ end
end
- -- Add in our left hand padding
- local looppad = leftPad
- local leftStr = str1
+ addon.resetTitle()
- while (looppad > 0) do
+ if (not ApplyFilterState) then
- leftStr = " " .. leftStr
- looppad = looppad - 1
+ ApplyFilterState = {}
end
- -- Are we adding a single or double line?
- local double = false
-
- if (str2) then
+ -- We have this toggled one way
+ if (ApplyFilterState[val]) then
- arlTooltip:AddDoubleLine(leftStr, str2, a, b, c, d, e, f)
- double = true
+ ApplyFilterState[val] = not ApplyFilterState[val]
+ -- Hasn't been toggled
else
- arlTooltip:AddLine(leftStr, a, b, c, wraptext)
+ ApplyFilterState[val] = true
end
- -- are we changing fontsize or narrow?
- if ((narrow == 1) or (textSize ~= 0)) then
-
- local font = normalFont
-
- if (narrow == 1) then
-
- font = narrowFont
-
- end
+ ARL_ApplyButton:SetNormalFontObject("GameFontDisableSmall")
+ ARL_ApplyButton:Disable()
- local fontsize = 11
+ for i,j in pairs(ApplyFilterState) do
- if (textSize ~= 0) then
+ if (j == true) then
- fontsize = fontsize + textSize
+ ARL_ApplyButton:SetNormalFontObject("GameFontNormalSmall")
+ ARL_ApplyButton:Enable()
+ break
end
-
- local numlines = arlTooltip:NumLines()
- local mytext1 = _G["arlTooltipTextLeft" .. numlines]
- mytext1:SetFont(font, fontsize)
- if (double == true) then
- local mytext2 = _G["arlTooltipTextRight" .. numlines]
- mytext2:SetFont(font, fontsize)
- end
end
@@ -1583,433 +1397,619 @@ end
-- Expected result:
-- Input:
-- Output:
--- Switch the displayed profession in the main panel
-function addon.SwitchProfs()
- -- Known professions should be in playerData["Professions"]
+local function HideARL_ExpOptCB(ignorevalue)
- -- This loop is gonna be weird. The reason is because we need to
- -- ensure that we cycle through all the known professions, but also
- -- that we do so in order. That means that if the currently displayed
- -- profession is the last one in the list, we're actually going to
- -- iterate completely once to get to the currently displayed profession
- -- and then iterate again to make sure we display the next one in line.
- -- Further, there is the nuance that the person may not know any
- -- professions yet at all. User are so annoying.
- local startLoop = 0
- local endLoop = 0
- local displayProf = 0
+ ARL_ExpGeneralOptCB.text:SetText(addon:Yellow(ExpButtonText[1]))
+ ARL_ExpObtainOptCB.text:SetText(addon:Yellow(ExpButtonText[2]))
+ ARL_ExpBindingOptCB.text:SetText(addon:Yellow(ExpButtonText[3]))
+ ARL_ExpItemOptCB.text:SetText(addon:Yellow(ExpButtonText[4]))
+ ARL_ExpPlayerOptCB.text:SetText(addon:Yellow(ExpButtonText[5]))
+ ARL_ExpRepOptCB.text:SetText(addon:White(ExpButtonText[6]))
+
+ if (ignorevalue ~= "general") then
+
+ ARL_ExpGeneralOptCB:SetChecked(false)
+ ARL_ExpGeneralOptCB.text:SetText(addon:Yellow(ExpButtonText[1]))
- -- ok, so first off, if we've never done this before, there is no "current"
- -- and a single iteration will do nicely, thank you
- if (currentProfIndex == 0) then
- startLoop = 1
- endLoop = addon.MaxProfessions + 1
else
- startLoop = currentProfIndex + 1
- endLoop = currentProfIndex
- end
- local index = startLoop
- while (index ~= endLoop) do
- if (index > MaxProfessions) then
- index = 1
- else
- if (playerData["Professions"][SortedProfessions[index].name] == true) then
- displayProf = index
- currentProfIndex = index
- break
- else
- index = index + 1
- end
- end
- end
- -- Redisplay the button with the new skill
- SetSwitcherTexture(SortedProfessions[currentProfIndex].texture)
- playerData.playerProfession = SortedProfessions[currentProfIndex].name
- ReDisplay()
-end
--- Description:
--- Expected result:
--- Input:
--- Output:
+ ARL_ExpGeneralOptCB.text:SetText(addon:White(ExpButtonText[1]))
-local function GenerateTooltipContent(owner, rIndex, playerFaction, exclude)
+ end
- local clr1, clr2 = "", ""
+ if (ignorevalue ~= "obtain") then
- arlTooltip:ClearLines()
- arlTooltip:SetOwner(owner, "ANCHOR_RIGHT")
- gttAdd(0, 1, 0, 0, recipeDB[rIndex]["Name"], addon:hexcolor("HIGH"))
+ ARL_ExpObtainOptCB:SetChecked(false)
+ ARL_ExpObtainOptCB.text:SetText(addon:Yellow(ExpButtonText[2]))
- -- check if the recipe is excluded
- if (exclude[rIndex] == true) then
+ else
- clr1 = addon:hexcolor("RED")
- gttAdd(0, -1, 1, 0, L["RECIPE_EXCLUDED"], clr1)
+ ARL_ExpObtainOptCB.text:SetText(addon:White(ExpButtonText[2]))
end
- -- Add in skill level requirement, colored correctly
- clr1 = addon:hexcolor("NORMAL")
+ if (ignorevalue ~= "binding") then
- local recipeSkill = recipeDB[rIndex]["Level"]
- local playerSkill = playerData.playerProfessionLevel
+ ARL_ExpBindingOptCB:SetChecked(false)
+ ARL_ExpBindingOptCB.text:SetText(addon:Yellow(ExpButtonText[3]))
- if (recipeSkill > playerSkill) then
+ else
- clr2 = addon:hexcolor("RED")
+ ARL_ExpBindingOptCB.text:SetText(addon:White(ExpButtonText[3]))
- elseif ((playerSkill - recipeSkill) < 20) then
+ end
- clr2 = addon:hexcolor("ORANGE")
+ if (ignorevalue ~= "item") then
+ ARL_ExpItemOptCB:SetChecked(false)
+ ARL_ExpItemOptCB.text:SetText(addon:Yellow(ExpButtonText[4]))
- elseif ((playerSkill - recipeSkill) < 30) then
+ else
- clr2 = addon:hexcolor("YELLOW")
+ ARL_ExpItemOptCB.text:SetText(addon:White(ExpButtonText[4]))
- elseif ((playerSkill - recipeSkill) < 40) then
+ end
- clr2 = addon:hexcolor("GREEN")
+ if (ignorevalue ~= "player") then
+
+ ARL_ExpPlayerOptCB:SetChecked(false)
+ ARL_ExpPlayerOptCB.text:SetText(addon:Yellow(ExpButtonText[5]))
else
- clr2 = addon:hexcolor("MIDGREY")
+ ARL_ExpPlayerOptCB.text:SetText(addon:White(ExpButtonText[5]))
end
- gttAdd(0, -1, 0, 0, L["Required Skill"] .. " :", clr1, recipeDB[rIndex]["Level"], clr2)
-
- -- spacer
- gttAdd(0, 0, 0, 0, ".", addon:hexcolor("BLACK"))
+ if (ignorevalue ~= "rep") then
- -- Binding info
- clr1 = addon:hexcolor("NORMAL")
+ ARL_ExpRepOptCB:SetChecked(false)
+ ARL_ExpRepOptCB.text:SetText(addon:Yellow(ExpButtonText[6]))
- if (recipeDB[rIndex]["Flags"][36]) then
+ else
- gttAdd(0, -1, 1, 0, L["BOEFilter"], clr1)
+ ARL_ExpRepOptCB.text:SetText(addon:White(ExpButtonText[6]))
end
- if (recipeDB[rIndex]["Flags"][37]) then
+end
- gttAdd(0, -1, 1, 0, L["BOPFilter"], clr1)
+-- Description:
+-- Expected result:
+-- Input:
+-- Output:
- end
+function addon.ToggleFilters()
- if (recipeDB[rIndex]["Flags"][38]) then
+ local xPos = addon.Frame:GetLeft()
+ local yPos = addon.Frame:GetBottom()
- gttAdd(0, -1, 1, 0, L["BOAFilter"], clr1)
+ if (addon.Frame._Expanded == true) then
+ -- Adjust the frame size and texture
+-- addon.Frame:Hide()
+ addon.Frame:ClearAllPoints()
+ addon.Frame:SetWidth(293)
+ addon.Frame:SetHeight(447)
+ addon.bgTexture:SetTexture([[Interface\Addons\AckisRecipeList\img\main]])
+ addon.bgTexture:SetAllPoints(addon.Frame)
+ addon.bgTexture:SetTexCoord(0, (293/512), 0, (447/512))
+ addon.Frame._Expanded = false
+ addon.Frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", xPos, yPos)
+ -- Change the text and tooltip for the filter button
+ ARL_FilterButton:SetText(L["FILTER_OPEN"])
+ addon:TooltipDisplay(ARL_FilterButton, L["FILTER_OPEN_DESC"])
- end
+ -- Hide my 5 buttons
+ ARL_ExpGeneralOptCB:Hide()
+ ARL_ExpObtainOptCB:Hide()
+ ARL_ExpBindingOptCB:Hide()
+ ARL_ExpItemOptCB:Hide()
+ ARL_ExpPlayerOptCB:Hide()
+ ARL_ExpRepOptCB:Hide()
- if (recipeDB[rIndex]["Flags"][40]) then
+ -- Uncheck the five buttons
+ HideARL_ExpOptCB()
- gttAdd(0, -1, 1, 0, L["RecipeBOEFilter"], clr1)
+ -- Hide the flyaway panel
+ addon.Flyaway:Hide()
- end
+ ARL_ResetButton:Hide()
+ ARL_ApplyButton:Hide()
- if (recipeDB[rIndex]["Flags"][41]) then
+ -- and finally, show our frame
+-- addon.Frame:Show()
+ else
- gttAdd(0, -1, 1, 0, L["RecipeBOPFilter"], clr1)
+ -- Adjust the frame size and texture
+-- addon.Frame:Hide()
+ addon.Frame:ClearAllPoints()
+ addon.Frame:SetWidth(444)
+ addon.Frame:SetHeight(447)
+ addon.bgTexture:SetTexture([[Interface\Addons\AckisRecipeList\img\expanded]])
+ addon.bgTexture:SetAllPoints(addon.Frame)
+ addon.bgTexture:SetTexCoord(0, (444/512), 0, (447/512))
+ addon.Frame._Expanded = true
+ addon.Frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", xPos, yPos)
- end
+ -- Change the text and tooltip for the filter button
+ ARL_FilterButton:SetText(L["FILTER_CLOSE"])
+ addon:TooltipDisplay(ARL_FilterButton, L["FILTER_CLOSE_DESC"])
- if (recipeDB[rIndex]["Flags"][42]) then
+ -- Show my 5 buttons
+ ARL_ExpGeneralOptCB:Show()
+ ARL_ExpObtainOptCB:Show()
+ ARL_ExpBindingOptCB:Show()
+ ARL_ExpItemOptCB:Show()
+ ARL_ExpPlayerOptCB:Show()
+ ARL_ExpRepOptCB:Show()
- gttAdd(0, -1, 1, 0, L["RecipeBOAFilter"], clr1)
+ ARL_ResetButton:Show()
+ ARL_ApplyButton:Show()
+ -- and finally, show our frame
+-- addon.Frame:Show()
end
- -- spacer
- gttAdd(0, 0, 0, 0, ".", addon:hexcolor("BLACK"))
+ -- Reset our title
+ addon.resetTitle()
- -- obtain info
- gttAdd(0, -1, 0, 0, L["Obtained From"] .. " : ", addon:hexcolor("NORMAL"))
+end
- -- loop through acquire methods, display each
- for k, v in pairs(recipeDB[rIndex]["Acquire"]) do
+-- Description:
+-- Expected result:
+-- Input:
+-- Output:
- -- Trainer
- if (v["Type"] == 1) then
+function addon:GenericMakeCB(cButton, anchorFrame, ttText, scriptVal, row, col, logo)
- -- Trainer: TrainerName
- -- TrainerZone TrainerCoords
- local trnr = trainerDB[v["ID"]]
- local cStr = ""
- -- Do we want to display this trainer?
- local displaytt = false
+ local pushdown = {
+ [64] = 1, [65] = 1, [66] = 1, [67] = 1, [25] = 1, [26] = 1, [27] = 1, [28] = 1, [29] = 1,
+ [30] = 1, [31] = 1, [32] = 1, [33] = 1, [34] = 1, [68] = 1, [35] = 1, [36] = 1, [37] = 1,
+ [38] = 1, [84] = 1, [85] = 1,
+ }
+ -- set the position of the new checkbox
+ local xPos = 2 + ((col - 1) * 100)
+ local yPos = -3 - ((row - 1) * 17)
+ if (pushdown[scriptVal]) then yPos = yPos - 5 end
+ cButton:SetPoint("TOPLEFT", anchorFrame, "TOPLEFT", xPos, yPos)
- clr1 = addon:hexcolor("TRAINER")
+ -- depending if we're on the rep logo thingers or not, set the height and an OnClick method
+ if (logo == 0) then
+ cButton:SetHeight(24)
+ cButton:SetWidth(24)
+ cButton:SetScript("OnClick", function() addon.filterSwitch(scriptVal) end)
+ else
+ cButton:SetHeight(46)
+ cButton:SetWidth(100)
+ cButton:SetScript("OnClick", function() addon.filterSwitch(scriptVal) end)
+ end
+
+ addon:TooltipDisplay(cButton, ttText, 1)
+
+end
+
+-- Description:
+-- Expected result:
+-- Input:
+-- Output:
- if (trnr["Faction"] == BFAC["Horde"]) then
+function addon:GenericCreateButton(
+ bName, parentFrame, bHeight, bWidth,
+ anchorFrom, anchorFrame, anchorTo, xOffset, yOffset,
+ bNormFont, bHighFont, initText, tAlign, tooltipText, noTextures)
- clr2 = addon:hexcolor("HORDE")
+ -- I hate stretchy buttons. Thanks very much to ckknight for this code
+ -- (found in RockConfig)
- if (playerFaction == BFAC["Horde"]) then
+ -- when pressed, the button should look pressed
+ local function button_OnMouseDown(this)
+ if this:IsEnabled() == 1 then
+ this.left:SetTexture([[Interface\Buttons\UI-Panel-Button-Down]])
+ this.middle:SetTexture([[Interface\Buttons\UI-Panel-Button-Down]])
+ this.right:SetTexture([[Interface\Buttons\UI-Panel-Button-Down]])
+ end
+ end
+ -- when depressed, return to normal
+ local function button_OnMouseUp(this)
+ if this:IsEnabled() == 1 then
+ this.left:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
+ this.middle:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
+ this.right:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
+ end
+ end
- displaytt = true
+ local function button_Disable(this)
+ this.left:SetTexture([[Interface\Buttons\UI-Panel-Button-Disabled]])
+ this.middle:SetTexture([[Interface\Buttons\UI-Panel-Button-Disabled]])
+ this.right:SetTexture([[Interface\Buttons\UI-Panel-Button-Disabled]])
+ this:__Disable()
+ this:EnableMouse(false)
+ end
- end
+ local function button_Enable(this)
+ this.left:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
+ this.middle:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
+ this.right:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
+ this:__Enable()
+ this:EnableMouse(true)
+ end
- elseif (trnr["Faction"] == BFAC["Alliance"]) then
+ local button = CreateFrame("Button", bName, parentFrame)
- clr2 = addon:hexcolor("ALLIANCE")
+ button:SetWidth(bWidth)
+ button:SetHeight(bHeight)
- if (playerFaction == BFAC["Alliance"]) then
+ if (noTextures == 1) then
+ local left = button:CreateTexture(button:GetName() .. "_LeftTexture", "BACKGROUND")
+ button.left = left
+ local middle = button:CreateTexture(button:GetName() .. "_MiddleTexture", "BACKGROUND")
+ button.middle = middle
+ local right = button:CreateTexture(button:GetName() .. "_RightTexture", "BACKGROUND")
+ button.right = right
- displaytt = true
+ left:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
+ middle:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
+ right:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
- end
+ left:SetPoint("TOPLEFT")
+ left:SetPoint("BOTTOMLEFT")
+ left:SetWidth(12)
+ left:SetTexCoord(0, 0.09375, 0, 0.6875)
- else
+ right:SetPoint("TOPRIGHT")
+ right:SetPoint("BOTTOMRIGHT")
+ right:SetWidth(12)
+ right:SetTexCoord(0.53125, 0.625, 0, 0.6875)
- clr2 = addon:hexcolor("NEUTRAL")
+ middle:SetPoint("TOPLEFT", left, "TOPRIGHT")
+ middle:SetPoint("BOTTOMRIGHT", right, "BOTTOMLEFT")
+ middle:SetTexCoord(0.09375, 0.53125, 0, 0.6875)
- end
+ button:SetScript("OnMouseDown", button_OnMouseDown)
+ button:SetScript("OnMouseUp", button_OnMouseUp)
+ button:SetScript("OnEnter", SubControl_OnEnter)
+ button:SetScript("OnLeave", SubControl_OnLeave)
- if (displaytt) then
+ button.__Enable = button.Enable
+ button.__Disable = button.Disable
+ button.Enable = button_Enable
+ button.Disable = button_Disable
- -- Add the trainer information to the tooltip
- gttAdd(0, -2, 0, 0, L["Trainer"], clr1, trnr["Name"], clr2)
+ local highlight = button:CreateTexture(button:GetName() .. "_Highlight", "OVERLAY", "UIPanelButtonHighlightTexture")
+ button:SetHighlightTexture(highlight)
+ elseif (noTextures == 2) then
+ button:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up")
+ button:SetPushedTexture("Interface\\Buttons\\UI-PlusButton-Down")
+ button:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
+ button:SetDisabledTexture("Interface\\Buttons\\UI-PlusButton-Disabled")
+ elseif (noTextures == 3) then
+ button:SetNormalTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Up")
+ button:SetPushedTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Down")
+ button:SetHighlightTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Hilight")
+ button:SetDisabledTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Disable")
+ end
- -- If we have a coordinate, add the coordinates to the tooltop
- if (trnr["Coordx"] ~= 0) and (trnr["Coordy"] ~= 0) then
+ local text = button:CreateFontString(button:GetName() .. "_FontString", "ARTWORK")
+ button:SetFontString(text)
+ button.text = text
+ text:SetPoint("LEFT", button, "LEFT", 7, 0)
+ text:SetPoint("RIGHT", button, "RIGHT", -7, 0)
+ text:SetJustifyH(tAlign)
- cStr = "(" .. trnr["Coordx"] .. ", " .. trnr["Coordy"] .. ")"
+ text:SetFontObject(bNormFont)
+-- text:SetHighlightFontObject(bHighFont)
+-- text:SetDisabledFontObject(GameFontDisableSmall)
- end
+ text:SetText(initText)
- clr1 = addon:hexcolor("NORMAL")
- clr2 = addon:hexcolor("HIGH")
- gttAdd(1, -2, 1, 0, trnr["Location"], clr1, cStr, clr2)
+ button:SetPoint(anchorFrom, anchorFrame, anchorTo, xOffset, yOffset)
- end
+ if (tooltipText ~= "") then
- -- Vendor
- elseif (v["Type"] == 2) then
+ addon:TooltipDisplay(button, tooltipText)
- -- Vendor: VendorName
- -- VendorZone VendorCoords
- local vndr = vendorDB[v["ID"]]
- local cStr = ""
+ end
- if (vndr["Coordx"] ~= 0) and (vndr["Coordy"] ~= 0) then
+ return button
- cStr = "(" .. vndr["Coordx"] .. ", " .. vndr["Coordy"] .. ")"
+end
- end
+-- Description:
+-- Expected result:
+-- Input:
+-- Output:
+-- Generic function for creating my expanded panel buttons
- clr1 = addon:hexcolor("VENDOR")
+function addon:CreateExpCB(bName, bTex, panelIndex)
+ local ExpTextureSize = 34
- if (vndr["Faction"] == BFAC["Horde"]) then
- clr2 = addon:hexcolor("HORDE")
- elseif (vndr["Faction"] == BFAC["Alliance"]) then
- clr2 = addon:hexcolor("ALLIANCE")
+ if ((bName == "ARL_RepOldWorldCB") or (bName == "ARL_RepBCCB") or (bName == "ARL_RepLKCB")) then
+ local cButton = CreateFrame("CheckButton", bName, addon.Fly_Rep) -- , "UICheckButtonTemplate")
+ cButton:SetWidth(100)
+ cButton:SetHeight(46)
+ cButton:SetChecked(false)
+
+ local iconTex = cButton:CreateTexture(cButton:GetName() .. "buttonTex", "BORDER")
+ if (bName == "ARL_RepLKCB") then
+ iconTex:SetTexture("Interface\\Addons\\AckisRecipeList\\img\\" .. bTex)
else
- clr2 = addon:hexcolor("NEUTRAL")
+ iconTex:SetTexture('Interface/Glues/Common/' .. bTex)
end
+ iconTex:SetWidth(100)
+ iconTex:SetHeight(46)
+ iconTex:SetAllPoints(cButton)
- gttAdd(0, -1, 0, 0, L["Vendor"], clr1, vndr["Name"], clr2)
- clr1 = addon:hexcolor("NORMAL")
- clr2 = addon:hexcolor("HIGH")
- gttAdd(1, -2, 1, 0, vndr["Location"], clr1, cStr, clr2)
-
- -- Mob Drop
- elseif (v["Type"] == 3) then
-
- -- Mob Drop: Mob Name
- -- MobZone MobCoords
- local mob = mobDB[v["ID"]]
- local cStr = ""
-
- if (mob["Coordx"] ~= 0) and (mob["Coordy"] ~= 0) then
+ local pushedTexture = cButton:CreateTexture(cButton:GetName() .. "pTex", "ARTWORK")
+ pushedTexture:SetTexture('Interface/Buttons/UI-Quickslot-Depress')
+ pushedTexture:SetAllPoints(cButton)
+ cButton:SetPushedTexture(pushedTexture)
+ local highlightTexture = cButton:CreateTexture()
+ highlightTexture:SetTexture('Interface/Buttons/ButtonHilight-Square')
+ highlightTexture:SetAllPoints(cButton)
+ highlightTexture:SetBlendMode('ADD')
+ cButton:SetHighlightTexture(highlightTexture)
+ local checkedTexture = cButton:CreateTexture()
+ checkedTexture:SetTexture('Interface/Buttons/CheckButtonHilight')
+ checkedTexture:SetAllPoints(cButton)
+ checkedTexture:SetBlendMode('ADD')
+ cButton:SetCheckedTexture(checkedTexture)
- cStr = "(" .. mob["Coordx"] .. ", " .. mob["Coordy"] .. ")"
+ -- And throw up a tooltip
+ if (bName == "ARL_RepOldWorldCB") then
+ addon:TooltipDisplay(cButton, L["FILTERING_OLDWORLD_DESC"])
+ elseif (bName == "ARL_RepBCCB") then
+ addon:TooltipDisplay(cButton, L["FILTERING_BC_DESC"])
+ else
+ addon:TooltipDisplay(cButton, L["FILTERING_WOTLK_DESC"])
+ end
- end
+ return cButton
+ else
+ local cButton = CreateFrame("CheckButton", bName, addon.Frame) -- , "UICheckButtonTemplate")
+ cButton:SetWidth(ExpTextureSize)
+ cButton:SetHeight(ExpTextureSize)
+ cButton:SetScript("OnClick", function()
+ addon.DoFlyaway(panelIndex)
+ end)
- clr1 = addon:hexcolor("MOBDROP")
- clr2 = addon:hexcolor("HORDE")
- gttAdd(0, -1, 0, 0, L["Mob Drop"], clr1, mob["Name"], clr2)
- clr1 = addon:hexcolor("NORMAL")
- clr2 = addon:hexcolor("HIGH")
- gttAdd(1, -2, 1, 0, mob["Location"], clr1, cStr, clr2)
+ local bgTex = cButton:CreateTexture(cButton:GetName() .. "bgTex", "BACKGROUND")
+ bgTex:SetTexture('Interface/SpellBook/UI-Spellbook-SpellBackground')
+ bgTex:SetHeight(ExpTextureSize + 6)
+ bgTex:SetWidth(ExpTextureSize + 4)
+ bgTex:SetTexCoord(0, (43/64), 0, (43/64))
+ bgTex:SetPoint("CENTER", cButton, "CENTER", 0, 0)
+ local iconTex = cButton:CreateTexture(cButton:GetName() .. "iconTex", "BORDER")
+ iconTex:SetTexture('Interface/Icons/' .. bTex)
+ iconTex:SetAllPoints(cButton)
+ local pushedTexture = cButton:CreateTexture(cButton:GetName() .. "pTex", "ARTWORK")
+ pushedTexture:SetTexture('Interface/Buttons/UI-Quickslot-Depress')
+ pushedTexture:SetAllPoints(cButton)
+ cButton:SetPushedTexture(pushedTexture)
+ local highlightTexture = cButton:CreateTexture()
+ highlightTexture:SetTexture('Interface/Buttons/ButtonHilight-Square')
+ highlightTexture:SetAllPoints(cButton)
+ highlightTexture:SetBlendMode('ADD')
+ cButton:SetHighlightTexture(highlightTexture)
+ local checkedTexture = cButton:CreateTexture()
+ checkedTexture:SetTexture('Interface/Buttons/CheckButtonHilight')
+ checkedTexture:SetAllPoints(cButton)
+ checkedTexture:SetBlendMode('ADD')
+ cButton:SetCheckedTexture(checkedTexture)
+ -- Create the text object to go along with it
+ local cbText = cButton:CreateFontString("cbText", "OVERLAY", "GameFontHighlight")
+ cbText:SetText(addon:Yellow(ExpButtonText[panelIndex]))
+ cbText:SetPoint("LEFT", cButton, "RIGHT", 5, 0)
+ cbText:SetHeight(14)
+ cbText:SetWidth(100)
+ cbText:SetJustifyH("LEFT")
+ cButton.text = cbText
- -- Quest
- elseif (v["Type"] == 4) then
+ -- And throw up a tooltip
+ addon:TooltipDisplay(cButton, ExpButtonTT[panelIndex])
+ cButton:Hide()
+ return cButton
- -- Quest: QuestName
- -- QuestZone QuestCoords
- local qst = questDB[v["ID"]]
+ end
- if (qst ~= nil) then
+end
- local cStr = ""
+-- Description:
+-- Expected result:
+-- Input:
+-- Output:
- if (qst["Coordx"] ~= 0) and (qst["Coordy"] ~= 0) then
+function addon:ToggleFrame()
- cStr = "(" .. qst["Coordx"] .. ", " .. qst["Coordy"] .. ")"
+ if (addon.Frame and addon.Frame:IsVisible()) then
- end
+ addon.Frame:Hide()
+
+ else
- clr1 = addon:hexcolor("QUEST")
+ addon:AckisRecipeList_Command()
- if (qst["Faction"] == BFAC["Horde"]) then
- clr2 = addon:hexcolor("HORDE")
- elseif (qst["Faction"] == BFAC["Alliance"]) then
- clr2 = addon:hexcolor("ALLIANCE")
- else
- clr2 = addon:hexcolor("NEUTRAL")
- end
+ end
- gttAdd(0, -1, 0, 0, L["Quest"], clr1, qst["Name"], clr2)
- clr1 = addon:hexcolor("NORMAL")
- clr2 = addon:hexcolor("HIGH")
- gttAdd(1, -2, 1, 0, qst["Location"], clr1, cStr, clr2)
+end
- end
+-- Description:
+-- Expected result:
+-- Input:
+-- Output:
+-- Set the texture on the switcher button.
- -- Seasonal
- elseif (v["Type"] == 5) then
+local function SetSwitcherTexture(tex)
+-- This is really only called the first time its displayed. It should reflect the first
+-- profession the user has selected, or that shows up in his lists.
- -- Seasonal: SeasonEventName
- local ssnname = seasonDB[v["ID"]]["Name"]
+-- For now, just display the first texture
+ local ARL_S_NTexture = ARL_SwitcherButton:CreateTexture("ARL_S_NTexture", "BACKGROUND")
+ ARL_S_NTexture:SetTexture([[Interface\Addons\AckisRecipeList\img\]] .. tex .. [[_up]])
+ ARL_S_NTexture:SetTexCoord(0, 1, 0, 1)
+ ARL_S_NTexture:SetAllPoints(ARL_SwitcherButton)
+ local ARL_S_PTexture = ARL_SwitcherButton:CreateTexture("ARL_S_PTexture", "BACKGROUND")
+ ARL_S_PTexture:SetTexture([[Interface\Addons\AckisRecipeList\img\]] .. tex .. [[_down]])
+ ARL_S_PTexture:SetTexCoord(0, 1, 0, 1)
+ ARL_S_PTexture:SetAllPoints(ARL_SwitcherButton)
+ local ARL_S_DTexture = ARL_SwitcherButton:CreateTexture("ARL_S_DTexture", "BACKGROUND")
+ ARL_S_DTexture:SetTexture([[Interface\Addons\AckisRecipeList\img\]] .. tex .. [[_up]])
+ ARL_S_DTexture:SetTexCoord(0, 1, 0, 1)
+ ARL_S_DTexture:SetAllPoints(ARL_SwitcherButton)
- clr1 = addon:hexcolor("SEASON")
- gttAdd(0, -1, 0, 0, L["Seasonal"], clr1, ssnname, clr1)
+ ARL_SwitcherButton:SetNormalTexture(ARL_S_NTexture)
+ ARL_SwitcherButton:SetPushedTexture(ARL_S_PTexture)
+ ARL_SwitcherButton:SetDisabledTexture(ARL_S_DTexture)
- -- Reputation
- elseif (v["Type"] == 6) then
+end
- -- Reputation: Faction
- -- FactionLevel RepVendor
- -- RepVendorZone RepVendorCoords
+-- Description:
+-- Expected result:
+-- Input:
+-- Output:
+-- converting from hex to rgb (Thanks Maldivia)
- local repfac = repDB[v["ID"]]
- local repname = repfac["Name"] -- name
- local rplvl = v["RepLevel"]
- local repvndr = vendorDB[v["RepVendor"]]
- local cStr = ""
+local function toRGB(hex)
- if (repvndr["Coordx"] ~= 0) and (repvndr["Coordy"] ~= 0) then
+ local r, g, b = hex:match("(..)(..)(..)")
- cStr = "(" .. repvndr["Coordx"] .. ", " .. repvndr["Coordy"] .. ")"
+ return (tonumber(r,16) / 256) , (tonumber(g,16) / 256) , (tonumber(b,16) / 256)
- end
-
- clr1 = addon:hexcolor("REP")
- clr2 = addon:hexcolor("NORMAL")
- gttAdd(0, -1, 0, 0, L["Reputation"], clr1, repname, clr2)
+end
- local rStr = ""
- if (rplvl == 0) then
- rStr = BFAC["Neutral"]
- clr1 = addon:hexcolor("NEUTRAL")
- elseif (rplvl == 1) then
- rStr = BFAC["Neutral"]
- clr1 = addon:hexcolor("FRIENDLY")
- elseif (rplvl == 2) then
- rStr = BFAC["Honored"]
- clr1 = addon:hexcolor("HONORED")
- elseif (rplvl == 3) then
- rStr = BFAC["Revered"]
- clr1 = addon:hexcolor("REVERED")
- else
- rStr = BFAC["Exalted"]
- clr1 = addon:hexcolor("EXALTED")
- end
+-- Description:
+-- Expected result:
+-- Input:
+-- Output:
+-- I want to do a bit more comprehensive tooltip processing. Things like changing font sizes,
+-- adding padding to the left hand side, and using better color handling. So... this function
+-- will do that for me.
- if (repvndr["Faction"] == BFAC["Horde"]) then
- clr2 = addon:hexcolor("HORDE")
- elseif (repvndr["Faction"] == BFAC["Alliance"]) then
- clr2 = addon:hexcolor("ALLIANCE")
- else
- clr2 = addon:hexcolor("NEUTRAL")
- end
+local function gttAdd(
+ leftPad, -- number of times to pad two spaces on left side
+ textSize, -- negative number. subtract from 12 to get fontsize
+ narrow, -- if 1, use ARIALN instead of FRITZQ
+ wraptext, -- wraptext for AddLine (0 or 1)
+ str1, -- left hand string
+ hexcolor1, -- hex color code for left hand side
+ str2, -- if present, this is a double line, and this is the right hand string
+ hexcolor2) -- if present, hex color code for right hand side
- gttAdd(1, -2, 0, 0, rStr, clr1, repvndr["Name"], clr2)
- clr1 = addon:hexcolor("NORMAL")
- clr2 = addon:hexcolor("HIGH")
- gttAdd(2, -2, 1, 0, repvndr["Location"], clr1, cStr, clr2)
+ -- convert hex colors to r g b components. tooltips are dumb that way
- -- World Drop
- elseif (v["Type"] == 7) then
+ local a, b, c = toRGB(hexcolor1)
+ local d, e, f = 0, 0, 0
- -- World Drop RarityLevel
- if (v["ID"] == 1) then
+ if (hexcolor2) then
- clr1 = addon:hexcolor("COMMON")
+ d, e, f = toRGB(hexcolor2)
- elseif (v["ID"] == 2) then
+ end
- clr1 = addon:hexcolor("UNCOMMON")
+ -- Add in our left hand padding
+ local looppad = leftPad
+ local leftStr = str1
- elseif (v["ID"] == 3) then
+ while (looppad > 0) do
- clr1 = addon:hexcolor("RARE")
+ leftStr = " " .. leftStr
+ looppad = looppad - 1
- elseif (v["ID"] == 4) then
+ end
- clr1 = addon:hexcolor("EPIC")
+ -- Are we adding a single or double line?
+ local double = false
- else
+ if (str2) then
- clr1 = addon:hexcolor("NORMAL")
+ arlTooltip:AddDoubleLine(leftStr, str2, a, b, c, d, e, f)
+ double = true
- end
+ else
- gttAdd(0, -1, 0, 0, L["World Drop"], clr1)
+ arlTooltip:AddLine(leftStr, a, b, c, wraptext)
- -- Custom entry
- elseif (v["Type"] == 8) then
+ end
- -- Seasonal: SeasonEventName
- local customname = customDB[v["ID"]]["Name"]
+ -- are we changing fontsize or narrow?
+ if ((narrow == 1) or (textSize ~= 0)) then
- clr1 = addon:hexcolor("NORMAL")
- gttAdd(0, -1, 0, 0, customname, clr1)
+ local font = normalFont
- -- Unhandled
- else
+ if (narrow == 1) then
- clr1 = addon:hexcolor("NORMAL")
- gttAdd(0, -1, 0, 0, L["Unhandled Recipe"], clr1)
+ font = narrowFont
end
- end
+ local fontsize = 11
- -- Spacer
- gttAdd(0, 0, 0, 0, ".", addon:hexcolor("BLACK"))
+ if (textSize ~= 0) then
- clr1 = addon:hexcolor("NORMAL")
+ fontsize = fontsize + textSize
- gttAdd(0, -1, 0, 0, L["ALT_CLICK"], clr1)
- gttAdd(0, -1, 0, 1, L["CTRL_CLICK"], clr1)
- gttAdd(0, -1, 0, 1, L["SHIFT_CLICK"], clr1)
+ end
+
+ local numlines = arlTooltip:NumLines()
+ local mytext1 = _G["arlTooltipTextLeft" .. numlines]
+ mytext1:SetFont(font, fontsize)
+ if (double == true) then
+ local mytext2 = _G["arlTooltipTextRight" .. numlines]
+ mytext2:SetFont(font, fontsize)
+ end
- local spelllink = recipeDB[rIndex]["RecipeLink"]
+ end
- if (spelllink) then
+end
- arlTooltip2:SetOwner(arlTooltip, "ANCHOR_NONE")
--- arlTooltip2:ClearAllPoints()
- --arlTooltip2:SetPoint("TOPLEFT", arlTooltip, "TOPRIGHT")
- arlTooltip2:SetPoint("TOPRIGHT", arlTooltip, "TOPLEFT")
- arlTooltip2:SetHyperlink(spelllink)
- arlTooltip2:Show()
+-- Description:
+-- Expected result:
+-- Input:
+-- Output:
+-- Switch the displayed profession in the main panel
- else
+function addon.SwitchProfs()
+ -- Known professions should be in playerData["Professions"]
- arlTooltip2:Hide()
+ -- This loop is gonna be weird. The reason is because we need to
+ -- ensure that we cycle through all the known professions, but also
+ -- that we do so in order. That means that if the currently displayed
+ -- profession is the last one in the list, we're actually going to
+ -- iterate completely once to get to the currently displayed profession
+ -- and then iterate again to make sure we display the next one in line.
+ -- Further, there is the nuance that the person may not know any
+ -- professions yet at all. User are so annoying.
+ local startLoop = 0
+ local endLoop = 0
+ local displayProf = 0
+ -- ok, so first off, if we've never done this before, there is no "current"
+ -- and a single iteration will do nicely, thank you
+ if (currentProfIndex == 0) then
+ startLoop = 1
+ endLoop = addon.MaxProfessions + 1
+ else
+ startLoop = currentProfIndex + 1
+ endLoop = currentProfIndex
end
-
- arlTooltip:Show()
-
+ local index = startLoop
+ while (index ~= endLoop) do
+ if (index > MaxProfessions) then
+ index = 1
+ else
+ if (playerData["Professions"][SortedProfessions[index].name] == true) then
+ displayProf = index
+ currentProfIndex = index
+ break
+ else
+ index = index + 1
+ end
+ end
+ end
+ -- Redisplay the button with the new skill
+ SetSwitcherTexture(SortedProfessions[currentProfIndex].texture)
+ playerData.playerProfession = SortedProfessions[currentProfIndex].name
+ ReDisplay()
end
-- Description: