Skip to content

Commit

Permalink
More TWW updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kkthnx committed Aug 16, 2024
1 parent 6ec7b44 commit d239651
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 77 deletions.
4 changes: 2 additions & 2 deletions KkthnxUI/Modules/Maps/Elements/WowHeadLink.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local Module = K:GetModule("WorldMap")
local GameTooltip = GameTooltip
local GetAchievementLink = GetAchievementLink
local GetQuestLink = GetQuestLink
local IsAddOnLoaded = IsAddOnLoaded
local IsAddOnLoaded = C_AddOns.IsAddOnLoaded
local GetSuperTrackedQuestID = C_SuperTrack.GetSuperTrackedQuestID
local CreateFrame = CreateFrame
local hooksecurefunc = hooksecurefunc
Expand Down Expand Up @@ -186,7 +186,7 @@ function Module:CreateWowHeadLinks()
return
end

if IsAddOnLoaded("Blizzard_AchievementUI") then
if C_AddOns.IsAddOnLoaded("Blizzard_AchievementUI") then
InitializeAchievementLink()
else
local waitAchievementsFrame = CreateFrame("FRAME")
Expand Down
103 changes: 37 additions & 66 deletions KkthnxUI/Modules/Miscellaneous/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function Module:OnEnable()
"CreateDeathCounter",
"CreateDurabilityFrameMove",
"CreateErrorFrameToggle",
-- "CreateGUIGameMenuButton",
"CreateGUIGameMenuButton",
"CreateMinimapButtonToggle",
"CreateObjectiveSizeUpdate",
"CreateQuestSizeUpdate",
Expand All @@ -89,7 +89,13 @@ function Module:OnEnable()

-- TESTING CMD : /run BNToastFrame:AddToast(BN_TOAST_TYPE_ONLINE, 1)
if not BNToastFrame.mover then
BNToastFrame.mover = K.Mover(BNToastFrame, "BNToastFrame", "BNToastFrame", { "BOTTOMLEFT", UIParent, "BOTTOMLEFT", 4, 270 }, _G.BNToastFrame:GetSize())
BNToastFrame.mover = K.Mover(
BNToastFrame,
"BNToastFrame",
"BNToastFrame",
{ "BOTTOMLEFT", UIParent, "BOTTOMLEFT", 4, 270 },
_G.BNToastFrame:GetSize()
)
else
BNToastFrame.mover:SetSize(_G.BNToastFrame:GetSize())
end
Expand Down Expand Up @@ -160,7 +166,8 @@ function Module:OnEnable()
if linkType == "battlepet" then
local _, level, breedQuality = strsplit(":", linkOptions)
local qualityColor = BAG_ITEM_QUALITY_COLORS[tonumber(breedQuality)]
link = qualityColor:WrapTextInColorCode(name .. " |n" .. "Level" .. " " .. level .. "Battle Pet")
link =
qualityColor:WrapTextInColorCode(name .. " |n" .. "Level" .. " " .. level .. "Battle Pet")
end
popupText:SetText(popupText:GetText():gsub(confirmationType, "") .. "|n|n" .. link)
end
Expand All @@ -176,7 +183,8 @@ function Module:OnEnable()
if linkType == "battlepet" then
local _, level, breedQuality = strsplit(":", linkOptions)
local qualityColor = BAG_ITEM_QUALITY_COLORS[tonumber(breedQuality)]
link = qualityColor:WrapTextInColorCode(name .. " |n" .. "Level" .. " " .. level .. "Battle Pet")
link =
qualityColor:WrapTextInColorCode(name .. " |n" .. "Level" .. " " .. level .. "Battle Pet")
end
popupText:SetText(popupText:GetText():gsub(confirmationType, "") .. "|n|n" .. link)
end
Expand Down Expand Up @@ -315,67 +323,20 @@ function Module:CreateMinimapButtonToggle()
Module:ToggleMinimapIcon()
end

local function MainMenu_OnShow(self)
local buttonToReanchor
local buttonHeight = 0

local isCharacterNewlyBoosted = IsCharacterNewlyBoosted()
local canViewSplashScreen = C_SplashScreen.CanViewSplashScreen()

local function reanchorButtons(offset)
local anchorButton = GameMenuButtonWhatsNew:IsShown() and GameMenuButtonWhatsNew or GameMenuButtonHelp
local additionalOffset = 28

if isCharacterNewlyBoosted or not canViewSplashScreen then
anchorButton = GameMenuButtonStore:IsShown() and GameMenuButtonStore or GameMenuButtonHelp
additionalOffset = 28
end

buttonToReanchor = anchorButton
buttonHeight = additionalOffset + offset
end

local function setButtonPosition(button, relativeTo, yOffset)
if button and button:IsShown() then
button:SetPoint("TOP", relativeTo, "BOTTOM", 0, yOffset)
function Module:CreateGUIGameMenuButton()
local function toggleGUI()
if InCombatLockdown() then
UIErrorsFrame:AddMessage(K.InfoColor .. ERR_NOT_IN_COMBAT)
return
end
K["GUI"]:Toggle()
HideUIPanel(_G.GameMenuFrame)
PlaySound(_G.SOUNDKIT.IG_MAINMENU_OPTION)
end

reanchorButtons(Module.GameMenuButton:GetHeight())

self:SetHeight(self:GetHeight() + buttonHeight)

setButtonPosition(GameMenuButtonLogout, Module.GameMenuButton, -14)
setButtonPosition(GameMenuButtonStore, GameMenuButtonHelp, -6)
setButtonPosition(GameMenuButtonWhatsNew, buttonToReanchor, -6)
setButtonPosition(GameMenuButtonEditMode, buttonToReanchor, -24)
setButtonPosition(GameMenuButtonSettings, GameMenuButtonEditMode, -6)
setButtonPosition(GameMenuButtonMacros, GameMenuButtonSettings, -6)
setButtonPosition(GameMenuButtonAddons, GameMenuButtonMacros, -6)
setButtonPosition(GameMenuButtonQuit, GameMenuButtonLogout, -6)
end

local function Button_OnClick()
if InCombatLockdown() then
UIErrorsFrame:AddMessage(K.InfoColor .. ERR_NOT_IN_COMBAT)
return
end

K["GUI"]:Toggle()
HideUIPanel(_G.GameMenuFrame)
PlaySound(_G.SOUNDKIT.IG_MAINMENU_OPTION)
end

function Module:CreateGUIGameMenuButton()
local gameMenuButton = CreateFrame("Button", "KKUI_GameMenuButton", _G.GameMenuFrame, "GameMenuButtonTemplate")
gameMenuButton:SetText(K.Title)
gameMenuButton:SetPoint("TOP", _G.GameMenuButtonAddons, "BOTTOM", 0, -12)
gameMenuButton:SetScript("OnClick", Button_OnClick)
gameMenuButton:SkinButton(true)

Module.GameMenuButton = gameMenuButton

_G.GameMenuFrame:HookScript("OnShow", MainMenu_OnShow)
hooksecurefunc(GameMenuFrame, "InitButtons", function(self)
self:AddButton(K.Title, toggleGUI)
end)
end

function Module:CreateQuestXPPercent()
Expand All @@ -395,7 +356,8 @@ function Module:CreateQuestXPPercent()

-- Calculate and display the XP percentage gain
if questXP and questXP > 0 and xpText then
local xpPercentageIncrease = (((playerCurrentXP + questXP) / playerMaxXP) - (playerCurrentXP / playerMaxXP)) * 100
local xpPercentageIncrease = (((playerCurrentXP + questXP) / playerMaxXP) - (playerCurrentXP / playerMaxXP))
* 100
xpFrame:SetFormattedText("%s (|cff4beb2c+%.2f%%|r)", xpText, xpPercentageIncrease)
end
end
Expand Down Expand Up @@ -576,7 +538,11 @@ do
local updatedProgressBarTitle = ARCHAEOLOGY_DIGSITE_PROGRESS_BAR_TITLE .. " - %s/%s"
local function UpdateProgressBarTitle(_, numFindsCompleted, totalFinds)
if ArcheologyDigsiteProgressBar then
ArcheologyDigsiteProgressBar.BarTitle:SetFormattedText(updatedProgressBarTitle, numFindsCompleted, totalFinds)
ArcheologyDigsiteProgressBar.BarTitle:SetFormattedText(
updatedProgressBarTitle,
numFindsCompleted,
totalFinds
)
end
end
K:RegisterEvent("ARCHAEOLOGY_SURVEY_CAST", UpdateProgressBarTitle)
Expand Down Expand Up @@ -733,7 +699,11 @@ end
function Module:PostBNToastMove(_, anchor)
if anchor ~= BNToastFrame.mover then
BNToastFrame:ClearAllPoints()
BNToastFrame:SetPoint(BNToastFrame.mover.anchorPoint or "TOPLEFT", BNToastFrame.mover, BNToastFrame.mover.anchorPoint or "TOPLEFT")
BNToastFrame:SetPoint(
BNToastFrame.mover.anchorPoint or "TOPLEFT",
BNToastFrame.mover,
BNToastFrame.mover.anchorPoint or "TOPLEFT"
)
end
end

Expand All @@ -742,7 +712,8 @@ function Module:CreateCustomWaypoint()
return
end

local pointString = K.InfoColor .. "|Hworldmap:%d+:%d+:%d+|h[|A:Waypoint-MapPin-ChatIcon:13:13:0:0|a%s (%s, %s)%s]|h|r"
local pointString = K.InfoColor
.. "|Hworldmap:%d+:%d+:%d+|h[|A:Waypoint-MapPin-ChatIcon:13:13:0:0|a%s (%s, %s)%s]|h|r"

