---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------
-- -- -- -- Lazy Leader by Niketa -- -- -- --
---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------
local addon, ns = ...
local L = ns.Localization
---------------------------------------------------------------------------------------------------------------------------------------------------------
-- MainFrame
---------------------------------------------------------------------------------------------------------------------------------------------------------
ns.MainFrame = CreateFrame("Frame", addon .. "MainFrame", UIParent)
local MainFrame = ns.MainFrame
MainFrame:SetScript("OnEvent", function(self, event, ...)
return self[event] and self[event](self, event, ...)
end)
---------------------------------------------------------------------------------------------------------------------------------------------------------
-- Functions
---------------------------------------------------------------------------------------------------------------------------------------------------------
-- -- Slash Commands -- --
SLASH_LAZYLEADER1, SLASH_LAZYLEADER2 = "/lazy", "/lazylead"
function SlashCmdList.LAZYLEADER(msg)
if MainFrame:IsVisible() then
MainFrame:Hide()
else
MainFrame:Show()
end
end
-- -- DisplayTabFrames -- --
function MainFrame:DisplayTabFrames(tab, subtab)
subtab = subtab or 1
for k, v in pairs(MainFrame.Tabs) do
-- Hide Content
for key, value in pairs(MainFrame.Tabs[k].subtabs) do
value.sidebar.subtab:UnlockHighlight()
for K, V in pairs(value.elements) do
V:Hide()
end
for K, V in pairs(value.sidebar) do
V:Hide()
end
end
-- Show Content
if k == tab then
for key, value in pairs(MainFrame.Tabs[tab].subtabs) do
for K, V in pairs(value.sidebar) do
V:Show()
end
-- print(key, value)
end
for key, value in pairs(MainFrame.Tabs[k].subtabs) do
if key == subtab then
value.sidebar.subtab:LockHighlight()
for K, V in pairs(MainFrame.Tabs[k].subtabs[key].elements) do
V:Show()
end
end
end
end
end
end
---------------------------------------------------------------------------------------------------------------------------------------------------------
-- MainFrame Display
---------------------------------------------------------------------------------------------------------------------------------------------------------
MainFrame:EnableMouse(true)
MainFrame:SetMovable(true)
MainFrame:SetSize(768, 512)
MainFrame:SetPoint("CENTER",0,0)
local temp = MainFrame:CreateTexture(nil, "BACKGROUND")
temp:SetAllPoints(MainFrame)
temp:SetTexture(0, 0, 1, 1)
-- -- Title Region -- --
local TitleRegion = MainFrame:CreateTitleRegion()
TitleRegion:SetPoint("CENTER", MainFrame, "TOP", 0, -15)
TitleRegion:SetSize(768, 20)
local Title = MainFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
Title:SetText(GetUnitName("player") .. ", " .. L["the Lazy Leader"])
Title:SetPoint("TOPLEFT", 80, -19)
-- -- Artwork Textures -- --
MainFrame.Textures = {
{point = "TOPLEFT", folder = "AUCTIONFRAME", prefix = "AUCTIONFRAME", file = "BROWSE-TOPLEFT"},
{point = "TOP", folder = "AUCTIONFRAME", prefix = "AUCTIONFRAME", file = "BROWSE-TOP"},
{point = "TOPRIGHT", folder = "AUCTIONFRAME", prefix = "AUCTIONFRAME", file = "BROWSE-TOPRIGHT"},
{point = "BOTTOMLEFT", folder = "AUCTIONFRAME", prefix = "AUCTIONFRAME", file = "BROWSE-BOTLEFT"},
{point = "BOTTOM", folder = "AUCTIONFRAME", prefix = "AUCTIONFRAME", file = "AUCTION-BOT"},
{point = "BOTTOMRIGHT", folder = "AUCTIONFRAME", prefix = "AUCTIONFRAME", file = "AUCTION-BOTRIGHT"},
}
for k, v in pairs(MainFrame.Textures) do
local texture = MainFrame:CreateTexture(nil, "ARTWORK")
texture:SetTexture("Interface\\" .. v.folder .. "\\UI-" .. v.prefix .. "-" .. v.file .. ".BLP")
texture:SetPoint(v.point, 0, 0)
end
-- Portrait --
local Portrait = MainFrame:CreateTexture(nil, "BACKGROUND")
Portrait:SetHeight(60)
Portrait:SetWidth(60)
Portrait:SetPoint("TOPLEFT", 8, -8)
SetPortraitTexture(Portrait, "player")
-- -- Close Button -- --
local CloseBTN = CreateFrame("Button", nil, MainFrame, "UIPanelCloseButton")
CloseBTN:SetPoint("TOPRIGHT", 3, -8)
-- -- Snapshot Button -- --
local SnapshotBTN = CreateFrame("Button", nil, MainFrame, "UIPanelButtonTemplate")
SnapshotBTN:SetWidth(123)
SnapshotBTN:SetHeight(26)
SnapshotBTN:SetNormalFontObject(GameFontNormalSmall)
SnapshotBTN:SetHighlightFontObject(GameFontHighlightSmall)
SnapshotBTN:SetPushedTextOffset(0, 0)
SnapshotBTN:SetText(L["Take a Snapshot"])
SnapshotBTN:SetPoint("BOTTOMRIGHT", MainFrame, "BOTTOMRIGHT", -87, 78)
SnapshotBTN:SetScript("OnClick", function()
print("Snapshot taken!!")
end)
-- -- Invite Button -- --
local InviteBTN = CreateFrame("Button", nil, MainFrame, "UIPanelButtonTemplate")
InviteBTN:SetWidth(78)
InviteBTN:SetHeight(26)
InviteBTN:SetNormalFontObject(GameFontNormalSmall)
InviteBTN:SetHighlightFontObject(GameFontHighlightSmall)
InviteBTN:SetPushedTextOffset(0, 0)
InviteBTN:SetText(L["Invite"])
InviteBTN:SetPoint("BOTTOMRIGHT", MainFrame, "BOTTOMRIGHT", -7, 78)
InviteBTN:SetScript("OnClick", function()
print("Inviting friends...")
end)
-- -- Tab Buttons -- --
MainFrame.Tabs = {
{
name = L["Welcome"],
description = L["Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac mi non nibh pellentesque malesuada. Proin vel est interdum, pretium enim quis, blandit odio. Phasellus rhoncus dolor magna, eu convallis sapien eleifend luctus. Phasellus vehicula enim ac purus pharetra, id pretium nisi sagittis. Vestibulum non est congue, posuere lorem eget, varius sapien. Integer ornare massa at mi suscipit aliquam. Cras aliquam venenatis justo, ut porta diam tincidunt nec. Cras pellentesque aliquet quam ut gravida. Fusce et sem ac nibh viverra tristique ac nec elit. Proin posuere hendrerit enim vel adipiscing. Phasellus mollis porta vehicula. Sed dapibus quam nibh, quis tristique neque sodales a. Etiam tortor felis, pellentesque id nibh ac, vehicula auctor est. Etiam odio tortor, faucibus a dolor eget, cursus egestas arcu. Nulla eget consequat neque."],
subtabs = {
{name = L["Introduction"], sidebar = {}, elements = {}}
}
},
{
name = L["Raiders"],
description = L["Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ac mi non nibh pellentesque malesuada. Proin vel est interdum, pretium enim quis, blandit odio. Phasellus rhoncus dolor magna, eu convallis sapien eleifend luctus. Phasellus vehicula enim ac purus pharetra, id pretium nisi sagittis. Vestibulum non est congue, posuere lorem eget, varius sapien. Integer ornare massa at mi suscipit aliquam. Cras aliquam venenatis justo, ut porta diam tincidunt nec. Cras pellentesque aliquet quam ut gravida. Fusce et sem ac nibh viverra tristique ac nec elit. Proin posuere hendrerit enim vel adipiscing. Phasellus mollis porta vehicula. Sed dapibus quam nibh, quis tristique neque sodales a. Etiam tortor felis, pellentesque id nibh ac, vehicula auctor est. Etiam odio tortor, faucibus a dolor eget, cursus egestas arcu. Nulla eget consequat neque."],
subtabs = {
{name = L["Introduction"], sidebar = {}, elements = {}},
{name = L["Add Friends"], sidebar = {}, elements = {}},
{name = L["Invite Friends"], sidebar = {}, elements = {}}
}
},
{
name = L["History"],
description = L["This is a tab page!"],
subtabs = {
{name = L["Introduction"], sidebar = {}, elements = {}},
{name = L["Snapshots"], sidebar = {}, elements = {}}
}
},
{
name = L["Settings"],
description = L["This is a tab page!"],
subtabs = {
{name = L["Introduction"], sidebar = {}, elements = {}},
{name = L["Settings"], sidebar = {}, elements = {}}
}
},
{
name = L["Help"],
description = L["Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam purus nisi, faucibus sed ante non, scelerisque egestas odio. Nunc rhoncus felis vitae nisl rhoncus sollicitudin. Cras tristique eros at dui placerat egestas. Sed consequat, quam in rutrum vulputate, quam eros condimentum dui, a ornare lectus dolor vitae felis. Suspendisse egestas magna id congue volutpat. Donec ante ligula, venenatis vitae porttitor nec, fermentum at sapien. Integer diam mauris, laoreet a nunc eu, rutrum dignissim nisi. Suspendisse interdum purus diam, eu mattis nisi aliquam ac. Duis euismod lobortis ultrices. Mauris suscipit dui vitae nibh semper dictum.\n\nNullam mattis iaculis lorem in eleifend. Donec eget lectus tellus. Quisque ultricies metus at adipiscing pellentesque. Integer vitae consectetur tellus. Praesent eu nibh id justo porta ultrices. Suspendisse ligula nisi, vehicula gravida lobortis quis, mattis sit amet sem. Sed vel libero quis nibh iaculis pretium. Mauris eu tellus semper, eleifend metus a, tincidunt felis. Sed tempus quam malesuada, sagittis odio quis, pretium eros. Morbi sollicitudin massa vitae diam lacinia commodo.\n\nMauris consectetur nisi at vehicula gravida. Integer euismod metus suscipit faucibus dapibus. Pellentesque sit amet elit sem. Mauris convallis lorem a mauris tempus porttitor varius non risus. Aenean velit ante, pretium pellentesque sem sollicitudin, malesuada consequat eros. In vitae sagittis nisi. Mauris odio libero, fringilla ac blandit sit amet, ultricies eget justo. Etiam pulvinar posuere ante, eu porta elit mollis at. Fusce placerat sed est in ullamcorper. Ut non fringilla ipsum. Ut nec augue non mauris sollicitudin mollis volutpat viverra odio. Cras ornare dui mauris, quis pulvinar nulla cursus sed. In id neque ante. Praesent aliquam, sem sit amet mollis dignissim, sapien mi hendrerit risus, a ornare magna augue id tortor."],
subtabs = {
{name = L["Introduction"], sidebar = {}, elements = {}}
}
},
}
for k, v in pairs(MainFrame.Tabs) do
local tab = CreateFrame("Button", "tab" .. k, MainFrame, "OptionsFrameTabButtonTemplate")
tab:SetText(v.name)
PanelTemplates_TabResize(tab, 0)
if k == 1 then
tab:SetPoint("TOPLEFT", 192, -75)
else
tab:SetPoint("TOPLEFT", "tab" .. (k - 1), "TOPRIGHT", -7, 0)
end
tab:SetScript("OnClick", function()
MainFrame:DisplayTabFrames(k)
end)
end
-- -- Content Window -- --
local ScrollFrame = CreateFrame("ScrollFrame", "MainFrameContentScrollFrame", MainFrame, "UIPanelScrollFrameTemplate")
ScrollFrame:SetSize(540, 300)
ScrollFrame:SetPoint("TOPLEFT", 192, -105)
ScrollFrame.ScrollBar:EnableMouseWheel(true)
ScrollFrame.ScrollBar:SetScript("OnMouseWheel", function(self, direction)
ScrollFrameTemplate_OnMouseWheel(ScrollFrame, direction)
end)
local ScrollFrameBG = ScrollFrame:CreateTexture(nil, "BACKGROUND", nil, -6)
ScrollFrameBG:SetPoint("TOP")
ScrollFrameBG:SetPoint("RIGHT", 25, 0)
ScrollFrameBG:SetPoint("BOTTOM")
ScrollFrameBG:SetWidth(26)
ScrollFrameBG:SetTexture("Interface\\PaperDollInfoFrame\\UI-Character-ScrollBar.blp")
ScrollFrameBG:SetTexCoord(0, 0.45, 0.1640625, 1)
ScrollFrameBG:SetAlpha(0.5)
MainFrame.ContentScrollFrame = ScrollFrame
ns.ScrollContent = CreateFrame("Frame", nil, ScrollFrame)
local ScrollContent = ns.ScrollContent
ScrollContent:SetSize(ScrollFrame:GetWidth(), ScrollFrame:GetHeight())
-- local temp = ScrollContent:CreateTexture(nil, "BACKGROUND")
-- temp:SetAllPoints(ScrollContent)
-- temp:SetTexture(0, 0, 1, 1)
ScrollFrame:SetScrollChild(ScrollContent)
-- -- Subtab Frame -- --
local SubTabFrame = CreateFrame("Frame", nil, MainFrame)
SubTabFrame:SetSize(155, 300)
SubTabFrame:SetPoint("TOPLEFT", 24, -105)
---------------------------------------------------------------------------------------------------------------------------------------------------------
-- Description Tab Displays
---------------------------------------------------------------------------------------------------------------------------------------------------------
for k, v in pairs(MainFrame.Tabs) do
MainFrame.Tabs[k].subtabs[1].elements.title = ScrollContent:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
local title = MainFrame.Tabs[k].subtabs[1].elements.title
title:SetText(MainFrame.Tabs[k].name)
title:SetPoint("TOPLEFT", 10, -8)
MainFrame.Tabs[k].subtabs[1].elements.description = ScrollContent:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
local description = MainFrame.Tabs[k].subtabs[1].elements.description
description:SetWidth(520)
description:CanWordWrap(true)
description:SetJustifyH("LEFT")
description:SetText(MainFrame.Tabs[k].description)
description:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -5)
for key, value in pairs(MainFrame.Tabs[k].subtabs) do
if key ~= 1 then
MainFrame.Tabs[k].subtabs[key].elements.title = ScrollContent:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
local title = MainFrame.Tabs[k].subtabs[key].elements.title
title:SetText(MainFrame.Tabs[k].subtabs[key].name)
title:SetPoint("TOPLEFT", 10, -8)
end
end
end
---------------------------------------------------------------------------------------------------------------------------------------------------------
-- Sidebar Tab Display
---------------------------------------------------------------------------------------------------------------------------------------------------------
for k, v in pairs(MainFrame.Tabs) do
for key, value in pairs(MainFrame.Tabs[k].subtabs) do
MainFrame.Tabs[k].subtabs[key].sidebar.subtab = CreateFrame("Button", "subtab" .. key, SubTabFrame)
local subtab = MainFrame.Tabs[k].subtabs[key].sidebar.subtab
subtab:SetNormalFontObject("GameFontHighlightSmall")
subtab:SetText(MainFrame.Tabs[k].subtabs[key].name)
subtab:SetSize(SubTabFrame:GetWidth(), 23)
local subtabtext = subtab:GetFontString()
subtabtext:ClearAllPoints()
subtabtext:SetJustifyH("LEFT")
subtabtext:SetPoint("LEFT", subtab, 8, 0)
subtabtext:SetPoint("RIGHT", subtab, -8, 0)
local nTexture = subtab:CreateTexture()
nTexture:SetTexture("Interface\\AUCTIONFRAME\\UI-AuctionFrame-FilterBG.blp")
nTexture:SetTexCoord(0, 0.53125, 0, 0.625)
nTexture:SetAllPoints(subtab)
subtab:SetNormalTexture(nTexture)
local hTexture = subtab:CreateTexture()
hTexture:SetTexture("Interface\\Buttons\\UI-SILVER-BUTTON-HIGHLIGHT.BLP")
hTexture:SetPoint("TOPLEFT", subtab, "TOPLEFT", 5, 0)
hTexture:SetPoint("BOTTOMRIGHT", subtab, "BOTTOMRIGHT", -5, -3)
subtab:SetHighlightTexture(hTexture)
if key == 1 then
subtab:SetPoint("TOPLEFT")
else
subtab:SetPoint("TOPLEFT", "subtab" .. (key - 1), "BOTTOMLEFT", 0, -2)
end
-- OnClick
subtab:SetScript("OnClick", function()
MainFrame:DisplayTabFrames(k, key)
end)
end
end