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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
--[[ This is a heavy WiP, expect goofy shit. Action bars are being rewritten to not need nMainBar asap. ]]

--[[ stuff ]]

  print("Phael's UI Scripts Loaded.")
  UIErrorsFrame:Hide()
  PlayerHitIndicator:SetText(nil) 
  PlayerHitIndicator.SetText = function() end
  PetHitIndicator:SetText(nil)
  PetHitIndicator.SetText = function() end

--[[ hiding pvp icon ]]

  PlayerPVPIcon:SetAlpha(0)
  TargetFrameTextureFramePVPIcon:SetAlpha(0)
  FocusFrameTextureFramePVPIcon:SetAlpha(0)

--[[ hide chat in arena ]]

local ef = CreateFrame("frame")
ef:SetScript("OnEvent", function()
        local _, type = IsInInstance()
        if type == "arena" then
                ChatFrame1:Hide()
        else
                ChatFrame1:Show()
        end
end)
ef:RegisterEvent("PLAYER_ENTERING_WORLD")

--[[ class icons ]]

hooksecurefunc("UnitFramePortrait_Update",function(self)
        if self.portrait then
                if UnitIsPlayer(self.unit) then                         
                        local t = CLASS_ICON_TCOORDS[select(2, UnitClass(self.unit))]
                        if t then
                                self.portrait:SetTexture("Interface\\TargetingFrame\\UI-Classes-Circles")
                                self.portrait:SetTexCoord(unpack(t))
                        end
                else
                        self.portrait:SetTexCoord(0,1,0,1)
                end
        end
end)

--[[ class colors ]]

local function colour(statusbar, unit)
        local _, class, c
        if UnitIsPlayer(unit) and UnitIsConnected(unit) and unit == statusbar.unit and UnitClass(unit) then
                _, class = UnitClass(unit)
                c = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
                statusbar:SetStatusBarColor(c.r, c.g, c.b)
                --PlayerFrameHealthBar:SetStatusBarColor(0,1,0)
        end
end

hooksecurefunc("UnitFrameHealthBar_Update", colour)
hooksecurefunc("HealthBar_OnValueChanged", function(self)
        colour(self, self.unit)
end)

--[[ unit frames ]]

  PlayerFrame:ClearAllPoints()
  PlayerFrame:SetPoint("CENTER",UIParent,"CENTER", -130, -310)
  PlayerFrameGroupIndicator:Hide()
  PetName:SetPoint("LEFT",PetFrame,"Top", -20, 0)
  PlayerFrame.SetPoint = function() end
  TargetFrame:ClearAllPoints()
  TargetFrame:SetPoint("LEFT",PlayerFrame,"RIGHT", 27, 0)
  TargetFrame.SetPoint = function() end
  --TargetFrameToT:ClearAllPoints()
  --TargetFrameToT:SetPoint("LEFT",TargetFrame,"Top", -11, -1)
  --TargetFrameToT.SetPoint = function() end
  --TargetFrameToTTextureFrameName:ClearAllPoints()
  --TargetFrameToTTextureFrameName:SetPoint("LEFT",TargetFrameToT,"Top", -5, -8)
  --TargetFrameToTTextureFrameName.SetPoint = function() end

 PartyMemberFrame1:ClearAllPoints()
 PartyMemberFrame1:SetPoint("BOTTOM", PlayerFrame, "TOP", -115, 0)
 PartyMemberFrame1.SetPoint = function() end
 PartyMemberFrame1:SetScale(1.25)
 PartyMemberFrame2:ClearAllPoints()
 PartyMemberFrame2:SetPoint("BOTTOM", PartyMemberFrame1, "TOP", 0, 10)
 PartyMemberFrame2.SetPoint = function() end
 PartyMemberFrame2:SetScale(1.25)
 PartyMemberFrame3:ClearAllPoints()
 PartyMemberFrame3:SetPoint("BOTTOM", PartyMemberFrame2, "TOP", 0, 10)
 PartyMemberFrame3.SetPoint = function() end
 PartyMemberFrame3:SetScale(1.25)
 PartyMemberFrame4:ClearAllPoints()
 PartyMemberFrame4:SetPoint("BOTTOM", PartyMemberFrame3, "TOP", 0, 10)
 PartyMemberFrame4.SetPoint = function() end
 PartyMemberFrame4:SetScale(1.25)

--[[ abbreviate unit frame hp/mana numbers ]]

hooksecurefunc("TextStatusBar_UpdateTextStringWithValues", function()
        PlayerFrameHealthBar.TextString:SetText(AbbreviateLargeNumbers(UnitHealth("player")))
        PlayerFrameManaBar.TextString:SetText(AbbreviateLargeNumbers(UnitMana("player")))

        TargetFrameHealthBar.TextString:SetText(AbbreviateLargeNumbers(UnitHealth("target")))
        TargetFrameManaBar.TextString:SetText(AbbreviateLargeNumbers(UnitMana("target")))

        FocusFrameHealthBar.TextString:SetText(AbbreviateLargeNumbers(UnitHealth("focus")))
        FocusFrameManaBar.TextString:SetText(AbbreviateLargeNumbers(UnitMana("focus")))
end)

--[[ player castbar ]]

CastingBarFrame:ClearAllPoints()
--CastingBarFrameBorder:SetTexture("Interface\\CastingBar\\UI-CastingBar-Border-Small")
CastingBarFrame:SetPoint("CENTER",UIParent,"CENTER", 0, -205)
-- CastingBarFrameBorder:SetPoint("TOP", 0, -2)
CastingBarFrame.SetPoint = function() end
CastingBarFrame:SetScale(1.25)

--[[ target castbar ]]

TargetFrameSpellBar:SetScale(1.25)
TargetFrameSpellBar:ClearAllPoints()
TargetFrameSpellBar:SetPoint("CENTER",UIParent,"CENTER", 0, -120)
TargetFrameSpellBar.SetPoint = function() end

--[[ focus castbar ]]

FocusFrameSpellBar:SetScale(2.25)
FocusFrameSpellBar:ClearAllPoints()
FocusFrameSpellBar:SetPoint("CENTER",UIParent,"CENTER", 0, 150)
FocusFrameSpellBar.SetPoint = function() end

--[[ Hide Hotkeys/Macro Text ]]

for i=1, 12 do
        _G["ActionButton"..i.."HotKey"]:SetAlpha(0) -- main bar
        _G["MultiBarBottomRightButton"..i.."HotKey"]:SetAlpha(0) -- bottom right bar
        _G["MultiBarBottomLeftButton"..i.."HotKey"]:SetAlpha(0) -- bottom left bar
        _G["MultiBarRightButton"..i.."HotKey"]:SetAlpha(0) -- right bar
        _G["MultiBarLeftButton"..i.."HotKey"]:SetAlpha(0) -- left bar
end

for i=1, 12 do
        _G["ActionButton"..i.."Name"]:SetAlpha(0) -- main bar
        _G["MultiBarBottomRightButton"..i.."Name"]:SetAlpha(0) -- bottom right bar
        _G["MultiBarBottomLeftButton"..i.."Name"]:SetAlpha(0) -- bottom left bar
        _G["MultiBarRightButton"..i.."Name"]:SetAlpha(0) -- right bar
        _G["MultiBarLeftButton"..i.."Name"]:SetAlpha(0) -- left bar
end

--[[ Autosell Trash ]]

local g = CreateFrame("Frame")
g:RegisterEvent("MERCHANT_SHOW")

g:SetScript("OnEvent", function()  
        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)

--[[ Arena Trinket Tracker ]]

LoadAddOn("Blizzard_ArenaUI")

trinkets = {}
local arenaFrame, trinket
for i = 1, 5 do
        arenaFrame = "ArenaEnemyFrame"..i
        trinket = CreateFrame("Cooldown", arenaFrame.."Trinket", ArenaEnemyFrames)
        trinket:SetPoint("TOPRIGHT", arenaFrame, 30, -6)
        trinket:SetSize(24, 24)
        trinket.icon = trinket:CreateTexture(nil, "BACKGROUND")
        trinket.icon:SetAllPoints()
        trinket.icon:SetTexture("Interface\\Icons\\inv_jewelry_trinketpvp_01")
        trinket:Hide()
        trinkets["arena"..i] = trinket
