Skip to content

Instantly share code, notes, and snippets.

/Scripts Secret

Created November 28, 2017 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/a2ada7b314aa7f1421a47756a41effd8 to your computer and use it in GitHub Desktop.
Save anonymous/a2ada7b314aa7f1421a47756a41effd8 to your computer and use it in GitHub Desktop.
--Scripts
--Helpers
local SetAlphaParent = CreateFrame("Frame", nil)
SetAlphaParent:EnableMouse(false)
SetAlphaParent:Hide()
local function Move(frame, point, parent, relativePoint, posX, posY)
frame:ClearAllPoints()
frame:SetPoint(point, parent, relativePoint, posX, posY)
end
--Frames
local EventWatcher = CreateFrame("Frame")
local ErrorEvent = CreateFrame("Frame")
--Locales
local _, instanceType, numGroupMembers, numRaidMembers = _, instanceType, numGroupMembers, numRaidMembers
local _, class = UnitClass("player")
local HideBlizzardArt = {
--Player
PlayerHitIndicator,
PlayerName,
PlayerPVPIcon,
PlayerFrameRoleIcon,
PlayerFrameFlash,
PlayerAttackGlow,
PlayerPrestigeBadge,
PlayerPrestigePortrait,
PlayerFrameGroupIndicator,
--Pet
PetHitIndicator,
PetName,
PetAttackModeTexture,
PetFrameFlash,
--Target
TargetFrameTextureFramePVPIcon,
TargetFrameTextureFramePrestigePortrait,
TargetFrameTextureFramePrestigeBadge,
TargetFrameFlash,
--Focus
FocusFrameTextureFramePVPIcon,
FocusFrameFlash,
FocusFrameTextureFramePrestigePortrait,
FocusFrameTextureFramePrestigeBadge,
--Party
PartyMemberFrame1PVPIcon,
PartyMemberFrame2PVPIcon,
PartyMemberFrame3PVPIcon,
PartyMemberFrame4PVPIcon,
PartyMemberFrame1RoleIcon,
PartyMemberFrame2RoleIcon,
PartyMemberFrame3RoleIcon,
PartyMemberFrame4RoleIcon,
--ArenaFrames
ArenaEnemyFrame1PetFrame,
ArenaEnemyFrame2PetFrame,
ArenaEnemyFrame3PetFrame,
ArenaEnemyFrame4PetFrame,
ArenaEnemyFrame5PetFrame,
--LossOfControlFrame
select(1,LossOfControlFrame:GetRegions()),
select(2,LossOfControlFrame:GetRegions()),
select(3,LossOfControlFrame:GetRegions()),
LossOfControlFrame.AbilityName,
--MainMenu
MainMenuBarLeftEndCap,
MainMenuBarRightEndCap,
SlidingActionBarTexture0,
SlidingActionBarTexture1,
--Minimap
MinimapBorderTop,
MiniMapWorldMapButton,
MinimapZoomIn,
MinimapZoomOut,
MiniMapTracking,
GarrisonLandingPageMinimapButton.LoopingGlow,
}
local SkinBlizzardArt = {
--Player
PlayerFrameTexture,
PlayerFrameAlternateManaBarBorder,
PlayerFrameAlternateManaBarLeftBorder,
PlayerFrameAlternateManaBarRightBorder,
ComboPointPlayerFrame.Background,
ComboPointPlayerFrameCombo1PointOff,
ComboPointPlayerFrameCombo2PointOff,
ComboPointPlayerFrameCombo3PointOff,
ComboPointPlayerFrameCombo4PointOff,
ComboPointPlayerFrameCombo5PointOff,
ComboPointPlayerFrameCombo6PointOff,
CastingBarFrameBorder,
--Pet
PetFrameTexture,
--Target
TargetFrameTextureFrameTexture,
TargetFrameToTTextureFrameTexture,
TargetFrameSpellBarBorder,
--Focus
FocusFrameTextureFrameTexture,
FocusFrameToTTextureFrameTexture,
FocusFrameSpellBarBorder,
--Party
PartyMemberFrame1Texture,
PartyMemberFrame2Texture,
PartyMemberFrame3Texture,
PartyMemberFrame4Texture,
PartyMemberFrame1PetFrameTexture,
PartyMemberFrame2PetFrameTexture,
PartyMemberFrame3PetFrameTexture,
PartyMemberFrame4PetFrameTexture,
--Arena
ArenaEnemyFrame1Texture,
ArenaEnemyFrame2Texture,
ArenaEnemyFrame3Texture,
ArenaEnemyFrame4Texture,
ArenaEnemyFrame5Texture,
ArenaEnemyFrame1SpecBorder,
ArenaEnemyFrame2SpecBorder,
ArenaEnemyFrame3SpecBorder,
ArenaEnemyFrame4SpecBorder,
ArenaEnemyFrame5SpecBorder,
ArenaEnemyFrame1PetFrameTexture,
ArenaEnemyFrame2PetFrameTexture,
ArenaEnemyFrame3PetFrameTexture,
ArenaEnemyFrame4PetFrameTexture,
ArenaEnemyFrame5PetFrameTexture,
ArenaPrepFrame1Texture,
ArenaPrepFrame2Texture,
ArenaPrepFrame3Texture,
ArenaPrepFrame4Texture,
ArenaPrepFrame5Texture,
ArenaPrepFrame1SpecBorder,
ArenaPrepFrame2SpecBorder,
ArenaPrepFrame3SpecBorder,
ArenaPrepFrame4SpecBorder,
ArenaPrepFrame5SpecBorder,
--Boss
Boss1TargetFrameTextureFrameTexture,
Boss2TargetFrameTextureFrameTexture,
Boss3TargetFrameTextureFrameTexture,
Boss4TargetFrameTextureFrameTexture,
Boss5TargetFrameTextureFrameTexture,
Boss1TargetFrameSpellBarBorder,
Boss2TargetFrameSpellBarBorder,
Boss3TargetFrameSpellBarBorder,
Boss4TargetFrameSpellBarBorder,
Boss5TargetFrameSpellBarBorder,
--UI
AlternatePowerBarBorder,
AlternatePowerBarLeftBorder,
AlternatePowerBarRightBorder,
StanceBarLeft,
StanceBarMiddle,
StanceBarRight,
BonusActionBarFrameTexture0,
BonusActionBarFrameTexture1,
BonusActionBarFrameTexture2,
BonusActionBarFrameTexture3,
BonusActionBarFrameTexture4,
SlidingActionBarTexture0,
SlidingActionBarTexture1,
MainMenuBarLeftEndCap,
MainMenuBarRightEndCap,
MainMenuBarTexture0,
MainMenuBarTexture1,
MainMenuBarTexture2,
MainMenuBarTexture3,
MainMenuMaxLevelBar0,
MainMenuMaxLevelBar1,
MainMenuMaxLevelBar2,
MainMenuMaxLevelBar3,
MainMenuXPBarTextureLeftCap,
MainMenuXPBarTextureRightCap,
MainMenuXPBarTextureMid,
ReputationWatchBarTexture0,
ReputationWatchBarTexture1,
ReputationWatchBarTexture2,
ReputationWatchBarTexture3,
ReputationXPBarTexture0,
ReputationXPBarTexture1,
ReputationXPBarTexture2,
ReputationXPBarTexture3,
ReputationWatchBar.StatusBar.XPBarTexture0,
ReputationWatchBar.StatusBar.XPBarTexture1,
ReputationWatchBar.StatusBar.XPBarTexture2,
ReputationWatchBar.StatusBar.XPBarTexture3,
ReputationWatchBar.StatusBar.WatchBarTexture0,
ReputationWatchBar.StatusBar.WatchBarTexture1,
ReputationWatchBar.StatusBar.WatchBarTexture2,
ReputationWatchBar.StatusBar.WatchBarTexture3,
ArtifactWatchBar.StatusBar.XPBarTexture0,
ArtifactWatchBar.StatusBar.XPBarTexture1,
ArtifactWatchBar.StatusBar.XPBarTexture2,
ArtifactWatchBar.StatusBar.XPBarTexture3,
ArtifactWatchBar.StatusBar.WatchBarTexture0,
ArtifactWatchBar.StatusBar.WatchBarTexture1,
ArtifactWatchBar.StatusBar.WatchBarTexture2,
ArtifactWatchBar.StatusBar.WatchBarTexture3,
HonorWatchBar.StatusBar.XPBarTexture0,
HonorWatchBar.StatusBar.XPBarTexture1,
HonorWatchBar.StatusBar.XPBarTexture2,
HonorWatchBar.StatusBar.XPBarTexture3,
HonorWatchBar.StatusBar.WatchBarTexture0,
HonorWatchBar.StatusBar.WatchBarTexture1,
HonorWatchBar.StatusBar.WatchBarTexture2,
HonorWatchBar.StatusBar.WatchBarTexture3,
--Minimap
MinimapBorder,
MiniMapTrackingButtonBorder,
MiniMapLFGFrameBorder,
MiniMapBattlefieldBorder,
MiniMapMailBorder,
MinimapBorderTop,
QueueStatusMinimapButtonBorder,
--Zonemap
BattlefieldMinimapBackground,
}
local SkinMissingSantaUITextures = {
--Player
ComboPointPlayerFrame.Background,
ComboPointPlayerFrameCombo1PointOff,
ComboPointPlayerFrameCombo2PointOff,
ComboPointPlayerFrameCombo3PointOff,
ComboPointPlayerFrameCombo4PointOff,
ComboPointPlayerFrameCombo5PointOff,
ComboPointPlayerFrameCombo6PointOff,
--UI
AlternatePowerBarBorder,
AlternatePowerBarLeftBorder,
AlternatePowerBarRightBorder,
StanceBarLeft,
StanceBarMiddle,
StanceBarRight,
BonusActionBarFrameTexture0,
BonusActionBarFrameTexture1,
BonusActionBarFrameTexture2,
BonusActionBarFrameTexture3,
BonusActionBarFrameTexture4,
SlidingActionBarTexture0,
SlidingActionBarTexture1,
MainMenuBarLeftEndCap,
MainMenuBarRightEndCap,
MainMenuBarTexture0,
MainMenuBarTexture1,
MainMenuBarTexture2,
MainMenuBarTexture3,
MainMenuMaxLevelBar0,
MainMenuMaxLevelBar1,
MainMenuMaxLevelBar2,
MainMenuMaxLevelBar3,
MainMenuXPBarTextureLeftCap,
MainMenuXPBarTextureRightCap,
MainMenuXPBarTextureMid,
ReputationWatchBarTexture0,
ReputationWatchBarTexture1,
ReputationWatchBarTexture2,
ReputationWatchBarTexture3,
ReputationXPBarTexture0,
ReputationXPBarTexture1,
ReputationXPBarTexture2,
ReputationXPBarTexture3,
ReputationWatchBar.StatusBar.XPBarTexture0,
ReputationWatchBar.StatusBar.XPBarTexture1,
ReputationWatchBar.StatusBar.XPBarTexture2,
ReputationWatchBar.StatusBar.XPBarTexture3,
ReputationWatchBar.StatusBar.WatchBarTexture0,
ReputationWatchBar.StatusBar.WatchBarTexture1,
ReputationWatchBar.StatusBar.WatchBarTexture2,
ReputationWatchBar.StatusBar.WatchBarTexture3,
ArtifactWatchBar.StatusBar.XPBarTexture0,
ArtifactWatchBar.StatusBar.XPBarTexture1,
ArtifactWatchBar.StatusBar.XPBarTexture2,
ArtifactWatchBar.StatusBar.XPBarTexture3,
ArtifactWatchBar.StatusBar.WatchBarTexture0,
ArtifactWatchBar.StatusBar.WatchBarTexture1,
ArtifactWatchBar.StatusBar.WatchBarTexture2,
ArtifactWatchBar.StatusBar.WatchBarTexture3,
HonorWatchBar.StatusBar.XPBarTexture0,
HonorWatchBar.StatusBar.XPBarTexture1,
HonorWatchBar.StatusBar.XPBarTexture2,
HonorWatchBar.StatusBar.XPBarTexture3,
HonorWatchBar.StatusBar.WatchBarTexture0,
HonorWatchBar.StatusBar.WatchBarTexture1,
HonorWatchBar.StatusBar.WatchBarTexture2,
HonorWatchBar.StatusBar.WatchBarTexture3,
}
--Functions
--Setup CVars
local function SetCVars()
SetCVar("cameraDistanceMaxZoomFactor", 2.6) -- 1.90000009536743) "Best PvP Factor 18 Clicks"
SetCVar("chatStyle", "classic", "chatStyle")
SetCVar("enableFloatingCombatText", 0)
SetCVar("floatingCombatTextCombatHealingAbsorbTarget", 1) --Display amount of shield added to the target
SetCVar("floatingCombatTextSpellMechanics", 1)
SetCVar("floatingCombatTextSpellMechanicsOther", 1)
SetCVar("floatingCombatTextCombatDamage", 1)
SetCVar("floatingCombatTextDodgeParryMiss", 0)
SetCVar("floatingCombatTextLowManaHealth", 0)
SetCVar("floatingCombatTextCombatState", 0)
SetCVar("floatingCombatTextAuras", 0)
SetCVar("noBuffDebuffFilterOnTarget", 1) --Show all debuffs on enemies
end
--Setup Nameplate specific Cvars
local function SetNameplateCVars()
SetCVar("nameplateMinAlpha", 1); -- Default 0.5
SetCVar("nameplateMinScale", 1); -- Default 0.8 The minimum scale of nameplates
SetCVar("nameplateOtherTopInset", GetCVarDefault("nameplateOtherTopInset"))
SetCVar("nameplateOtherBottomInset", GetCVarDefault("nameplateOtherBottomInset"))
SetCVar("nameplateMaxDistance", 60) --Maximum distance at which nameplates are shown
SetCVar("nameplateOverlapH", 0.8) --0.4-- Default 0.8 Percentage amount for horizontal overlap of nameplates
SetCVar("nameplateOverlapV", 0.5) --0.5-- Default 1.1 Percentage amount for vertical overlap of nameplates
SetCVar("nameplateSelectedScale", 1) -- The scale of the selected nameplate
SetCVar("nameplateMotion", 1) --nameplates overlappbug = 0, stacking = 1 Defines the movement/collision model for nameplates
SetCVar("nameplateShowEnemyPets", 1) --Hide enemy pets
SetCVar("nameplateShowEnemyTotems", 1) --Show enemy totems
SetCVar("nameplateSelfAlpha", 1) -- The alpha of the self nameplate
SetCVar("nameplatePersonalShowAlways",1)
--SetCVar("NameplatePersonalHideDelayAlpha", 1) -- Determines the alpha of the personal nameplate after no visibility conditions are met (during the period of time specified by NameplatePersonalHideDelaySeconds).
--SetCVar("NameplatePersonalHideDelaySeconds", 0)
SetCVar("ShowClassColorInNameplate", 1) --Enable Class Color in Enemy nameplates
SetCVar("ShowClassColorInFriendlyNameplate", 0) --Disable Class Color in friendly nameplates
SetCVar("nameplateOccludedAlphaMult", 1)
end
--Hide UI Elements
local function HideStuff()
--Hide stuff from Default UI
for _, frame in pairs(HideBlizzardArt) do
frame:SetParent(SetAlphaParent)
end
--Hide Rested Glow Effects from PlayerFrame
hooksecurefunc("PlayerFrame_UpdateStatus", function()
if IsResting("player") then
PlayerStatusTexture:Hide()
PlayerRestGlow:Hide()
PlayerStatusGlow:Hide()
end
end)
--Hide Health and Power Text from PlayerFrame and PetFrame, while still showing it on Target/Focus etc.
for _, name in pairs({"Player","Pet"}) do
_G[name.."FrameHealthBar"].cvar = nil
_G[name.."FrameManaBar"].cvar = nil
end
--Hide Health and Power Text from ArenaFrames and PartyMemberFrames, requires non-raid-style PartyFrames
for _, text in pairs({"PartyMemberFrame", "ArenaEnemyFrame"}) do
for i = 1, 4 do
_G[text..i.."HealthBar"].cvar = nil
_G[text..i.."ManaBar"].cvar = nil
end
end
--Hide Keybinds and Macro text
local r={"MultiBarBottomLeft", "MultiBarBottomRight", "Action", "MultiBarLeft", "MultiBarRight"}
for b=1,#r do
for i=1,12 do
_G[r[b].."Button"..i.."HotKey"]:SetAlpha(0)
end
end
for b=1,#r do
for i=1,12 do
_G[r[b].."Button"..i.."Name"]:SetAlpha(0)
end
end
for i=1, 10 do
_G["PetActionButton"..i.."HotKey"]:SetAlpha(0)
end
--Hide Error messages
UIErrorsFrame:UnregisterEvent("UI_ERROR_MESSAGE")
ErrorEvent.UI_ERROR_MESSAGE = function(self, ErrorEvent, error)
if not stuff[error] then
UIErrorsFrame:AddMessage(error, 1, .1, .1)
end
end
ErrorEvent:RegisterEvent("UI_ERROR_MESSAGE")
end
--Hide Objective Tracker in Arenas and Raids
local function HideObjectiveTracker()
_, instanceType = IsInInstance()
if (instanceType == "arena") or (instanceType == "raid") then
ObjectiveTrackerBlocksFrame:Hide()
ObjectiveTrackerFrame.HeaderMenu.MinimizeButton:Hide()
else
ObjectiveTrackerBlocksFrame:Show()
ObjectiveTrackerFrame.HeaderMenu.MinimizeButton:Show()
end
end
--Skin UI Elements
local function SkinUI()
--This is only needed if Santa UI Textures are used
for i, v in pairs(SkinMissingSantaUITextures) do
v:SetVertexColor( 0.4, 0.4, 0.4)
end
--This is if Santa UI Textures are not used
--for i, v in pairs(SkinBlizzardArt) do
-- v:SetVertexColor(0.3, 0.3, 0.3)
--end
--for i, v in pairs({select(1, TimeManagerClockButton:GetRegions()), --[[select(1, GarrisonLandingPageMinimapButton:GetRegions()), select(1, GameTimeFrame:GetRegions())]]}) do
-- v:SetVertexColor(0.4, 0.4, 0.4)
--end
--for i, v in pairs({ select(2, TimeManagerClockButton:GetRegions())}) do
-- v:SetVertexColor(1, 1, 1)
--end
for i=1, 10 do
_G["MainMenuXPBarDiv"..i]:SetTexture(Empty_Art)
end
ArtifactWatchBar.Tick.Normal:SetVertexColor(0.4, 0.4, 0.4)
end
--Setup Unitframes
local function SetUnitframes()
--Color names white and outline
for _, frame in pairs({PlayerFrame, TargetFrame, FocusFrame}) do
frame.name:SetVertexColor(1,1,1)
frame.name:SetFont(STANDARD_TEXT_FONT, 11, "THINOUTLINE")
end
for _, frame in pairs({"PartyMemberFrame"}) do
for i = 1, MAX_PARTY_MEMBERS do
_G[frame..i.."Name"]:SetFont(STANDARD_TEXT_FONT, 11, "THINOUTLINE")
end
end
for _, frame in pairs({"ArenaEnemyFrame"}) do
for i = 1, 4 do
_G[frame..i.."Name"]:SetFont(STANDARD_TEXT_FONT, 11, "THINOUTLINE")
end
end
--Move PartyFrames
--Just move PartyMemberFrame1 as the following are parented to it
Move(PartyMemberFrame1, "LEFT", UIParent, "LEFT", 370, 110)
--Move LossOfControlFrame
Move(LossOfControlFrame, "CENTER", UIParent, "CENTER", 0, 0)
--Scale LossOfControlFrame
LossOfControlFrame:SetScale(0.6)
--Larger scaling for default RaidFrames
CompactUnitFrameProfilesGeneralOptionsFrameHeightSlider:SetMinMaxValues(16, 72)
--Make ComboPoints appear without delay
COMBOFRAME_FADE_IN = 0
COMBOFRAME_FADE_OUT = 0
COMBOFRAME_SHINE_FADE_IN = 0
COMBOFRAME_SHINE_FADE_OUT = 0
COMBOFRAME_HIGHLIGHT_FADE_IN = 0
--Sort the Group so Player is always on top
--I think this need "keeps groups together disabled"
CRFSort_Group = function(t1, t2)
if UnitIsUnit(t1, "player") then return true
elseif UnitIsUnit(t2, "player") then return false
else return t1 < t2
end
end
CompactRaidFrameContainer.flowSortFunc = CRFSort_Group
end
--Setup Nameplates
local function SetNameplates()
--If PersonalResourceBar is shown, make it clickthrough
if arg ~= "PersonalResourceClickThrough" then
return;
end
C_NamePlate.SetNamePlateSelfClickThrough(true);
end
--Setup BuffFrame
local function SetBuffFrame()
BuffFrame:SetParent("UIParent")
--This is top right position
BuffFrame:SetScale(1.2)
Move(BuffFrame, "TOP", UIParent, "TOP", 395, -130) --Scale=1 TOP,TOP,455,-165; Scale=1.2 TOP,TOP,395,-130
--This is center screen position
--BuffFrame:SetScale(0.95)
--Move(BuffFrame, "CENTER", UIParent, "CENTER", 95, -155)
--[[Use this to geht coordinates
BuffFrame:SetMovable(true)
BuffFrame:EnableMouse(true)
BuffFrame:SetUserPlaced(true)
BuffFrame:SetClampedToScreen(true)
BuffFrame:RegisterForDrag("LeftButton")
BuffFrame:SetScript("OnDragStart", function(self)
self:StartMoving()
end)
BuffFrame:SetScript("OnDragStop", function(self)
self:StopMovingOrSizing()
print(self:GetPoint())
end)
]]
end
--Setup Castingbars
local function SetCastingBar()
--Makes the CastingBar clichthrough
CastingBarFrame:SetFrameStrata("FULLSCREEN_DIALOG")
end
--Setup PlayerPowerBarAlt
local function SetPlayerPowerBarAlt()
--Move PlayerPowerBarAlt
Move(PlayerPowerBarAlt, "LEFT", UIParent, "LEFT", 330, -150)
--Scale PlayerPowerBarAlt
PlayerPowerBarAlt:SetScale(1)
--Make it movable
PlayerPowerBarAlt:SetMovable(true)
PlayerPowerBarAlt:EnableMouse(true)
PlayerPowerBarAlt:SetUserPlaced(true)
PlayerPowerBarAlt:SetClampedToScreen(true)
PlayerPowerBarAlt:RegisterForDrag("LeftButton")
PlayerPowerBarAlt:SetScript("OnDragStart", function(self)
self:StartMoving()
end)
PlayerPowerBarAlt:SetScript("OnDragStop", function(self)
self:StopMovingOrSizing()
print(self:GetPoint())
end)
end
--Setup Minimap
local function SetMinimap()
--Scale Garrison / Order Hall Button
GarrisonLandingPageMinimapButton:SetScale(0.7)
--Move Garrison / Order Hall Button
Move(GarrisonLandingPageMinimapButton, "BOTTOMLEFT", MinimapCluster, "BOTTOMLEFT", 50, 15)
--Change ZoneText
MinimapZoneText:SetFont(STANDARD_TEXT_FONT, 12, "THINOUTLINE")
--Move ZoneText
Move(MinimapZoneText, "TOPLEFT","MinimapZoneTextButton","TOPLEFT", 5, 5)
--Enable Mousewheel Zooming
Minimap:EnableMouseWheel(true)
Minimap:SetScript("OnMouseWheel", function(self, delta)
if delta > 0 then
Minimap_ZoomIn()
else
Minimap_ZoomOut()
end
end)
--Minimap Tracking with Right Click
MiniMapTracking.Show = kill
MiniMapTracking:UnregisterAllEvents()
Minimap:SetScript("OnMouseUp", function(self, btn)
if btn == "RightButton" then
_G.ToggleDropDownMenu(1, nil, _G.MiniMapTrackingDropDown, self)
else
_G.Minimap_OnClick(self)
end
end)
end
--Setup Zonemap
local function SetZonemap()
--Load this so we can change stuff
BattlefieldMinimap_LoadUI()
--Check if its visible and show it
if (BattlefieldMinimap:IsVisible()) then
BattlefieldMinimap:Show()
end
--Hide the background
BattlefieldMinimapBackground:SetAlpha(0)
--Create the new background
local width, height = BattlefieldMinimap:GetSize()
local NewBG = CreateFrame("Frame", "NewBG", BattlefieldMinimap, nil)
NewBG:SetFrameStrata("BACKGROUND")
NewBG:SetPoint("CENTER", BattlefieldMinimap, "CENTER", 0, 0)
NewBG:SetSize(width, height)
NewBG:SetBackdrop({
bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
edgeFile = "Interface\\Buttons\\WHITE8x8",
edgeSize = 1,
insets = {left = 0, right = 0, top = 0, bottom = 0}
})
NewBG:SetBackdropColor(0, 0, 0, 0.25)
NewBG:SetBackdropBorderColor(0, 0, 0, 1)
NewBG:Show()
end
--Setup Chat
local function SetChat()
--Set Default ChatFrame Alpha
DEFAULT_CHATFRAME_ALPHA = 0.8
--Add more font sizes
CHAT_FONT_HEIGHTS = {8, 9, 10, 11, 12, 13}
--Chat can not be dragged off screen
for i = 1, NUM_CHAT_WINDOWS do
_G["ChatFrame"..i]:SetClampedToScreen(true)
_G["ChatFrame"..i]:SetClampRectInsets(-35, 35, 35, -35)
end
--Class color Names
for name in pairs(ChatTypeGroup) do
SetChatColorNameByClass(name, true);
end
for i = 1, MAX_WOW_CHAT_CHANNELS do
local name = "CHANNEL"..i;
if ( name ) then
SetChatColorNameByClass(name, true);
end
end
--Url Copy
local find = string.find
local gsub = string.gsub
local found = false
local function ColorURL(text, url)
found = true
return ' |H'..'url'..':'..tostring(url)..'|h'..'|cff0099FF'..tostring(url)..'|h|r '
end
local function ScanURL(frame, text, ...)
found = false
if (find(text:upper(), '%pTINTERFACE%p+')) then
found = true
end
-- 192.168.2.1:1234
if (not found) then
text = gsub(text, '(%s?)(%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?:%d%d?%d?%d?%d?)(%s?)', ColorURL)
end
-- 192.168.2.1
if (not found) then
text = gsub(text, '(%s?)(%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?)(%s?)', ColorURL)
end
-- www.url.com:3333
if (not found) then
text = gsub(text, '(%s?)([%w_-]+%.?[%w_-]+%.[%w_-]+:%d%d%d?%d?%d?)(%s?)', ColorURL)
end
-- http://www.google.com
if (not found) then
text = gsub(text, "(%s?)(%a+://[%w_/%.%?%%=~&-'%-]+)(%s?)", ColorURL)
end
-- www.google.com
if (not found) then
text = gsub(text, "(%s?)(www%.[%w_/%.%?%%=~&-'%-]+)(%s?)", ColorURL)
end
-- url@domain.com
if (not found) then
text = gsub(text, '(%s?)([_%w-%.~-]+@[_%w-]+%.[_%w-%.]+)(%s?)', ColorURL)
end
frame.add(frame, text,...)
end
local function EnableURLCopy()
for _, v in pairs(CHAT_FRAMES) do
local chat = _G[v]
if (chat and not chat.hasURLCopy and (chat ~= 'ChatFrame2')) then
chat.add = chat.AddMessage
chat.AddMessage = ScanURL
chat.hasURLCopy = true
end
end
end
hooksecurefunc('FCF_OpenTemporaryWindow', EnableURLCopy)
local orig = ChatFrame_OnHyperlinkShow
function ChatFrame_OnHyperlinkShow(frame, link, text, button)
local type, value = link:match('(%a+):(.+)')
if (type == 'url') then
local editBox = _G[frame:GetName()..'EditBox']
if (editBox) then
editBox:Show()
editBox:SetText(value)
editBox:SetFocus()
editBox:HighlightText()
end
else
orig(self, link, text, button)
end
end
EnableURLCopy()
--Minimize Button
local minimizeButton = CreateFrame("Button", nil, UIParent)
minimizeButton:SetSize(30,30)
minimizeButton.t=minimizeButton:CreateTexture(nil,"BORDER")
minimizeButton.t:SetTexture("Interface\\CHATFRAME\\UI-ChatIcon-Minimize-Up.blp")
minimizeButton.t:SetAllPoints(minimizeButton)
minimizeButton:SetPoint("BOTTOM","ChatFrame1ButtonFrame","BOTTOM",0,-35)
minimizeButton:Show()
local ChatHide = false
minimizeButton:SetScript("OnMouseDown", function(self, button)
if ChatHide == false then
if button == "LeftButton" then
minimizeButton.t:SetTexture("Interface\\CHATFRAME\\UI-ChatIcon-Minimize-Down.blp")
end
elseif ChatHide == true then
if button == "LeftButton" then
minimizeButton.t:SetTexture("Interface\\CHATFRAME\\UI-ChatIcon-Maximize-Down.blp")
end
end
end)
minimizeButton:SetScript("OnMouseUp", function(self, button)
if ChatHide == false then
if button == "LeftButton" then
minimizeButton.t:SetTexture("Interface\\CHATFRAME\\UI-ChatIcon-Minimize-Up.blp")
end
elseif ChatHide == true then
if button == "LeftButton" then
minimizeButton.t:SetTexture("Interface\\CHATFRAME\\UI-ChatIcon-Maximize-Up.blp")
end
end
end)
minimizeButton:SetScript("OnClick", function(self, button)
if ChatHide == false then
minimizeButton.t:SetTexture("Interface\\CHATFRAME\\UI-ChatIcon-Maximize-Up.blp")
QuickJoinToastButton:Hide()
GeneralDockManager:Hide()
ChatFrameMenuButton:Hide()
for i=1, NUM_CHAT_WINDOWS do
_G["ChatFrame"..i..""]:SetAlpha(0)
_G["ChatFrame"..i.."ButtonFrame"]:Hide()
end
ChatHide = true
elseif ChatHide == true then
minimizeButton.t:SetTexture("Interface\\CHATFRAME\\UI-ChatIcon-Minimize-Up.blp")
QuickJoinToastButton:Show()
GeneralDockManager:Show()
ChatFrameMenuButton:Show()
for i=1, NUM_CHAT_WINDOWS do
_G["ChatFrame"..i..""]:SetAlpha(1)
_G["ChatFrame"..i.."ButtonFrame"]:Show()
end
ChatHide = false
end
end)
end
--Add useful SlashCommands
local function SlashCommands()
local function ShowBindsAndMacroText()
local r={"MultiBarBottomLeft", "MultiBarBottomRight", "Action", "MultiBarLeft", "MultiBarRight"}
for b=1,#r do
for i=1,12 do
_G[r[b].."Button"..i.."HotKey"]:SetAlpha(1)
end
end
for b=1,#r do
for i=1,12 do
_G[r[b].."Button"..i.."Name"]:SetAlpha(1)
end
end
for i=1, 10 do
_G["PetActionButton"..i.."HotKey"]:SetAlpha(1)
end
end
SlashCmdList["READYCHECK"] = function() DoReadyCheck() end
SLASH_READYCHECK1 = "/rc"
SlashCmdList["CHECKROLE"] = function() InitiateRolePoll() end
SLASH_CHECKROLE1 = "/cr"
SlashCmdList["RELOADUI"] = function() ReloadUI() end
SLASH_RELOADUI1 = "/rl"
SlashCmdList["LOGOUT"] = function() Logout() end
SLASH_LOGOUT1 = "/lg"
SlashCmdList["TOGGLEFPS"] = function() ToggleFramerate() end
SLASH_TOGGLEFPS1 = "/fps"
SlashCmdList["SHOWBINDSANDMACROTEXT"] = function() ShowBindsAndMacroText() end
SLASH_SHOWBINDSANDMACROTEXT1 = "/show"
SlashCmdList["TOGGLESOUND"] = function() Sound_ToggleSound() end
SLASH_TOGGLESOUND1 = "/sound"
end
--Color Namebackground in Class colors
local function NameBackgroundInClassColors()
if UnitIsPlayer("target") then
c = RAID_CLASS_COLORS[select(2, UnitClass("target"))]
TargetFrameNameBackground:SetVertexColor(c.r, c.g, c.b)
end
if UnitIsPlayer("focus") then
c = RAID_CLASS_COLORS[select(2, UnitClass("focus"))]
FocusFrameNameBackground:SetVertexColor(c.r, c.g, c.b)
end
for _, BarTextures in pairs({TargetFrameNameBackground, FocusFrameNameBackground}) do
BarTextures:SetTexture("Interface\\TargetingFrame\\UI-StatusBar")
end
end
--Auto Sell and Repair
local function AutoSellAndRepair()
local bag, slot
for bag = 0, 4 do
for slot = 0, GetContainerNumSlots(bag) do
local link = GetContainerItemLink(bag, slot)
if link and (select(3, GetItemInfo(link)) == 0) then
UseContainerItem(bag, slot)
end
end
end
if(CanMerchantRepair()) then
local cost = GetRepairAllCost()
if cost > 0 then
local money = GetMoney()
if IsInGuild() then
local guildMoney = GetGuildBankWithdrawMoney()
if guildMoney > GetGuildBankMoney() then
guildMoney = GetGuildBankMoney()
end
if guildMoney > cost and CanGuildBankRepair() then
RepairAllItems(1)
print(format("|cfff07100Repair cost covered by G-Bank: %.1fg|r", cost * 0.0001))
return
end
end
if money > cost then
RepairAllItems()
print(format("|cffead000Repair cost: %.1fg|r", cost * 0.0001))
else
print("Not enough gold to cover the repair cost.")
end
end
end
end
--Automatically open talent tree in pvp
local function ArenaTalent()
_, instanceType = IsInInstance()
if instanceType == "arena" or instanceType == "pvp" then
TalentFrame_LoadUI()
ShowUIPanel(PlayerTalentFrame)
end
end
--Announce Interrupts
local function AnnounceInterrupts(self, eventType, ...)
if select(2,...) ~= "SPELL_INTERRUPT" then return end
if select(5,...) ~= UnitName("player") then return end
--local arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15 = ...
--SendChatMessage('Interrupted ' .. GetSpellLink(arg15), channel)
SendChatMessage("Interrupted","SAY")
end
--[[Say Sapped, WHY YOU NO WORK?
local function SaySapped(_, _, _, event, _, _, _, _, _, _, destName, _, _, spellId) --https://wow.gamepedia.com/COMBAT_LOG_EVENT
if (event ~= "SPELL_AURA_APPLIED" or event ~= "SPELL_AURA_REFRESH") then return end
if destName ~= UnitName("player") then return end
if spellId ~= 6770 then return end
SendChatMessage("Sapped","SAY")
end
]]
--Hook Functions
--[[Scale NameplateDebuffs
local function ScaleNameplateDebuffs(...)
for _,v in pairs(C_NamePlate.GetNamePlates()) do
local bf=v.UnitFrame.BuffFrame
bf:SetScale(1)
end
end
NamePlateDriverFrame:HookScript("OnEvent",ScaleNameplateDebuffs)
]]
--Scale / Outline NameplateNames
local function ScaleNameplateNames(...)
for i, frame in ipairs(C_NamePlate.GetNamePlates()) do
local names = frame.UnitFrame.name
names:SetFont(STANDARD_TEXT_FONT, 10, "THINOUTLINE")
names:SetShadowOffset(1, -1)
end
end
NamePlateDriverFrame:HookScript("OnEvent", ScaleNameplateNames)
--[[Move NameplateDebuffs
--Defaults: Larger Nameplates BaseYOffset 20; when Resources on Target 18
-- Small Nameplates BaseYOffset 0; when Resources on Target 0
--Old values i used for baseYoffset: directly above CP 20; between CP and HealthBar -10
local function MoveNameplateDebuffs(...)
for i, frame in ipairs(C_NamePlate.GetNamePlates()) do
local debuffs = frame.UnitFrame.BuffFrame
debuffs.baseYOffset = 0
debuffs:UpdateAnchor()
end
end
NamePlateDriverFrame:HookScript("OnEvent", MoveNameplateDebuffs)
]]
--Overlap Fix for OrderHallCommandBar
hooksecurefunc("OrderHall_CheckCommandBar", function(self)
if ((OrderHallCommandBar) and (OrderHallCommandBar:IsShown())) then
OrderHallCommandBar.Background:SetAlpha(0)
--OrderHallCommandBar.AreaName:SetFont(STANDARD_TEXT_FONT, 12, "THINOUTLINE")
OrderHallCommandBar.AreaName:SetAlpha(0)
OrderHallCommandBar.WorldMapButton:SetAlpha(0)
MinimapCluster:SetPoint("TOPRIGHT", OrderHallCommandBar, "BOTTOMRIGHT", 0, 0)
MinimapCluster.SetPoint = function() end
else
MinimapCluster:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", 0, 0)
MinimapCluster.SetPoint = function() end
end
end)
--Out of Range Indicator
hooksecurefunc("ActionButton_OnEvent",function(self, event, ...)
if ( event == "PLAYER_TARGET_CHANGED" ) then
self.newTimer = self.rangeTimer
end
end)
hooksecurefunc("ActionButton_UpdateUsable",function(self)
local icon = _G[self:GetName().."Icon"]
local valid = IsActionInRange(self.action)
if ( valid == false ) then
icon:SetVertexColor(1.0, 0.1, 0.1)
end
end)
hooksecurefunc("ActionButton_OnUpdate",function(self, elapsed)
local rangeTimer = self.newTimer
if ( rangeTimer ) then
rangeTimer = rangeTimer - elapsed
if ( rangeTimer <= 0 ) then
ActionButton_UpdateUsable(self)
rangeTimer = TOOLTIP_UPDATE_TIME
end
self.newTimer = rangeTimer
end
end)
--Highlight Purgable Buffs on Target and Focus
hooksecurefunc("TargetFrame_UpdateAuras", function(s)
for i = 1, MAX_TARGET_BUFFS do
_, _, ic, _, dT = UnitBuff(s.unit, i)
if(ic and (not s.maxBuffs or i<=s.maxBuffs)) then
fS=_G[s:GetName()..'Buff'..i..'Stealable']
if(UnitIsEnemy(PlayerFrame.unit, s.unit) and dT=='Magic') then
fS:Show()
else
fS:Hide()
end
end
end
end)
--Make WorldStateAlwaysUpFrame clickthrough
hooksecurefunc("WorldStateAlwaysUpFrame_Update", function()
local numUI = GetNumWorldStateUI()
local name
for i = 1, numUI do
name = _G["AlwaysUpFrame"..i]
if ( name ) then
name:EnableMouse(false)
end
end
end)
--Hide RaidFrame Names
hooksecurefunc("CompactRaidFrameContainer_OnEvent", function(frame, event, ...)
if (event == "GROUP_ROSTER_UPDATE") or (event == "RAID_ROSTER_UPDATE") then
if (IsInRaid()) then
--numRaidMembers = GetNumRaidMembers()
numGroupMembers = GetNumGroupMembers()
if (numGroupMembers > 0) then
for i=1, numGroupMembers do
local _, _, subgroup, _, _, _, _, _, _, _, _, _ = GetRaidRosterInfo(i)
for j=1, 5 do
if (_G["CompactRaidGroup"..subgroup.."Member"..j]) then
--print(_G["CompactRaidGroup"..subgroup.."Member"..i])
--_G["CompactRaidGroup"..subgroup.."Member1Name"]:SetAlpha(0)
_G["CompactRaidGroup"..subgroup.."Member"..j.."Name"]:SetAlpha(0)
end
end
end
end
end
if (IsInGroup() and not IsInRaid()) then
numGroupMembers = GetNumGroupMembers()
for i=1, numGroupMembers do
if (_G["CompactPartyFrameMember"..i]) then
_G["CompactPartyFrameMember"..i.."Name"]:SetAlpha(0)
end
end
end
end
end)
--More Buffs on RaidFrames
hooksecurefunc("DefaultCompactUnitFrameSetup", function(frame)
local FrameName = frame:GetName().."Buff"
for i = 4, 6 do
local buff = _G[FrameName..i] or CreateFrame("Button", FrameName..i, frame, "CompactBuffTemplate")
buff:ClearAllPoints()
if i == 4 then
buff:SetPoint("BOTTOMRIGHT", _G[FrameName..i-3], "TOPRIGHT")
else
buff:SetPoint("BOTTOMRIGHT", _G[FrameName..i-1], "BOTTOMLEFT")
end
local options = DefaultCompactUnitFrameSetupOptions
local componentScale = min(options.height / 36, options.width / 72)
local size = 11 * componentScale
buff:SetSize(size, size)
end
CompactUnitFrame_SetMaxBuffs(frame, 6)
end)
--Hide Talking Head
local HideTalkingHead = CreateFrame("Frame")
function HideTalkingHead:OnEvent(event, addon)
if addon == "Blizzard_TalkingHeadUI" then
hooksecurefunc("TalkingHeadFrame_PlayCurrent", function()
TalkingHeadFrame:Hide()
end)
self:UnregisterEvent(event)
end
end
HideTalkingHead:RegisterEvent("ADDON_LOADED")
HideTalkingHead:SetScript("OnEvent", HideTalkingHead.OnEvent)
--Handle events
local function EventHandler(self, event, ...)
if (event == "PLAYER_TARGET_CHANGED") or (event == "PLAYER_FOCUS_CHANGED") or (event == "UNIT_FACTION") then
NameBackgroundInClassColors()
elseif (event == "MERCHANT_SHOW") then
AutoSellAndRepair()
elseif (event == "PLAYER_ENTERING_WORLD") then
ArenaTalent()
SetBuffFrame()
HideObjectiveTracker()
elseif (event == "COMBAT_LOG_EVENT_UNFILTERED") then
AnnounceInterrupts(self, eventType, ...)
--SaySapped(_,_,_,event, _,_,sourceName, _,_,_,destName, _,_,spellId)
elseif (event == "ADDON_LOADED") then
SkinUI()
EventWatcher:UnregisterEvent("ADDON_LOADED")
end
end
--Load addon
local function LoadAddon(self, event, ...)
EventWatcher:UnregisterEvent("PLAYER_REGEN_ENABLED")
LoadAddOn("Blizzard_ArenaUI")
LoadAddOn("Blizzard_CompactRaidFrames")
HideStuff()
SetUnitframes()
SetNameplates()
SetBuffFrame()
SetCastingBar()
SetPlayerPowerBarAlt()
SetMinimap()
SetZonemap()
SetChat()
SlashCommands()
SkinUI()
EventWatcher:SetScript("OnEvent", EventHandler)
EventWatcher:RegisterEvent("GROUP_ROSTER_UPDATE")
EventWatcher:RegisterEvent("PLAYER_TARGET_CHANGED")
EventWatcher:RegisterEvent("PLAYER_FOCUS_CHANGED")
EventWatcher:RegisterEvent("UNIT_FACTION")
EventWatcher:RegisterEvent("MERCHANT_SHOW")
EventWatcher:RegisterEvent("PLAYER_ENTERING_WORLD")
EventWatcher:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
EventWatcher:RegisterEvent("ADDON_LOADED")
collectgarbage()
end
--Initialize
local function LoginEvent(self, event, ...)
EventWatcher:UnregisterEvent("PLAYER_LOGIN")
SetCVars()
SetNameplateCVars() --Needs to be loaded before first nameplate is loaded
if UnitAffectingCombat("player") then
EventWatcher:SetScript("OnEvent", LoadAddon)
EventWatcher:RegisterEvent("PLAYER_REGEN_DISBALED")
else
LoadAddon()
end
end
EventWatcher:SetScript("OnEvent", LoginEvent)
EventWatcher:RegisterEvent("PLAYER_LOGIN")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment