mirror of
https://codeberg.org/Duvelcorp/MetaHunt.git
synced 2026-09-24 08:36:06 +00:00
Add trainer planning and level-up tracking
This commit is contained in:
+356
-38
@@ -147,6 +147,7 @@ local MTH_BOOK_STATE = {
|
||||
familyStatsPercent = false,
|
||||
petHideNoAbilities = true,
|
||||
petHideUnknown = true,
|
||||
trainerHonoredDiscount = false,
|
||||
forcedBeastId = nil,
|
||||
page = 1,
|
||||
pageSize = 16,
|
||||
@@ -170,6 +171,8 @@ local MTH_BOOK_STATE = {
|
||||
npcs = { col = nil, asc = true },
|
||||
stable = { col = nil, asc = true },
|
||||
pethistory = { col = 5, asc = false },
|
||||
hunterspells = { col = 3, asc = true },
|
||||
petspells = { col = 3, asc = true },
|
||||
},
|
||||
sliderDragging = false,
|
||||
}
|
||||
@@ -308,6 +311,17 @@ local MTH_BOOK_CONTENT_LAYOUT_ITEMS = {
|
||||
detailH = 366,
|
||||
}
|
||||
|
||||
local MTH_BOOK_CONTENT_LAYOUT_TRAINERS = {
|
||||
listX = 16,
|
||||
listY = -146,
|
||||
listW = 564,
|
||||
listH = 374,
|
||||
detailX = 608,
|
||||
detailY = -146,
|
||||
detailW = 136,
|
||||
detailH = 230,
|
||||
}
|
||||
|
||||
local MTH_BOOK_CONTENT_LAYOUT_PETABILITIES = {
|
||||
listX = 16,
|
||||
listY = -106,
|
||||
@@ -363,7 +377,52 @@ local MTH_BOOK_CONTENT_LAYOUT_HISTORY = {
|
||||
detailH = 446,
|
||||
}
|
||||
|
||||
local function MTH_BOOK_ApplyContentLayoutForMode()
|
||||
function MTH_BOOK_ConfigureTrainerDetailScroll(isTrainerMode, detailParent, detailText)
|
||||
if not (detailParent and detailText) then return end
|
||||
if isTrainerMode then
|
||||
if not detailParent.mthTrainerDetailScroll then
|
||||
local scroll = CreateFrame("ScrollFrame", "MTH_BOOK_TrainerDetailScroll", detailParent, "UIPanelScrollFrameTemplate")
|
||||
scroll:SetPoint("TOPLEFT", detailParent, "TOPLEFT", 4, -4)
|
||||
scroll:SetPoint("BOTTOMRIGHT", detailParent, "BOTTOMRIGHT", -24, 4)
|
||||
detailParent.mthTrainerDetailScroll = scroll
|
||||
detailText:EnableMouseWheel(true)
|
||||
detailText:SetScript("OnMouseWheel", function()
|
||||
local current = scroll:GetVerticalScroll()
|
||||
if arg1 and arg1 > 0 then
|
||||
scroll:SetVerticalScroll(current - 24)
|
||||
else
|
||||
scroll:SetVerticalScroll(current + 24)
|
||||
end
|
||||
end)
|
||||
end
|
||||
local scroll = detailParent.mthTrainerDetailScroll
|
||||
detailText.mthTrainerDetailParent = detailParent
|
||||
detailText.mthTrainerDetailScroll = scroll
|
||||
if detailText:GetParent() ~= scroll then detailText:SetParent(scroll) end
|
||||
detailText:ClearAllPoints()
|
||||
detailText:SetPoint("TOPLEFT", scroll, "TOPLEFT", 0, 0)
|
||||
scroll:SetScrollChild(detailText)
|
||||
scroll:SetWidth(detailParent:GetWidth() - 28)
|
||||
scroll:SetHeight(detailParent:GetHeight() - 8)
|
||||
detailText:SetWidth(detailParent:GetWidth() - 28)
|
||||
detailText:SetHeight(scroll:GetHeight())
|
||||
scroll:Show()
|
||||
else
|
||||
local scroll = detailParent.mthTrainerDetailScroll
|
||||
if scroll then scroll:Hide() end
|
||||
if detailText.mthTrainerDetailParent then
|
||||
detailText:SetParent(detailText.mthTrainerDetailParent)
|
||||
detailText:ClearAllPoints()
|
||||
detailText:SetPoint("TOPLEFT", detailParent, "TOPLEFT", 6, -6)
|
||||
detailText:SetWidth(detailParent:GetWidth() - 12)
|
||||
detailText:SetHeight(detailParent:GetHeight() - 12)
|
||||
if detailText.SetTextInsets then detailText:SetTextInsets(4, 4, 4, 4) end
|
||||
detailText.mthTrainerDetailScroll = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function MTH_BOOK_ApplyContentLayoutForMode()
|
||||
local listParent = getglobal("MTH_BOOK_ListBackdrop")
|
||||
local detailParent = getglobal("MTH_BOOK_DetailBackdrop")
|
||||
local detailText = getglobal("MTH_BOOK_DetailBackdropDetailText")
|
||||
@@ -374,6 +433,9 @@ local function MTH_BOOK_ApplyContentLayoutForMode()
|
||||
local layout = MTH_BOOK_CONTENT_LAYOUT_DEFAULT
|
||||
if MTH_BOOK_STATE.mode == "petabilities" then
|
||||
layout = MTH_BOOK_CONTENT_LAYOUT_PETABILITIES
|
||||
elseif type(MTH_BOOKTAB_IsTrainerSpellMode) == "function"
|
||||
and MTH_BOOKTAB_IsTrainerSpellMode(MTH_BOOK_STATE.mode) then
|
||||
layout = MTH_BOOK_CONTENT_LAYOUT_TRAINERS
|
||||
elseif MTH_BOOK_IsItemMode() then
|
||||
layout = MTH_BOOK_CONTENT_LAYOUT_ITEMS
|
||||
elseif MTH_BOOK_STATE.mode == "npcs" then
|
||||
@@ -411,6 +473,9 @@ local function MTH_BOOK_ApplyContentLayoutForMode()
|
||||
if listSlider then
|
||||
listSlider:SetHeight(sliderHeight)
|
||||
end
|
||||
local isTrainerMode = type(MTH_BOOKTAB_IsTrainerSpellMode) == "function"
|
||||
and MTH_BOOKTAB_IsTrainerSpellMode(MTH_BOOK_STATE.mode)
|
||||
MTH_BOOK_ConfigureTrainerDetailScroll(isTrainerMode, detailParent, detailText)
|
||||
|
||||
if MTH_BOOK_STATE.petUI then
|
||||
local paneHeight = layout.listH - 8
|
||||
@@ -477,6 +542,45 @@ local function MTH_BOOK_DropdownCreateInfo()
|
||||
return {}
|
||||
end
|
||||
|
||||
function MTH_BOOK_EnsureTrainerStatusDropdown()
|
||||
local dropdown = getglobal("MTH_BOOK_TrainerStatusDropdown")
|
||||
if not dropdown then
|
||||
local filter = getglobal("MTH_BOOK_Filter1")
|
||||
local parent = filter and filter:GetParent()
|
||||
if not parent then return nil end
|
||||
dropdown = CreateFrame("Frame", "MTH_BOOK_TrainerStatusDropdown", parent, "UIDropDownMenuTemplate")
|
||||
dropdown:SetPoint("TOPLEFT", parent, "TOPLEFT", 150, -116)
|
||||
UIDropDownMenu_Initialize(dropdown, function()
|
||||
local options = {
|
||||
{ value = "all", label = "All" },
|
||||
{ value = "known", label = "Known" },
|
||||
{ value = "notlearned", label = "Not learned" },
|
||||
{ value = "notyet", label = "Not yet learnable" },
|
||||
}
|
||||
for i = 1, table.getn(options) do
|
||||
local option = options[i]
|
||||
local value = option.value
|
||||
local label = option.label
|
||||
local info = MTH_BOOK_DropdownCreateInfo()
|
||||
info.text = label
|
||||
info.checked = MTH_BOOK_STATE.quick == value
|
||||
info.func = function()
|
||||
MTH_BOOK_STATE.quick = value
|
||||
MTH_BOOK_STATE.page = 1
|
||||
MTH_BOOK_STATE.selectedEntry = nil
|
||||
MTH_BOOK_DropdownSetText(dropdown, label)
|
||||
MTH_BOOK_RefreshFilter()
|
||||
end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
end
|
||||
end)
|
||||
UIDropDownMenu_SetWidth(136, dropdown)
|
||||
UIDropDownMenu_JustifyText("LEFT", dropdown)
|
||||
dropdown:Hide()
|
||||
end
|
||||
return dropdown
|
||||
end
|
||||
|
||||
local function MTH_BOOK_SetSliderFromCursor(slider)
|
||||
if not slider then return end
|
||||
local minValue, maxValue = slider:GetMinMaxValues()
|
||||
@@ -1459,6 +1563,12 @@ local function MTH_BOOK_GetSortKey(entry, col)
|
||||
if col == 6 then return MTH_BOOK_SafeLower(tostring(row.abandonReason or "")) end
|
||||
end
|
||||
|
||||
if type(MTH_BOOKTAB_IsTrainerSpellMode) == "function"
|
||||
and MTH_BOOKTAB_IsTrainerSpellMode(MTH_BOOK_STATE.mode) then
|
||||
return type(MTH_BOOKTAB_GetTrainerSpellSortKey) == "function"
|
||||
and MTH_BOOKTAB_GetTrainerSpellSortKey(entry, col) or nil
|
||||
end
|
||||
|
||||
local items = MTH_BOOK_GetItemsTable()
|
||||
local item = items and items[entry]
|
||||
if not item then return nil end
|
||||
@@ -1514,6 +1624,10 @@ local function MTH_BOOK_DefaultCompare(a, b)
|
||||
if MTH_BOOK_STATE.mode == "npcs" then return MTH_BOOK_NPCSort(a, b) end
|
||||
if MTH_BOOK_STATE.mode == "stable" then return MTH_BOOK_StableSort(a, b) end
|
||||
if MTH_BOOK_STATE.mode == "pethistory" then return MTH_BOOK_PetHistorySort(a, b) end
|
||||
if type(MTH_BOOKTAB_IsTrainerSpellMode) == "function"
|
||||
and MTH_BOOKTAB_IsTrainerSpellMode(MTH_BOOK_STATE.mode) then
|
||||
return type(MTH_BOOKTAB_TrainerSpellSort) == "function" and MTH_BOOKTAB_TrainerSpellSort(a, b) or false
|
||||
end
|
||||
return MTH_BOOK_ItemSort(a, b)
|
||||
end
|
||||
|
||||
@@ -1782,6 +1896,15 @@ local function MTH_BOOK_BuildResults()
|
||||
return results
|
||||
end
|
||||
|
||||
if type(MTH_BOOKTAB_IsTrainerSpellMode) == "function"
|
||||
and MTH_BOOKTAB_IsTrainerSpellMode(MTH_BOOK_STATE.mode) then
|
||||
if type(MTH_BOOKTAB_BuildTrainerSpellResults) == "function" then
|
||||
results = MTH_BOOKTAB_BuildTrainerSpellResults()
|
||||
end
|
||||
MTH_BOOK_ApplyActiveSort(results)
|
||||
return results
|
||||
end
|
||||
|
||||
local items = MTH_BOOK_GetItemsTable()
|
||||
if not items then return results end
|
||||
for itemId, item in pairs(items) do
|
||||
@@ -1825,6 +1948,10 @@ local function MTH_BOOK_GetTotalCount()
|
||||
local store = MTH_BOOK_GetPetDatastore()
|
||||
return (type(store) == "table" and type(store.historyById) == "table") and MTH_BOOK_CountMap(store.historyById) or 0
|
||||
end
|
||||
if type(MTH_BOOKTAB_IsTrainerSpellMode) == "function"
|
||||
and MTH_BOOKTAB_IsTrainerSpellMode(MTH_BOOK_STATE.mode) then
|
||||
return type(MTH_BOOKTAB_GetTrainerSpellTotal) == "function" and MTH_BOOKTAB_GetTrainerSpellTotal() or 0
|
||||
end
|
||||
local items = MTH_BOOK_GetItemsTable()
|
||||
return items and MTH_BOOK_CountMap(items) or 0
|
||||
end
|
||||
@@ -2328,7 +2455,9 @@ end
|
||||
|
||||
local function MTH_BOOK_UpdateQuickFilterControls()
|
||||
MTH_BOOK_UpdateCheckboxLayoutByMode()
|
||||
if MTH_BOOK_IsItemMode() then
|
||||
if type(MTH_BOOKTAB_IsTrainerSpellMode) == "function" and MTH_BOOKTAB_IsTrainerSpellMode(MTH_BOOK_STATE.mode) then
|
||||
MTH_BOOK_STATE.pageSize = 17
|
||||
elseif MTH_BOOK_IsItemMode() then
|
||||
MTH_BOOK_STATE.pageSize = 18
|
||||
elseif MTH_BOOK_STATE.mode == "families" then
|
||||
MTH_BOOK_STATE.pageSize = MTH_BOOK_MAX_ROWS
|
||||
@@ -2350,6 +2479,7 @@ local function MTH_BOOK_UpdateQuickFilterControls()
|
||||
local itemSubtypeDropdown = getglobal("MTH_BOOK_ItemSubtypeDropdown")
|
||||
local npcFunctionDropdown = getglobal("MTH_BOOK_NPCFunctionDropdown")
|
||||
local npcZoneDropdown = getglobal("MTH_BOOK_NPCZoneDropdown")
|
||||
local trainerStatusDropdown = MTH_BOOK_EnsureTrainerStatusDropdown()
|
||||
local searchLabel = getglobal("MTH_BOOK_SearchLabel")
|
||||
local minLabel = getglobal("MTH_BOOK_MinLabel")
|
||||
local maxLabel = getglobal("MTH_BOOK_MaxLabel")
|
||||
@@ -2359,6 +2489,7 @@ local function MTH_BOOK_UpdateQuickFilterControls()
|
||||
local hideNoAbilities = getglobal("MTH_BOOK_HideNoAbilities")
|
||||
local hideUnknown = getglobal("MTH_BOOK_HideUnknown")
|
||||
local petOnlyMyLevel = getglobal("MTH_BOOK_PetOnlyMyLevel")
|
||||
local trainerHonoredDiscount = getglobal("MTH_BOOK_TrainerHonoredDiscount")
|
||||
local petInZoneOnly = getglobal("MTH_BOOK_PetInZoneOnly")
|
||||
local npcInZoneOnly = getglobal("MTH_BOOK_NPCInZoneOnly")
|
||||
local showAllOnMapButton = getglobal("MTH_BOOK_ShowAllOnMapButton")
|
||||
@@ -2369,6 +2500,7 @@ local function MTH_BOOK_UpdateQuickFilterControls()
|
||||
local nextButton = getglobal("MTH_BOOK_NextButton")
|
||||
local listSlider = getglobal("MTH_BOOK_ListSlider")
|
||||
local sliderBackdrop = getglobal("MTH_BOOK_ListSliderBackdrop")
|
||||
if trainerStatusDropdown then trainerStatusDropdown:Hide() end
|
||||
|
||||
if MTH_BOOK_STATE.mode == "petabilities" or MTH_BOOK_STATE.mode == "stable" then
|
||||
if stats then stats:Hide() end
|
||||
@@ -2543,6 +2675,59 @@ local function MTH_BOOK_UpdateQuickFilterControls()
|
||||
resetButton:ClearAllPoints()
|
||||
resetButton:SetPoint("TOPLEFT", resetButton:GetParent(), "TOPLEFT", 546, -80)
|
||||
end
|
||||
elseif type(MTH_BOOKTAB_IsTrainerSpellMode) == "function"
|
||||
and MTH_BOOKTAB_IsTrainerSpellMode(MTH_BOOK_STATE.mode) then
|
||||
if searchLabel then searchLabel:Show() end
|
||||
if minLabel then minLabel:Show() end
|
||||
if maxLabel then maxLabel:Show() end
|
||||
if search then search:Show(); search:ClearAllPoints(); search:SetPoint("TOPLEFT", search:GetParent(), "TOPLEFT", 66, -80); search:SetWidth(160) end
|
||||
if minLevel then minLevel:Show(); minLevel:ClearAllPoints(); minLevel:SetPoint("TOPLEFT", minLevel:GetParent(), "TOPLEFT", 302, -80) end
|
||||
if maxLevel then maxLevel:Show(); maxLevel:ClearAllPoints(); maxLevel:SetPoint("TOPLEFT", maxLevel:GetParent(), "TOPLEFT", 414, -80) end
|
||||
if applyButton then applyButton:Show(); applyButton:ClearAllPoints(); applyButton:SetPoint("TOPLEFT", applyButton:GetParent(), "TOPLEFT", 478, -80) end
|
||||
local resetButton = getglobal("MTH_BOOK_ResetButton")
|
||||
if resetButton then resetButton:Show(); resetButton:ClearAllPoints(); resetButton:SetPoint("TOPLEFT", resetButton:GetParent(), "TOPLEFT", 546, -80) end
|
||||
if scanButton then scanButton:Hide() end
|
||||
for i = 1, 6 do
|
||||
local btn = getglobal("MTH_BOOK_Filter" .. i)
|
||||
if btn then btn:Hide() end
|
||||
end
|
||||
if trainerStatusDropdown then
|
||||
local labels = { all = "All", known = "Known", notlearned = "Not learned", notyet = "Not yet learnable" }
|
||||
trainerStatusDropdown:ClearAllPoints()
|
||||
trainerStatusDropdown:SetPoint("TOPLEFT", trainerStatusDropdown:GetParent(), "TOPLEFT", 150, -116)
|
||||
MTH_BOOK_DropdownSetText(trainerStatusDropdown, labels[MTH_BOOK_STATE.quick] or "All")
|
||||
trainerStatusDropdown:Show()
|
||||
end
|
||||
if familyDropdown then familyDropdown:Hide() end
|
||||
if abilityDropdown then abilityDropdown:Hide() end
|
||||
if rankDropdown then rankDropdown:Hide() end
|
||||
if petLearnSourceDropdown then petLearnSourceDropdown:Hide() end
|
||||
if beastZoneLabel then beastZoneLabel:Hide() end
|
||||
if beastContinentDropdown then beastContinentDropdown:Hide() end
|
||||
if beastZoneDropdown then beastZoneDropdown:Hide() end
|
||||
if itemSubtypeDropdown then itemSubtypeDropdown:Hide() end
|
||||
if npcFunctionDropdown then npcFunctionDropdown:Hide() end
|
||||
if npcZoneDropdown then npcZoneDropdown:Hide() end
|
||||
if hideNoAbilities then hideNoAbilities:Hide() end
|
||||
if hideUnknown then hideUnknown:Hide() end
|
||||
if petOnlyMyLevel then petOnlyMyLevel:Hide() end
|
||||
if trainerHonoredDiscount then
|
||||
trainerHonoredDiscount:ClearAllPoints()
|
||||
trainerHonoredDiscount:SetPoint("TOPLEFT", trainerHonoredDiscount:GetParent(), "TOPLEFT", 18, -110)
|
||||
trainerHonoredDiscount:SetChecked(MTH_BOOK_STATE.trainerHonoredDiscount and 1 or nil)
|
||||
local trainerHonoredDiscountText = getglobal("MTH_BOOK_TrainerHonoredDiscountText")
|
||||
if trainerHonoredDiscountText then trainerHonoredDiscountText:SetText("Honored prices") end
|
||||
trainerHonoredDiscount:Show()
|
||||
end
|
||||
if petInZoneOnly then petInZoneOnly:Hide() end
|
||||
if npcInZoneOnly then npcInZoneOnly:Hide() end
|
||||
if showAllOnMapButton then showAllOnMapButton:Hide() end
|
||||
local requireVendor = getglobal("MTH_BOOK_RequireVendor")
|
||||
local requireDrop = getglobal("MTH_BOOK_RequireDrop")
|
||||
local requireObject = getglobal("MTH_BOOK_RequireObject")
|
||||
if requireVendor then requireVendor:Hide() end
|
||||
if requireDrop then requireDrop:Hide() end
|
||||
if requireObject then requireObject:Hide() end
|
||||
elseif MTH_BOOK_STATE.mode == "npcs" then
|
||||
if searchLabel then searchLabel:Show() end
|
||||
if minLabel then minLabel:Hide() end
|
||||
@@ -2768,6 +2953,9 @@ local function MTH_BOOK_UpdateQuickFilterControls()
|
||||
if MTH_BOOK_STATE.mode ~= "petabilities" and not MTH_BOOK_IsItemMode() and petOnlyMyLevel then
|
||||
petOnlyMyLevel:Hide()
|
||||
end
|
||||
if (type(MTH_BOOKTAB_IsTrainerSpellMode) ~= "function" or not MTH_BOOKTAB_IsTrainerSpellMode(MTH_BOOK_STATE.mode)) and trainerHonoredDiscount then
|
||||
trainerHonoredDiscount:Hide()
|
||||
end
|
||||
if MTH_BOOK_STATE.mode ~= "pets" and petInZoneOnly then
|
||||
petInZoneOnly:Hide()
|
||||
end
|
||||
@@ -3270,13 +3458,20 @@ end
|
||||
function MTH_BOOK_SetDetailText(detail, text)
|
||||
if not detail then return end
|
||||
local wrapped = tostring(text or "")
|
||||
if MTH_BOOK_STATE.mode ~= "pethistory" and MTH_BOOK_STATE.mode ~= "pets" and MTH_BOOK_STATE.mode ~= "abilities" then
|
||||
if MTH_BOOK_STATE.mode ~= "pethistory" and MTH_BOOK_STATE.mode ~= "pets" and MTH_BOOK_STATE.mode ~= "abilities"
|
||||
and (type(MTH_BOOKTAB_IsTrainerSpellMode) ~= "function" or not MTH_BOOKTAB_IsTrainerSpellMode(MTH_BOOK_STATE.mode)) then
|
||||
wrapped = MTH_BOOK_WrapDetailText(wrapped)
|
||||
end
|
||||
detail._mthLocking = true
|
||||
detail:SetText(wrapped)
|
||||
detail._mthLockedText = wrapped
|
||||
detail._mthLocking = false
|
||||
local scroll = detail.mthTrainerDetailScroll
|
||||
if scroll then
|
||||
local textHeight = detail.GetStringHeight and detail:GetStringHeight() or 0
|
||||
detail:SetHeight(math.max(scroll:GetHeight(), textHeight + 12))
|
||||
scroll:SetVerticalScroll(0)
|
||||
end
|
||||
end
|
||||
|
||||
function MTH_BOOK_ConfigureReadOnlyEditBox(detail)
|
||||
@@ -3323,6 +3518,9 @@ end
|
||||
function MTH_BOOK_UpdateDetail()
|
||||
local detail = getglobal("MTH_BOOK_DetailBackdropDetailText")
|
||||
if not detail then return end
|
||||
if detail.mthTrainerIcon then detail.mthTrainerIcon:Hide() end
|
||||
local detailParent = detail:GetParent()
|
||||
if detailParent and detailParent.mthTrainerPlan then detailParent.mthTrainerPlan:Hide() end
|
||||
MTH_BOOK_HideDetailTitle()
|
||||
-- Hide model skin preview when not in a beast-list mode
|
||||
if MTH_BOOK_STATE.mode ~= "pets" and MTH_BOOK_STATE.mode ~= "abilities" then
|
||||
@@ -3330,6 +3528,11 @@ function MTH_BOOK_UpdateDetail()
|
||||
end
|
||||
local petTop = MTH_BOOK_STATE.petUI and MTH_BOOK_STATE.petUI.detailTop
|
||||
local petBottom = MTH_BOOK_STATE.petUI and MTH_BOOK_STATE.petUI.detailBottom
|
||||
if type(MTH_BOOKTAB_UpdateTrainerSpellDetail) == "function"
|
||||
and MTH_BOOKTAB_UpdateTrainerSpellDetail(detail, MTH_BOOK_STATE.selectedEntry) then
|
||||
MTH_BOOK_UpdateOpenMapButton()
|
||||
return
|
||||
end
|
||||
if not MTH_BOOK_STATE.selectedEntry then
|
||||
if MTH_BOOK_ModelViewer_Clear then MTH_BOOK_ModelViewer_Clear() end
|
||||
if MTH_BOOK_STATE.mode == "petabilities" then
|
||||
@@ -4031,6 +4234,12 @@ local function MTH_BOOK_ApplyColumnLayout(parent)
|
||||
end
|
||||
|
||||
local function MTH_BOOK_GetRowValues(entry)
|
||||
if type(MTH_BOOKTAB_IsTrainerSpellMode) == "function"
|
||||
and MTH_BOOKTAB_IsTrainerSpellMode(MTH_BOOK_STATE.mode) then
|
||||
return type(MTH_BOOKTAB_GetTrainerSpellRowValues) == "function"
|
||||
and MTH_BOOKTAB_GetTrainerSpellRowValues(entry) or { "", "", "", "", "" }
|
||||
end
|
||||
|
||||
if MTH_BOOK_STATE.mode == "pets" then
|
||||
-- MetaHunt DB entry
|
||||
local beast = MTH_DS_Beasts and MTH_DS_Beasts[entry]
|
||||
@@ -4317,6 +4526,9 @@ local function MTH_BOOK_AssignEntry(btn, entry)
|
||||
btn.entry = entry
|
||||
elseif MTH_BOOK_STATE.mode == "pethistory" then
|
||||
btn.entry = { petId = entry }
|
||||
elseif type(MTH_BOOKTAB_IsTrainerSpellMode) == "function"
|
||||
and MTH_BOOKTAB_IsTrainerSpellMode(MTH_BOOK_STATE.mode) then
|
||||
btn.entry = entry
|
||||
else
|
||||
btn.entry = { itemId = entry }
|
||||
end
|
||||
@@ -4482,11 +4694,18 @@ MTH_BOOK_UpdateResults = function()
|
||||
btn.itemIcon:SetTexture(nil)
|
||||
btn.itemIcon:Hide()
|
||||
end
|
||||
elseif type(MTH_BOOKTAB_IsTrainerSpellMode) == "function" and MTH_BOOKTAB_IsTrainerSpellMode(MTH_BOOK_STATE.mode) then
|
||||
local iconPath = MTH_BOOK_ResolveIconPath(entry.icon)
|
||||
btn.itemIcon:ClearAllPoints()
|
||||
btn.itemIcon:SetPoint("LEFT", btn, "LEFT", 8, 0)
|
||||
btn.itemIcon:SetTexture(iconPath or "Interface\\Icons\\INV_Misc_QuestionMark")
|
||||
btn.itemIcon:Show()
|
||||
else
|
||||
btn.itemIcon:SetTexture(nil)
|
||||
btn.itemIcon:Hide()
|
||||
end
|
||||
end
|
||||
if btn.trainerCoinIcon then btn.trainerCoinIcon:Hide() end
|
||||
if btn.familyAbilityButtons then
|
||||
local abilityEntries = nil
|
||||
local abilityColIndex = nil
|
||||
@@ -4572,6 +4791,7 @@ MTH_BOOK_UpdateResults = function()
|
||||
btn.itemIcon:SetTexture(nil)
|
||||
btn.itemIcon:Hide()
|
||||
end
|
||||
if btn.trainerCoinIcon then btn.trainerCoinIcon:Hide() end
|
||||
if btn.familyAbilityButtons then
|
||||
for chipIndex = 1, table.getn(btn.familyAbilityButtons) do
|
||||
local chip = btn.familyAbilityButtons[chipIndex]
|
||||
@@ -4628,6 +4848,11 @@ local function MTH_BOOK_UpdateModeLabels()
|
||||
check1 = ""
|
||||
check2 = ""
|
||||
check3 = ""
|
||||
elseif type(MTH_BOOKTAB_IsTrainerSpellMode) == "function" and MTH_BOOKTAB_IsTrainerSpellMode(MTH_BOOK_STATE.mode) then
|
||||
filterNames = { "All", "Known", "Not learned", "Not yet learnable", "", "" }
|
||||
check1 = ""
|
||||
check2 = ""
|
||||
check3 = ""
|
||||
elseif MTH_BOOK_STATE.mode == "npcs" then
|
||||
filterNames = { "", "", "", "", "", "" }
|
||||
check1 = "Alliance"
|
||||
@@ -4769,6 +4994,9 @@ local function MTH_BOOK_SetQuickFilter(index)
|
||||
MTH_BOOK_STATE.quick = "all"
|
||||
elseif MTH_BOOK_STATE.mode == "petabilities" then
|
||||
MTH_BOOK_STATE.quick = "all"
|
||||
elseif type(MTH_BOOKTAB_IsTrainerSpellMode) == "function" and MTH_BOOKTAB_IsTrainerSpellMode(MTH_BOOK_STATE.mode) then
|
||||
local map = { [1] = "all", [2] = "known", [3] = "notlearned", [4] = "notyet" }
|
||||
MTH_BOOK_STATE.quick = map[index] or "all"
|
||||
elseif MTH_BOOK_STATE.mode == "npcs" then
|
||||
MTH_BOOK_STATE.quick = "all"
|
||||
elseif MTH_BOOK_STATE.mode == "abilities" then
|
||||
@@ -4786,10 +5014,94 @@ end
|
||||
|
||||
local function MTH_BOOK_StyleSectionTab(button)
|
||||
if not button then return end
|
||||
button:SetHeight(24)
|
||||
button:SetHeight(26)
|
||||
button:SetNormalTexture(nil)
|
||||
button:SetPushedTexture(nil)
|
||||
button:SetHighlightTexture(nil)
|
||||
button:SetDisabledTexture(nil)
|
||||
if not button.mthMenuBackground then
|
||||
button.mthMenuBackground = button:CreateTexture(nil, "BACKGROUND")
|
||||
button.mthMenuBackground:SetAllPoints(button)
|
||||
button.mthMenuBackground:SetTexture("Interface\\Buttons\\WHITE8X8")
|
||||
end
|
||||
local regions = { button:GetRegions() }
|
||||
for _, region in ipairs(regions) do
|
||||
if region ~= button.mthMenuBackground and region.GetObjectType
|
||||
and region:GetObjectType() == "Texture" then
|
||||
region:Hide()
|
||||
end
|
||||
end
|
||||
button:SetScript("OnEnter", function()
|
||||
if not this.mthSelected then
|
||||
this.mthMenuBackground:SetVertexColor(0.20, 0.17, 0.06, 1.00)
|
||||
end
|
||||
end)
|
||||
button:SetScript("OnLeave", function()
|
||||
if not this.mthSelected then
|
||||
this.mthMenuBackground:SetVertexColor(0.10, 0.10, 0.10, 1.00)
|
||||
end
|
||||
end)
|
||||
button:SetScript("OnShow", nil)
|
||||
end
|
||||
|
||||
function MTH_BOOK_EnsureVerticalNavigation(frame)
|
||||
if not frame then return end
|
||||
local contentPane = getglobal("MTH_BOOK_ContentPane")
|
||||
if not contentPane then
|
||||
contentPane = CreateFrame("Frame", "MTH_BOOK_ContentPane", frame)
|
||||
contentPane:SetPoint("TOPLEFT", frame, "TOPLEFT", 112, 0)
|
||||
contentPane:SetWidth(760)
|
||||
contentPane:SetHeight(560)
|
||||
|
||||
local navBackdrop = CreateFrame("Frame", "MTH_BOOK_NavBackdrop", frame)
|
||||
navBackdrop:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -42)
|
||||
navBackdrop:SetWidth(100)
|
||||
navBackdrop:SetHeight(476)
|
||||
navBackdrop:SetBackdrop({
|
||||
bgFile = "Interface\\Buttons\\WHITE8X8",
|
||||
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||
tile = true,
|
||||
tileSize = 16,
|
||||
edgeSize = 16,
|
||||
insets = { left = 3, right = 3, top = 3, bottom = 3 },
|
||||
})
|
||||
navBackdrop:SetBackdropColor(0.07, 0.07, 0.07, 1.00)
|
||||
navBackdrop:SetBackdropBorderColor(0.28, 0.28, 0.28, 1.00)
|
||||
navBackdrop:SetFrameLevel(1)
|
||||
|
||||
local contentChildren = {
|
||||
"StatsText", "SearchLabel", "MinLabel", "MaxLabel", "BeastZoneLabel",
|
||||
"ListBackdrop", "DetailBackdrop", "OpenMapButton", "TopAreaBackdrop",
|
||||
"Search", "MinLevel", "MaxLevel", "ApplyButton", "PetLearnSourceDropdown",
|
||||
"ItemSubtypeDropdown", "PetOnlyMyLevel", "PetBookScanButton", "ResetButton", "TrainerHonoredDiscount",
|
||||
"Filter1", "Filter2", "Filter3", "Filter4", "Filter5", "Filter6",
|
||||
"FamilyDropdown", "AbilityDropdown", "RankDropdown", "PetInZoneOnly",
|
||||
"ShowAllOnMapButton", "NPCFunctionDropdown", "NPCInZoneOnly", "RequireVendor",
|
||||
"RequireDrop", "RequireObject", "HideNoAbilities", "HideUnknown",
|
||||
"BeastContinentDropdown", "BeastZoneDropdown", "ListSliderBackdrop", "ListSlider",
|
||||
"PrevButton", "NextButton",
|
||||
}
|
||||
for _, suffix in ipairs(contentChildren) do
|
||||
local child = getglobal("MTH_BOOK_" .. suffix)
|
||||
if child and child:GetParent() == frame then
|
||||
local point, relativeTo, relativePoint, x, y = child:GetPoint(1)
|
||||
child:SetParent(contentPane)
|
||||
if relativeTo == frame then
|
||||
child:ClearAllPoints()
|
||||
child:SetPoint(point, contentPane, relativePoint, x, y)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local topAreaBackdrop = getglobal("MTH_BOOK_TopAreaBackdrop")
|
||||
if topAreaBackdrop then
|
||||
topAreaBackdrop:ClearAllPoints()
|
||||
topAreaBackdrop:SetPoint("TOPLEFT", contentPane, "TOPLEFT", 0, -44)
|
||||
topAreaBackdrop:SetWidth(760)
|
||||
end
|
||||
end
|
||||
|
||||
local function MTH_BOOK_UpdateSectionTabs()
|
||||
local sectionPets = getglobal("MTH_BOOK_SectionPets")
|
||||
local sectionFamilies = getglobal("MTH_BOOK_SectionFamilies")
|
||||
@@ -4800,13 +5112,18 @@ local function MTH_BOOK_UpdateSectionTabs()
|
||||
local sectionNPCs = getglobal("MTH_BOOK_SectionNPCs")
|
||||
local sectionStable = getglobal("MTH_BOOK_SectionStable")
|
||||
local sectionPetHistory = getglobal("MTH_BOOK_SectionPetHistory")
|
||||
local sectionHunterSpells = getglobal("MTH_BOOK_SectionHunterSpells")
|
||||
local sectionPetSpells = getglobal("MTH_BOOK_SectionPetSpells")
|
||||
|
||||
local function setState(button, selected)
|
||||
if not button then return end
|
||||
button.mthSelected = selected and true or false
|
||||
if selected then
|
||||
PanelTemplates_SelectTab(button)
|
||||
button.mthMenuBackground:SetVertexColor(0.38, 0.28, 0.05, 1.00)
|
||||
button:SetTextColor(1.00, 0.82, 0.00)
|
||||
else
|
||||
PanelTemplates_DeselectTab(button)
|
||||
button.mthMenuBackground:SetVertexColor(0.10, 0.10, 0.10, 1.00)
|
||||
button:SetTextColor(0.90, 0.90, 0.90)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4819,6 +5136,8 @@ local function MTH_BOOK_UpdateSectionTabs()
|
||||
setState(sectionNPCs, MTH_BOOK_STATE.mode == "npcs")
|
||||
setState(sectionStable, MTH_BOOK_STATE.mode == "stable")
|
||||
setState(sectionPetHistory, MTH_BOOK_STATE.mode == "pethistory")
|
||||
setState(sectionHunterSpells, MTH_BOOK_STATE.mode == "hunterspells")
|
||||
setState(sectionPetSpells, MTH_BOOK_STATE.mode == "petspells")
|
||||
end
|
||||
|
||||
local function MTH_BOOK_LayoutSectionTabs()
|
||||
@@ -4832,40 +5151,23 @@ local function MTH_BOOK_LayoutSectionTabs()
|
||||
local sectionNPCs = getglobal("MTH_BOOK_SectionNPCs")
|
||||
local sectionStable = getglobal("MTH_BOOK_SectionStable")
|
||||
local sectionPetHistory = getglobal("MTH_BOOK_SectionPetHistory")
|
||||
local sectionHunterSpells = getglobal("MTH_BOOK_SectionHunterSpells")
|
||||
local sectionPetSpells = getglobal("MTH_BOOK_SectionPetSpells")
|
||||
if not (tabBar and sectionPets and sectionFamilies and sectionPetAbilities and sectionItems and sectionNPCs and sectionProjectiles and sectionAmmoBags) then return end
|
||||
|
||||
sectionPets:ClearAllPoints()
|
||||
sectionPets:SetPoint("TOPLEFT", tabBar, "TOPLEFT", 0, 0)
|
||||
|
||||
sectionPetAbilities:ClearAllPoints()
|
||||
sectionPetAbilities:SetPoint("LEFT", sectionPets, "RIGHT", 2, 0)
|
||||
|
||||
sectionFamilies:ClearAllPoints()
|
||||
sectionFamilies:SetPoint("LEFT", sectionPetAbilities, "RIGHT", 2, 0)
|
||||
|
||||
sectionNPCs:ClearAllPoints()
|
||||
sectionNPCs:SetPoint("LEFT", sectionFamilies, "RIGHT", 2, 0)
|
||||
|
||||
sectionItems:ClearAllPoints()
|
||||
sectionItems:SetPoint("LEFT", sectionNPCs, "RIGHT", 2, 0)
|
||||
|
||||
sectionProjectiles:ClearAllPoints()
|
||||
sectionProjectiles:SetPoint("LEFT", sectionItems, "RIGHT", 2, 0)
|
||||
|
||||
sectionAmmoBags:ClearAllPoints()
|
||||
sectionAmmoBags:SetPoint("LEFT", sectionProjectiles, "RIGHT", 2, 0)
|
||||
|
||||
if sectionStable then
|
||||
sectionStable:ClearAllPoints()
|
||||
sectionStable:SetPoint("LEFT", sectionAmmoBags, "RIGHT", 2, 0)
|
||||
end
|
||||
|
||||
if sectionPetHistory then
|
||||
sectionPetHistory:ClearAllPoints()
|
||||
if sectionStable then
|
||||
sectionPetHistory:SetPoint("LEFT", sectionStable, "RIGHT", 2, 0)
|
||||
else
|
||||
sectionPetHistory:SetPoint("LEFT", sectionAmmoBags, "RIGHT", 2, 0)
|
||||
local sections = {
|
||||
sectionPets, sectionPetAbilities, sectionFamilies, sectionNPCs, sectionItems,
|
||||
sectionProjectiles, sectionAmmoBags, sectionStable, sectionPetHistory,
|
||||
sectionHunterSpells, sectionPetSpells,
|
||||
}
|
||||
local y = 0
|
||||
for _, section in ipairs(sections) do
|
||||
if section then
|
||||
section:ClearAllPoints()
|
||||
section:SetPoint("TOPLEFT", tabBar, "TOPLEFT", 0, y)
|
||||
section:SetWidth(96)
|
||||
section:SetHeight(26)
|
||||
y = y - 28
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -5304,6 +5606,7 @@ local function MTH_BOOK_WireUI(frame)
|
||||
frame:SetBackdropColor(0.05, 0.05, 0.05, 1.00)
|
||||
frame:SetBackdropBorderColor(0.35, 0.35, 0.35, 1.00)
|
||||
end
|
||||
MTH_BOOK_EnsureVerticalNavigation(frame)
|
||||
|
||||
local closeButton = getglobal("MTH_BOOK_CloseButton")
|
||||
local applyButton = getglobal("MTH_BOOK_ApplyButton")
|
||||
@@ -5317,6 +5620,9 @@ local function MTH_BOOK_WireUI(frame)
|
||||
local sectionNPCs = getglobal("MTH_BOOK_SectionNPCs")
|
||||
local sectionStable = getglobal("MTH_BOOK_SectionStable")
|
||||
local sectionPetHistory = getglobal("MTH_BOOK_SectionPetHistory")
|
||||
local sectionHunterSpells = getglobal("MTH_BOOK_SectionHunterSpells")
|
||||
local sectionPetSpells = getglobal("MTH_BOOK_SectionPetSpells")
|
||||
local trainerHonoredDiscount = getglobal("MTH_BOOK_TrainerHonoredDiscount")
|
||||
local requireVendor = getglobal("MTH_BOOK_RequireVendor")
|
||||
local requireDrop = getglobal("MTH_BOOK_RequireDrop")
|
||||
local requireObject = getglobal("MTH_BOOK_RequireObject")
|
||||
@@ -5358,6 +5664,14 @@ local function MTH_BOOK_WireUI(frame)
|
||||
if sectionNPCs then sectionNPCs:SetScript("OnClick", function() MTH_BOOK_SetMode("npcs") end) end
|
||||
if sectionStable then sectionStable:SetScript("OnClick", function() MTH_BOOK_SetMode("stable") end) end
|
||||
if sectionPetHistory then sectionPetHistory:SetScript("OnClick", function() MTH_BOOK_SetMode("pethistory") end) end
|
||||
if sectionHunterSpells then sectionHunterSpells:SetScript("OnClick", function() MTH_BOOK_SetMode("hunterspells") end) end
|
||||
if sectionPetSpells then sectionPetSpells:SetScript("OnClick", function() MTH_BOOK_SetMode("petspells") end) end
|
||||
if trainerHonoredDiscount then
|
||||
trainerHonoredDiscount:SetScript("OnClick", function()
|
||||
MTH_BOOK_STATE.trainerHonoredDiscount = this:GetChecked() == 1
|
||||
MTH_BOOK_UpdateResults()
|
||||
end)
|
||||
end
|
||||
|
||||
MTH_BOOK_StyleSectionTab(sectionPets)
|
||||
MTH_BOOK_StyleSectionTab(sectionFamilies)
|
||||
@@ -5368,7 +5682,10 @@ local function MTH_BOOK_WireUI(frame)
|
||||
MTH_BOOK_StyleSectionTab(sectionNPCs)
|
||||
MTH_BOOK_StyleSectionTab(sectionStable)
|
||||
MTH_BOOK_StyleSectionTab(sectionPetHistory)
|
||||
MTH_BOOK_StyleSectionTab(sectionHunterSpells)
|
||||
MTH_BOOK_StyleSectionTab(sectionPetSpells)
|
||||
MTH_BOOK_LayoutSectionTabs()
|
||||
MTH_BOOK_ApplyContentLayoutForMode()
|
||||
|
||||
for i = 1, 6 do
|
||||
local filterBtn = getglobal("MTH_BOOK_Filter" .. i)
|
||||
@@ -5384,6 +5701,7 @@ local function MTH_BOOK_WireUI(frame)
|
||||
MTH_BOOK_InitPetLearnSourceDropdown()
|
||||
MTH_BOOK_InitItemSubtypeDropdown()
|
||||
MTH_BOOK_InitNPCFunctionDropdown()
|
||||
MTH_BOOK_EnsureTrainerStatusDropdown()
|
||||
|
||||
if petBookScanButton then
|
||||
petBookScanButton:SetScript("OnClick", function()
|
||||
|
||||
Reference in New Issue
Block a user