end

local events = CreateFrame("Frame")
function events:UNIT_SPELLCAST_SUCCEEDED(unitID, spell, rank, lineID, spellID)
        if not trinkets[unitID] then
                return
        end
        if spellID == 59752 or spellID == 42292 then
                CooldownFrame_SetTimer(trinkets[unitID], GetTime(), 120, 1)
                SendChatMessage("Trinket used by: "..GetUnitName(unitID, true), "PARTY")
        end
end

function events:PLAYER_ENTERING_WORLD()
        local _, instanceType = IsInInstance()
        if instanceType == "arena" then
                self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
        elseif self:IsEventRegistered("UNIT_SPELLCAST_SUCCEEDED") then
                self:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED")
                for _, trinket in pairs(trinkets) do
                        trinket:SetCooldown(0, 0)
                        trinket:Hide()
                end
        end
end
events:SetScript("OnEvent", function(self, event, ...) return self[event](self, ...) end)
events:RegisterEvent("PLAYER_ENTERING_WORLD")

--[[ darken UI ]]

local frame=CreateFrame("Frame")
frame:RegisterEvent("ADDON_LOADED")

frame:SetScript("OnEvent", function(self, event, addon)
        if (addon == "Blizzard_TimeManager") then
                for i, v in pairs({PlayerFrameTexture, TargetFrameTextureFrameTexture, PetFrameTexture, PartyMemberFrame1Texture, PartyMemberFrame2Texture, PartyMemberFrame3Texture, PartyMemberFrame4Texture,
                        PartyMemberFrame1PetFrameTexture, PartyMemberFrame2PetFrameTexture, PartyMemberFrame3PetFrameTexture, PartyMemberFrame4PetFrameTexture, FocusFrameTextureFrameTexture,
                        TargetFrameToTTextureFrameTexture, FocusFrameToTTextureFrameTexture, BonusActionBarFrameTexture0, BonusActionBarFrameTexture1, BonusActionBarFrameTexture2, BonusActionBarFrameTexture3,
                        BonusActionBarFrameTexture4, MainMenuBarTexture0, MainMenuBarTexture1, MainMenuBarTexture2, MainMenuBarTexture3, MainMenuMaxLevelBar0, MainMenuMaxLevelBar1, MainMenuMaxLevelBar2,
                        MainMenuMaxLevelBar3, MinimapBorder, CastingBarFrameBorder, FocusFrameSpellBarBorder, TargetFrameSpellBarBorder, MiniMapTrackingButtonBorder, MiniMapLFGFrameBorder, MiniMapBattlefieldBorder,
                        MiniMapMailBorder, MinimapBorderTop,
                        select(1, TimeManagerClockButton:GetRegions())
                }) do
                        v:SetVertexColor(.4, .4, .4)
                end

                for i,v in pairs({ select(2, TimeManagerClockButton:GetRegions()) }) do
                        v:SetVertexColor(1, 1, 1)
                end

                self:UnregisterEvent("ADDON_LOADED")
                frame:SetScript("OnEvent", nil)
        end
end)

for i, v in pairs({ MainMenuBarLeftEndCap, MainMenuBarRightEndCap }) do
        v:SetVertexColor(.35, .35, .35)
end

--[[ POWER AURAS ]]

local frame = CreateFrame("FRAME")
frame:RegisterEvent("UNIT_AURA")

frame:SetScript("OnEvent", function(self, event, ...)
        local unitid = ... if unitid ~= "player" then return end

        if UnitBuff("player", "Blessing of the Celestials") then
                SpellActivationOverlay_ShowOverlay(SpellActivationOverlayFrame, 128985, "TEXTURES\\SPELLACTIVATIONOVERLAYS\\berserk.blp", "BOTTOM", 1.2, 139, 65, 239, true, false)
        else
                SpellActivationOverlay_HideOverlays(SpellActivationOverlayFrame, 128985)
        end
end)