-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.lua
57 lines (49 loc) · 2.44 KB
/
ui.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
local addonName, LithStable = ...
-- Function to initialize UI elements
function LithStable:InitializeUI()
if not MountJournal then return end
-- Random Favorite Mount Button
local randomButton = CreateFrame("Button", "LithStableRandomMountButton", MountJournal, "UIPanelButtonTemplate")
randomButton:SetSize(32, 32)
randomButton:SetPoint("TOPRIGHT", MountJournal, "TOPRIGHT", -7, -25)
local randomButtonTexture = randomButton:CreateTexture(nil, "ARTWORK")
randomButtonTexture:SetTexture("Interface\\AddOns\\LithStable\\images\\icon-summon.tga")
randomButtonTexture:SetAllPoints(randomButton)
randomButton:SetNormalTexture(randomButtonTexture)
randomButton:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square", "ADD")
randomButton:SetScript("OnClick", function() LithStable:SummonRandomMount(nil, false) end)
randomButton:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetText("Send the stable boy to get you one of your favorite mounts.")
GameTooltip:Show()
end)
randomButton:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
-- Toggle Favorite Button
local favoriteButton = CreateFrame("Button", "LithStableToggleFavoriteButton", MountJournal, "UIPanelButtonTemplate")
favoriteButton:SetSize(32, 32)
favoriteButton:SetPoint("TOPRIGHT", randomButton, "TOPLEFT", -4, 0)
local favoriteButtonTexture = favoriteButton:CreateTexture(nil, "ARTWORK")
favoriteButtonTexture:SetTexture("Interface\\AddOns\\LithStable\\images\\icon-fav.tga")
favoriteButtonTexture:SetAllPoints(favoriteButton)
favoriteButton:SetNormalTexture(favoriteButtonTexture)
favoriteButton:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square", "ADD")
favoriteButton:SetScript("OnClick", function() LithStable:ToggleFavorite() end)
favoriteButton:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetText("Toggle selected mount as favorite")
GameTooltip:Show()
end)
favoriteButton:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
end
-- Hook the UI initialization
local frame = CreateFrame("Frame")
frame:RegisterEvent("ADDON_LOADED")
frame:SetScript("OnEvent", function(self, event, loadedAddonName)
if loadedAddonName == "Blizzard_Collections" then
LithStable:InitializeUI()
end
end)