local function GetCorrectCoord(x)
x = tonumber(x)
Expand Down
25 changes: 17 additions & 8 deletions KkthnxUI/Modules/Skins/Blizzard/FrameXML/CharacterFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ local function UpdateAzeriteItem(self)
self.RankFrame.Label:SetPoint("TOPLEFT", self, 2, -1)
self.RankFrame.Label:SetTextColor(1, 0.5, 0)
self.RankFrame.Label:SetFontObject(K.UIFontOutline)
self.RankFrame.Label:SetFont(select(1, self.RankFrame.Label:GetFont()), 13, select(3, self.RankFrame.Label:GetFont()))
self.RankFrame.Label:SetFont(
select(1, self.RankFrame.Label:GetFont()),
13,
select(3, self.RankFrame.Label:GetFont())
)

self.styled = true
end
Expand Down Expand Up @@ -210,7 +214,9 @@ tinsert(C.defaultThemes, function()
texturePath = "Interface\\FrameGeneral\\UI-Background-Marble"
end

CharacterFrame:SetSize(frameWidth, frameHeight)
-- CharacterFrame:SetSize(frameWidth, frameHeight)
CharacterFrame:SetWidth(frameWidth)
CharacterFrame:SetHeight(frameHeight)
CharacterFrame.Inset:SetPoint("BOTTOMRIGHT", CharacterFrame, "BOTTOMLEFT", insetOffset, 4)

CharacterFrame.Inset.Bg:SetTexture(texturePath)
Expand All @@ -219,14 +225,17 @@ tinsert(C.defaultThemes, function()
CharacterFrame.Inset.Bg:SetVertTile(isExpanded)
end

UpdateCharacterFrameLayout(true)
-- -- Expand/collapse hooks
-- hooksecurefunc("CharacterFrame_Expand", function()
-- UpdateCharacterFrameLayout(true)
-- end)
hooksecurefunc(CharacterFrameMixin, "Expand", function(self)
print("Expand method called")
UpdateCharacterFrameLayout(true)
end)

-- hooksecurefunc("CharacterFrame_Collapse", function()
-- UpdateCharacterFrameLayout(false)
-- end)
hooksecurefunc(CharacterFrameMixin, "Collapse", function(self)
print("Collapse method called")
UpdateCharacterFrameLayout(false)
end)

-- Fonts
if CharacterLevelText then
Expand Down
67 changes: 66 additions & 1 deletion KkthnxUI/Modules/Skins/Blizzard/FrameXML/GameMenuFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ table_insert(C.defaultThemes, function()
GameMenuFrame.Header:StripTextures()
GameMenuFrame.Header:ClearAllPoints()
GameMenuFrame.Header:SetPoint("TOP", GameMenuFrame, 0, 7)
GameMenuFrame:CreateBorder(nil, nil, C["General"].BorderStyle.Value ~= "KkthnxUI_Pixel" and 32 or nil, nil, C["General"].BorderStyle.Value ~= "KkthnxUI_Pixel" and -10 or nil)
GameMenuFrame:CreateBorder(
nil,
nil,
C["General"].BorderStyle.Value ~= "KkthnxUI_Pixel" and 32 or nil,
nil,
C["General"].BorderStyle.Value ~= "KkthnxUI_Pixel" and -10 or nil
)
GameMenuFrame.Border:Hide()

local buttons = {
Expand Down Expand Up @@ -41,3 +47,62 @@ table_insert(C.defaultThemes, function()
TicketStatusFrameButton:StripTextures()
TicketStatusFrameButton:SkinButton()
end)

tinsert(C.defaultThemes, function()
if not C["Skins"].BlizzardFrames then
return
end

GameMenuFrame.Header:StripTextures()
GameMenuFrame.Header:ClearAllPoints()
GameMenuFrame.Header:SetPoint("TOP", GameMenuFrame, 0, 7)
GameMenuFrame:CreateBorder(
nil,
nil,
C["General"].BorderStyle.Value ~= "KkthnxUI_Pixel" and 32 or nil,
nil,
C["General"].BorderStyle.Value ~= "KkthnxUI_Pixel" and -10 or nil
)
GameMenuFrame.Border:Hide()
GameMenuFrame.Header.Text:SetFontObject(Game16Font)

local buttons = {
"GameMenuButtonHelp",
"GameMenuButtonWhatsNew",
"GameMenuButtonStore",
"GameMenuButtonMacros",
"GameMenuButtonAddons",
"GameMenuButtonLogout",
"GameMenuButtonQuit",
"GameMenuButtonContinue",
"GameMenuButtonSettings",
"GameMenuButtonEditMode",
}
for _, buttonName in next, buttons do
local button = _G[buttonName]
if button then
button:SkinButton(true)
end
end

local cr, cg, cb = K.r, K.g, K.b

hooksecurefunc(GameMenuFrame, "InitButtons", function(self)
if not self.buttonPool then
return
end

for button in self.buttonPool:EnumerateActive() do
if not button.styled then
button:DisableDrawLayer("BACKGROUND")
button.bg = CreateFrame("Frame", nil, button)
button.bg:SetFrameLevel(button:GetFrameLevel())
button.bg:SetPoint("TOPLEFT", button, "TOPLEFT", 0, -4)
button.bg:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 0, 4)
button.bg:SkinButton(true)

button.styled = true
end
end
end)
end)

0 comments on commit d239651

Please sign in to comment.