Created
June 29, 2021 16:10
-
-
Save kurapica/2dc7bf8535ca6d62a7488e09ca43ee37 to your computer and use it in GitHub Desktop.
Chat Frame Fix for WOW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scorpio "ChatFix" "" | |
local _LoadedTab = 1 | |
local _CheckCompare = false | |
local _CheckType = nil | |
local _CheckAchievement = nil | |
local GameTooltip = _G.GameTooltip | |
_G.CHAT_FRAME_TAB_SELECTED_NOMOUSE_ALPHA = 0 | |
_G.CHAT_FRAME_TAB_NORMAL_NOMOUSE_ALPHA = 0 | |
_G.CHAT_SHOW_IME = false | |
if QuickJoinToastButton then QuickJoinToastButton:Hide() end | |
ChatFrameMenuButton:ClearAllPoints() | |
ChatFrameMenuButton:SetAlpha(0.1) | |
ChatFrameMenuButton:SetPoint("TOPRIGHT", _G["ChatFrame1"]) | |
ChatFrameMenuButton:SetAlpha(_G["ChatFrame" .. 1 .. "Tab"]:GetAlpha()) | |
ChatFrameChannelButton:ClearAllPoints() | |
ChatFrameChannelButton:SetAlpha(0.1) | |
ChatFrameChannelButton:SetPoint("TOPRIGHT", ChatFrameMenuButton, "BOTTOMRIGHT") | |
ChatFrameChannelButton:SetAlpha(_G["ChatFrame" .. 1 .. "Tab"]:GetAlpha()) | |
__SecureHook__() | |
function FCF_OpenTemporaryWindow() | |
while _G["ChatFrame" .. _LoadedTab] do | |
ApplyStyle("ChatFrame" .. _LoadedTab) | |
_LoadedTab = _LoadedTab + 1 | |
end | |
end | |
__SecureHook__() | |
function FCF_OpenNewWindow(chatframe) | |
local i = 1 | |
while _G["ChatFrame" .. i] do | |
FCF_SetWindowAlpha(_G["ChatFrame" .. i], 0) | |
i = i + 1 | |
end | |
end | |
function ApplyStyle(tabName) | |
_G[tabName]:HookScript("OnHyperlinkEnter", OnHyperlinkEnter) | |
_G[tabName]:HookScript("OnHyperlinkLeave", OnHyperlinkLeave) | |
_G[tabName]:SetClampRectInsets(0, 0, 38, - 38) | |
FCF_SetWindowAlpha(_G[tabName], 0) | |
_G[tabName .. "EditBoxLeft"]:Hide() | |
_G[tabName .. "EditBoxRight"]:Hide() | |
_G[tabName .. "EditBoxMid"]:Hide() | |
_G[tabName .. "ButtonFrame"]:Hide() | |
_G[tabName .. "Tab"].noMouseAlpha = 0 | |
_G[tabName .. "Tab"].leftTexture:SetTexture(nil) | |
_G[tabName .. "Tab"].middleTexture:SetTexture(nil) | |
_G[tabName .. "Tab"].rightTexture:SetTexture(nil) | |
if _G[tabName].ScrollBar then | |
_G[tabName].ScrollBar:SetThumbTexture("") | |
_G[tabName].ScrollToBottomButton:SetNormalTexture("") | |
_G[tabName].ScrollToBottomButton.Flash = nil | |
end | |
end | |
__SecureHook__(_G["ChatFrame" .. 1 .. "Tab"]) | |
function SetAlpha(self, alpha) | |
ChatFrameMenuButton:SetAlpha(alpha) | |
ChatFrameChannelButton:SetAlpha(alpha) | |
end | |
-- OnHyperlinkEnter | |
function OnHyperlinkEnter(self, linkData) | |
local linkType, id = strsplit(":", linkData, 3) | |
GameTooltip:SetOwner(self, "ANCHOR_CURSOR") | |
local ok = pcall(GameTooltip.SetHyperlink, GameTooltip, linkData) | |
if ok then | |
GameTooltip:Show() | |
if linkType == "item" then | |
_CheckCompare = true | |
_CheckType = "item" | |
return Continue(AutoCheckCompare) | |
elseif linkType == "achievement" and id then | |
local selfLink = GetAchievementLink(id) | |
if selfLink then | |
_CheckCompare = true | |
_CheckType = "achievement" | |
_CheckAchievement = selfLink | |
return Continue(AutoCheckCompare) | |
end | |
end | |
end | |
end | |
-- OnHyperlinkLeave | |
function OnHyperlinkLeave(self, linkData) | |
_CheckCompare = false | |
_CheckAchievement = nil | |
_CheckType = nil | |
GameTooltip:Hide() | |
if ( GameTooltip.shoppingTooltips ) then | |
for _, frame in pairs(GameTooltip.shoppingTooltips) do | |
frame:Hide(); | |
end | |
end | |
end | |
-- AutoCheckCompareAchievement | |
function AutoCheckCompare() | |
local inCompare = false | |
while true do | |
if not _CheckCompare then | |
inCompare = false | |
return | |
end | |
Next() | |
if _CheckType == "item" then | |
if GameTooltip:IsShown() and IsModifiedClick("COMPAREITEMS") then | |
if not inCompare then | |
inCompare = true | |
GameTooltip_ShowCompareItem() | |
end | |
elseif inCompare then | |
inCompare = false | |
if ( GameTooltip.shoppingTooltips ) then | |
for _, frame in pairs(GameTooltip.shoppingTooltips) do | |
frame:Hide(); | |
end | |
end | |
end | |
elseif _CheckType == "achievement" then | |
if GameTooltip:IsShown() and IsModifiedClick("COMPAREITEMS") then | |
if not inCompare then | |
inCompare = true | |
-- find correct side | |
local rightDist = 0; | |
local leftPos = GameTooltip:GetLeft(); | |
local rightPos = GameTooltip:GetRight(); | |
if ( not rightPos ) then | |
rightPos = 0; | |
end | |
if ( not leftPos ) then | |
leftPos = 0; | |
end | |
rightDist = GetScreenWidth() - rightPos; | |
if (leftPos and (rightDist < leftPos)) then | |
GameTooltip.shoppingTooltips[1]:SetOwner(GameTooltip, "ANCHOR_NONE") | |
GameTooltip.shoppingTooltips[1]:SetPoint("TOPRIGHT", GameTooltip, "TOPLEFT") | |
else | |
GameTooltip.shoppingTooltips[1]:SetOwner(GameTooltip, "ANCHOR_NONE") | |
GameTooltip.shoppingTooltips[1]:SetPoint("TOPLEFT", GameTooltip, "TOPRIGHT") | |
end | |
GameTooltip.shoppingTooltips[1]:SetHyperlink(_CheckAchievement) | |
GameTooltip.shoppingTooltips[1]:Show() | |
end | |
elseif inCompare then | |
inCompare = false | |
if ( GameTooltip.shoppingTooltips ) then | |
for _, frame in pairs(GameTooltip.shoppingTooltips) do | |
frame:Hide(); | |
end | |
end | |
end | |
end | |
end | |
end | |
while _G["ChatFrame" .. _LoadedTab] do | |
ApplyStyle("ChatFrame" .. _LoadedTab) | |
_LoadedTab = _LoadedTab + 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment