Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------
- --Init Work--
- -------------
- ChatFontNormal:SetFont('Interface\\AddOns\\tChat\\Font.ttf', 12)
- local tabTexturesHideTable = {'Left','Middle','Right','SelectedLeft','SelectedRight','SelectedMiddle','HighlightLeft','HighlightMiddle','HighlightRight'}
- local chatFrameTexturesHideTable = {'ButtonFrame', 'LeftTexture', 'BottomLeftTexture', 'BottomTexture', 'BottomRightTexture', 'RightTexture', 'TopRightTexture', 'TopTexture', 'TopLeftTexture', 'Background'}
- local chatElementHideTable = {}
- table.insert(chatElementHideTable, ChatFrameMenuButton)
- table.insert(chatElementHideTable, ChatFrameChannelButton)
- table.insert(chatElementHideTable, QuickJoinToastButton)
- table.insert(chatElementHideTable, ChatFrameToggleVoiceDeafenButton)
- table.insert(chatElementHideTable, ChatFrameToggleVoiceMuteButton)
- CHAT_FRAME_FADE_TIME = 0
- CHAT_TAB_SHOW_DELAY = 0
- CHAT_TAB_HIDE_DELAY = 0.5
- CHAT_FRAME_FADE_OUT_TIME = 1
- CHAT_FRAME_TAB_NORMAL_MOUSEOVER_ALPHA = 1
- CHAT_FRAME_TAB_NORMAL_NOMOUSE_ALPHA = 0
- CHAT_FRAME_TAB_SELECTED_MOUSEOVER_ALPHA = 1
- CHAT_FRAME_TAB_SELECTED_NOMOUSE_ALPHA = 0
- for k, v in pairs(chatElementHideTable) do
- v:Hide()
- hooksecurefunc(v, 'Show', function()
- if v:IsShown() then
- v:Hide()
- end
- end)
- end
- ---------------------------
- --Handle the BNToastFrame--
- ---------------------------
- hooksecurefunc(BNToastFrame, 'Show', function()
- BNToastFrame:SetBackdrop({
- bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
- edgeFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
- edgeSize = 0.8,
- insets = {
- left = 0.8,
- right = 0.8,
- bottom = 0.8,
- top = 0.8
- }
- })
- BNToastFrame:SetBackdropColor(0.2, 0.2, 0.2, 1)
- BNToastFrame:SetBackdropBorderColor(0, 0, 0, 1)
- BNToastFrame:ClearAllPoints()
- BNToastFrame:SetPoint('BOTTOMLEFT', ChatFrame1, 'TOPLEFT', 0, 72)
- BNToastFrame.CloseButton:SetNormalTexture('')
- BNToastFrame.CloseButton:SetHighlightTexture('')
- BNToastFrame.CloseButton:SetPushedTexture('')
- BNToastFrame.CloseButton:SetDisabledTexture('')
- BNToastFrame.CloseButton.Text = BNToastFrame.CloseButton:CreateFontString(nil, 'OVERLAY')
- BNToastFrame.CloseButton.Text:SetFont('Interface\\AddOns\\tChat\\Font.ttf', 14)
- BNToastFrame.CloseButton.Text:SetPoint('CENTER', 5, 4)
- BNToastFrame.CloseButton.Text:SetText('x')
- BNToastFrame.CloseButton.Text:SetTextColor(0.5, 0.5, 0.5, 1)
- end)
- BNToastFrame.CloseButton:HookScript('OnEnter', function()
- BNToastFrame.CloseButton.Text:SetTextColor(0.41, 0.8, 0.94, 1)
- end)
- BNToastFrame.CloseButton:HookScript('OnLeave', function()
- BNToastFrame.CloseButton.Text:SetTextColor(0.5, 0.5, 0.5, 1)
- end)
- hooksecurefunc(BNToastFrame, 'SetPoint', function()
- local a, b, c, d, e = BNToastFrame:GetPoint()
- if (a ~= 'BOTTOMLEFT' or c ~= 'TOPLEFT' or d ~= 0 or e ~= 72) then
- BNToastFrame:SetPoint('BOTTOMLEFT', ChatFrame1, 'TOPLEFT', 0, 72)
- end
- end)
- -----------------------------------------------------------------------
- --The main function which will move, resize, and make stuff less ugly--
- -----------------------------------------------------------------------
- local function tChatMain(frame)
- local name = frame:GetName()
- --make it so you can move the chat anywhere and resize it
- _G[name]:SetClampRectInsets(0, 0, 0, 0)
- _G[name]:SetMinResize(20, 20)
- --hide all the stupid shit
- for k, v in pairs(chatFrameTexturesHideTable) do
- _G[name..v]:Hide()
- end
- --hide the scroll bar and scrollbar thumb and make sure we never see the scroll bar again
- _G[name].ScrollBar:Hide()
- hooksecurefunc(_G[name].ScrollBar, 'Show', function(self)
- if self:IsShown() then
- self:Hide()
- end
- end)
- _G[name..'ThumbTexture']:Hide()
- --move the resize button and make it smaller
- local resizeButton = name..'ResizeButton'
- _G[resizeButton]:SetScale(0.7)
- _G[resizeButton]:SetPoint('BOTTOMRIGHT', _G[name], 'BOTTOMRIGHT', 0, 0)
- --move the scroll to the bottom button, and change its appearance, also hook in some stuff
- local button = _G[name].ScrollToBottomButton
- button:SetSize(10, 10)
- button:ClearAllPoints()
- if name == 'ChatFrame2' then
- button:SetPoint('TOPLEFT', _G[name], 'TOPRIGHT', 2, 24)
- else
- button:SetPoint('TOPLEFT', _G[name], 'TOPRIGHT', 2, 0)
- end
- button:SetNormalTexture('')
- button:SetHighlightTexture('')
- button:SetPushedTexture('')
- button.Flash:SetTexture('')
- button.Text = _G[name].ScrollToBottomButton:CreateFontString(nil, 'OVERLAY')
- button.Text:SetFont('Interface\\AddOns\\tChat\\Font.ttf', 12)
- button.Text:SetPoint('TOPLEFT')
- button.Text:SetText('V')
- button.Text:SetTextColor(0.5, 0.5, 0.5, 1)
- button:HookScript('OnClick', function()
- _G[name].ScrollToBottomButton.Text:SetTextColor(0.5, 0.5, 0.5, 1)
- end)
- --some of our tab modifications, mainly appearance; other mods are done outside of our for loop
- local tab = name..'Tab'
- if name == 'ChatFrame1' then
- _G[tab]:ClearAllPoints()
- _G[tab]:SetPoint('BOTTOMLEFT', ChatFrame1, 'TOPLEFT', 0, 32)
- end
- for key, value in pairs(tabTexturesHideTable) do
- _G[tab..value]:SetTexture(nil)
- end
- local tabText = tab..'Text'
- _G[tabText]:SetFont('Interface\\AddOns\\tChat\\Font.ttf', 12)
- _G[tabText]:SetTextColor(1, 1, 1, 1)
- hooksecurefunc(_G[tabText], 'SetTextColor', function(self)
- local a, b, c = self:GetTextColor()
- if (a < 0.99 or b < 0.99 or c < 0.99) then
- self:SetTextColor(1, 1, 1)
- end
- end)
- --our editbox modifications
- local editbox = _G[name..'EditBox']
- local tex = {editbox:GetRegions()}
- editbox:SetAltArrowKeyMode(false)
- _G[editbox:GetName()..'Left']:Hide()
- _G[editbox:GetName()..'Mid']:Hide()
- _G[editbox:GetName()..'Right']:Hide()
- for t = 6, #tex do
- tex[t]:SetAlpha(0)
- end
- editbox:ClearAllPoints()
- editbox:SetPoint('BOTTOMLEFT', name, 'TOPLEFT', 0, 0)
- editbox:SetPoint('BOTTOMRIGHT', name, 'TOPRIGHT', 0, 0)
- end
- ---------------------------
- --Rest of our tab changes--
- ---------------------------
- hooksecurefunc(_G['ChatFrame1Tab'], 'SetPoint', function(self) --don't need to hook other tabs, since they're all based on this one
- local a, b, c, d, e = self:GetPoint()
- if (a ~= 'BOTTOMLEFT' or c ~= 'TOPLEFT' or d ~= 0 or e ~= 32) then
- self:ClearAllPoints()
- self:SetPoint('BOTTOMLEFT', ChatFrame1, 'TOPLEFT', 0, 32)
- end
- end)
- hooksecurefunc('FCFTab_UpdateColors', function(self, selected)
- if self:GetName() then
- if selected then
- _G[self:GetName()..'Text']:SetAlpha(1)
- else
- _G[self:GetName()..'Text']:SetAlpha(0.5)
- end
- end
- end)
- ----------------------------------------------------------
- --Hook section for things that don't want to simply hide--
- ----------------------------------------------------------
- hooksecurefunc('FCF_FadeInScrollbar', function(chatFrame)
- if UIFrameIsFlashing(chatFrame.ScrollToBottomButton.Flash) then
- chatFrame.ScrollToBottomButton.Text:SetTextColor(0.41, 0.8, 0.94, 1)
- end
- UIFrameFadeIn(chatFrame.ScrollToBottomButton, 0.1, chatFrame.ScrollToBottomButton:GetAlpha(), 1)
- end)
- hooksecurefunc('FCF_FadeOutScrollbar', function(chatFrame)
- if not UIFrameIsFlashing(chatFrame.ScrollToBottomButton.Flash) then
- chatFrame.ScrollToBottomButton.Text:SetTextColor(0.5, 0.5, 0.5, 1)
- UIFrameFadeOut(chatFrame.ScrollToBottomButton, 1, chatFrame.ScrollToBottomButton:GetAlpha(), 0)
- end
- end)
- ----------------------------------------------------------------------------------------------
- --This is so our cool V scrolltobottombutton will update in real time when we reach the bottom
- ----------------------------------------------------------------------------------------------
- hooksecurefunc('ChatFrame_OnUpdate', function(self, elapsed)
- local flash = self.ScrollToBottomButton.Flash
- if flash then
- local shouldFlash = not self:AtBottom()
- if shouldFlash ~= UIFrameIsFlashing(flash) then
- if not shouldFlash then
- self.ScrollToBottomButton.Text:SetTextColor(0.5, 0.5, 0.5, 1)
- end
- end
- end
- end)
- ------------------------------------------
- --Skin the ChatFrames to be good looking--
- ------------------------------------------
- local tChatBG = CreateFrame('frame', nil, UIParent)
- tChatBG:SetPoint('TOPLEFT', ChatFrame1, 'TOPLEFT', 0, 32)
- tChatBG:SetPoint('BOTTOMRIGHT', ChatFrame1, 'BOTTOMRIGHT', 0, 0)
- tChatBG:SetBackdrop({
- bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
- edgeFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
- edgeSize = -0.8,
- insets = {
- left = -0.8,
- right = -0.8,
- bottom = -0.8,
- top = -0.8
- }
- })
- tChatBG:SetBackdropColor(0.2, 0.2, 0.2, 1)
- tChatBG:SetFrameStrata('BACKGROUND')
- tChatBG:SetBackdropBorderColor(0, 0, 0, 1)
- --------------------------------------------------------
- --Handle the CombatLogBar that shows in up the 2nd tab--
- --------------------------------------------------------
- local f = CreateFrame('frame', nil, UIParent)
- f:RegisterEvent('ADDON_LOADED')
- f:SetScript('OnEvent', function(self, event, addon)
- if addon == 'Blizzard_CombatLog' then
- f:UnregisterEvent('ADDON_LOADED')
- local _, parent = CombatLogQuickButtonFrame_Custom:GetPoint()
- CombatLogQuickButtonFrame_Custom:SetPoint('BOTTOMRIGHT', parent, 'TOPRIGHT')
- CombatLogQuickButtonFrame_CustomTexture:SetAlpha(0)
- CombatLogQuickButtonFrameButton1:GetFontString():SetFont('Interface\\AddOns\\tChat\\Font.ttf', 10)
- CombatLogQuickButtonFrameButton2:GetFontString():SetFont('Interface\\AddOns\\tChat\\Font.ttf', 10)
- end
- end)
- -----------------------------------------------------------------------------------------------------------------------
- --Since we moved the chat tabs, this is necessary to fade in the chat elements when we mouse over the moved chat tabs--
- -----------------------------------------------------------------------------------------------------------------------
- local g = CreateFrame('frame', nil, UIParent)
- g.elapsed = 0
- g:SetScript('OnUpdate', function(self, elapsed)
- self.elapsed = self.elapsed + elapsed
- if self.elapsed > 0.1 then
- for _, frameName in pairs(CHAT_FRAMES) do
- local chatFrame = _G[frameName]
- if chatFrame:IsShown() then
- if (ChatFrame1Tab:IsMouseOver() or ChatFrame2Tab:IsMouseOver()) then
- chatFrame.mouseOutTime = 0
- if (cursorX == LAST_CURSOR_X and cursorY == LAST_CURSOR_Y and not chatFrame.hasBeenFaded) then
- chatFrame.mouseInTime = (chatFrame.mouseInTime or 0) + elapsed
- if (chatFrame.mouseInTime > CHAT_TAB_SHOW_DELAY) then
- FCF_FadeInChatFrame(chatFrame)
- end
- else
- chatFrame.mouseInTime = 0
- end
- elseif (chatFrame:IsShown() and chatFrame.hasBeenFaded) then
- chatFrame.mouseInTime = 0
- chatFrame.mouseOutTime = (chatFrame.mouseOutTime or 0) + elapsed
- if (chatFrame.mouseOutTime > CHAT_TAB_HIDE_DELAY) then
- FCF_FadeOutChatFrame(chatFrame)
- end
- end
- end
- end
- self.elapsed = 0
- end
- end)
- -----------------------------------------------------------------------------------------------
- --This block of code makes it so player names show up as class colored in chat when typed out--
- -----------------------------------------------------------------------------------------------
- local function AddMessage(self, text, ...)
- --Remove player brackets
- text = text:gsub('|Hplayer:([^%|]+)|h%[([^%]]+)%]|h', '|Hplayer:%1|h%2|h')
- --Remove Away and Busy Tags
- text = text:gsub('<Away>', '')
- text = text:gsub('<Busy>', '')
- --Strip yells: says: from chat
- text = text:gsub('|Hplayer:([^%|]+)|h(.+)|h says:', '|Hplayer:%1|h%2|h:')
- text = text:gsub('|Hplayer:([^%|]+)|h(.+)|h yells:', '|Hplayer:%1|h%2|h:')
- --Shorten GMotD and change online/offline warnings
- text = text:gsub('Guild Message of the Day:', 'GMotD -')
- text = text:gsub('has come online.', '+')
- text = text:gsub('has gone offline.', '-')
- --channel replace (Trade and custom)
- text = text:gsub('|h%[(%d+)%. .-%]|h', '|h%1.|h')
- --url search
- text = text:gsub('([wWhH][wWtT][wWtT][%.pP]%S+[^%p%s])', '|cffffffff|Hurl:%1|h[%1]|h|r')
- return self.DefaultAddMessage(self, text, ...)
- end
- local function RGBPercToHex(r, g, b)
- r = r <= 1 and r >= 0 and r or 0
- g = g <= 1 and g >= 0 and g or 0
- b = b <= 1 and b >= 0 and b or 0
- return string.format('%02x%02x%02x', r*255, g*255, b*255)
- end
- local function colorName(self, event, msg, ...)
- local test = msg:gsub('[^a-zA-Z%s]', '')
- local words = {strsplit(' ', test)}
- for i = 1, #words do
- local w = words[i]
- if (w and not (w == 'player' or w == 'target') and UnitName(w) and UnitIsPlayer(w)) then
- local class = select(2, UnitClass(w))
- local colors = RAID_CLASS_COLORS[class]
- if (colors) then
- msg = gsub(msg, w, '|cff'..RGBPercToHex(colors.r, colors.g, colors.b)..'%1|r')
- end
- end
- end
- return false, msg, ...
- end
- ChatFrame_AddMessageEventFilter('CHAT_MSG_CHANNEL', colorName)
- ChatFrame_AddMessageEventFilter('CHAT_MSG_GUILD', colorName)
- ChatFrame_AddMessageEventFilter('CHAT_MSG_OFFICER', colorName)
- ChatFrame_AddMessageEventFilter('CHAT_MSG_SAY', colorName)
- ChatFrame_AddMessageEventFilter('CHAT_MSG_YELL', colorName)
- ChatFrame_AddMessageEventFilter('CHAT_MSG_PARTY', colorName)
- ChatFrame_AddMessageEventFilter('CHAT_MSG_PARTY_LEADER', colorName)
- ChatFrame_AddMessageEventFilter('CHAT_MSG_RAID', colorName)
- ChatFrame_AddMessageEventFilter('CHAT_MSG_RAID_LEADER', colorName)
- ChatFrame_AddMessageEventFilter('CHAT_MSG_RAID_WARNING', colorName)
- ChatFrame_AddMessageEventFilter('CHAT_MSG_BN_WHISPER', colorName)
- ChatFrame_AddMessageEventFilter('CHAT_MSG_BN_WHISPER_INFORM', colorName)
- ChatFrame_AddMessageEventFilter('CHAT_MSG_WHISPER', colorName)
- ChatFrame_AddMessageEventFilter('CHAT_MSG_WHISPER_INFORM', colorName)
- ------------------------------------------------------------------------------------
- --This block of code will make the chat appear slightly different, but streamlined--
- ------------------------------------------------------------------------------------
- CHAT_WHISPER_GET = 'F %s '
- CHAT_WHISPER_INFORM_GET = 'T %s '
- CHAT_BN_WHISPER_GET = 'F %s '
- CHAT_BN_WHISPER_INFORM_GET = 'T %s '
- CHAT_BATTLEGROUND_GET = '|Hchannel:Battleground|hBG.|h %s: '
- CHAT_BATTLEGROUND_LEADER_GET = '|Hchannel:Battleground|hBGL.|h %s: '
- CHAT_GUILD_GET = '|Hchannel:Guild|hG.|h %s: '
- CHAT_OFFICER_GET = '|Hchannel:Officer|hO.|h %s: '
- CHAT_PARTY_GET = '|Hchannel:Party|hP.|h %s: '
- CHAT_PARTY_LEADER_GET = '|Hchannel:Party|hPL.|h %s: '
- CHAT_PARTY_GUIDE_GET = '|Hchannel:Party|hPG.|h %s: '
- CHAT_RAID_GET = '|Hchannel:Raid|hR.|h %s: '
- CHAT_RAID_LEADER_GET = '|Hchannel:Raid|hRL.|h %s: '
- CHAT_RAID_WARNING_GET = '|Hchannel:RaidWarning|hRW.|h %s: '
- CHAT_INSTANCE_CHAT_GET = '|Hchannel:Battleground|hI.|h %s: '
- CHAT_INSTANCE_CHAT_LEADER_GET = '|Hchannel:Battleground|hIL.|h %s: '
- YOU_LOOT_MONEY_GUILD = YOU_LOOT_MONEY
- LOOT_MONEY_SPLIT_GUILD = LOOT_MONEY_SPLIT
- ----------------------------------------------------------------------------------------------------------------------
- --alt click invite players and when clicked on things deemed url, open the edit box and select all the text for copy--
- ----------------------------------------------------------------------------------------------------------------------
- local DefaultSetItemRef = SetItemRef
- function SetItemRef(link, ...)
- local type, value = link:match('(%a+):(.+)')
- if IsAltKeyDown() and type == 'player' then
- InviteUnit(value:match('([^:]+)'))
- elseif (type == 'url') then
- local eb = LAST_ACTIVE_CHAT_EDIT_BOX or ChatFrame1EditBox
- if not eb then return end
- eb:Show()
- eb:SetText(value)
- eb:SetFocus()
- eb:HighlightText()
- else
- return DefaultSetItemRef(link, ...)
- end
- end
- --------------------------
- --Call our Main Function--
- --------------------------
- for i = 1, NUM_CHAT_WINDOWS do
- local frame = _G['ChatFrame'..i]
- tChatMain(frame)
- if (i ~= 2) then
- frame.DefaultAddMessage = frame.AddMessage --idk what all of this is
- frame.AddMessage = AddMessage --idk what all of this is
- end
- end
- ------------------------------------------------------
- --This will handle temporary frames like pet battles--
- ------------------------------------------------------
- hooksecurefunc('FCF_OpenTemporaryWindow', function()
- for _, name in next, CHAT_FRAMES do
- local frame = _G[name]
- if (frame.isTemporary) then
- tChatMain(frame)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement