-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKLAddon.lua
More file actions
358 lines (266 loc) · 10.5 KB
/
Copy pathKLAddon.lua
File metadata and controls
358 lines (266 loc) · 10.5 KB
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
addonName, KLAddon = ... -- Global
local KLAddon = KLAddon -- Local
local db
local EventHandlerFrame = CreateFrame("Frame")
-- Debugging
KLAddon.debugging = false
EventHandlerFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
EventHandlerFrame:RegisterEvent("ADDON_LOADED")
EventHandlerFrame:RegisterEvent("ZONE_CHANGED_NEW_AREA")
EventHandlerFrame:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED")
function SetTooltipMoney(frame,money,type,prefixText,suffixText)
frame:AddLine((prefixText or "") .. " " .. GetCoinTextureString(money) .. " " .. (suffixText or ""),0,1,1)
end
function KLAddon:print(msg)
return print("\124cff1FADFF"..addonName..":\124cffffffff", msg)
end
function KLAddon:debug(msg)
if not KLAddon.debugging then return end
return print("\124cffE0743E"..addonName.." Debug:\124cffffffff", msg)
end
function KLAddon:IsInInstance() -- Exclude neighborhoods and houses
local i, t = IsInInstance()
if t and t ~= "none" and t ~= "neighborhood" and t ~= "interior" and t ~= "scenario" then
KLAddon:debug("apply raid graphics")
return i, t
end
return false
end
function KLAddon:InitSpecBar()
if not PlayerSpellsFrame then C_AddOns.LoadAddOn("Blizzard_PlayerSpells") end
local f = CreateFrame("FRAME", "SpecBarFrame", UIParent)
local prevButton
f:SetSize(44*GetNumSpecializations(), 40)
f:SetParent(PlayerSpellsFrame.TalentsFrame)
f:SetFrameStrata("HIGH")
f:ClearAllPoints()
f:SetPoint("CENTER", PlayerSpellsFrame.TalentsFrame.BottomBar, "CENTER", -215, 0)
for i=1,GetNumSpecializations() do
local b = CreateFrame("BUTTON", "SpecBarFrameButton"..i, f, "ActionButtonTemplate")
b:SetSize(40, 40)
if i>1 then
b:SetPoint("LEFT", prevButton, "RIGHT", 4, 0)
else
b:SetPoint("LEFT", 0, 0)
end
local id,name,_,specIcon,_,_ = C_SpecializationInfo.GetSpecializationInfo(i)
prevButton = b
b.texture = b:CreateTexture(nil, "ARTWORK")
b.texture:SetTexture(specIcon)
b.texture:SetPoint("TOPLEFT", 2, -2)
b.texture:SetPoint("BOTTOMRIGHT", 2, -2)
b:RegisterForClicks("AnyDown")
b:SetHighlightLocked(i == GetSpecialization())
b:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_TOP")
GameTooltip:SetText(name)
GameTooltip:AddLine("Left click to change spec")
GameTooltip:AddLine("Right click to change loot spec")
GameTooltip:Show()
end)
b:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
b:SetScript("OnClick", function(self, button, down)
if button == "LeftButton" and not UnitCastingInfo("player") and GetSpecialization()~=i then
C_SpecializationInfo.SetSpecialization(i)
KLAddon:print("Changing spec to " .. name)
elseif button == "RightButton" then
local _,currSpec = GetSpecializationInfo(GetSpecialization())
if GetLootSpecialization() == id then
SetLootSpecialization(0)
print("\124cffffff00Loot Specialization set to: Current Specialization ( "..currSpec.." )")
else
SetLootSpecialization(id)
end
end
end)
end
end
--[[ function KLAddon:UpdateCVars()
for c,v in pairs(db.GraphicsCVars) do
db.GraphicsCVars[c]=C_CVar.GetCVar(c)
db.RaidGraphicsCVars[c]=C_CVar.GetCVar("raid"..c)
end
self:print("Graphics Settings Updated")
end
function KLAddon:ToggleGraphicsSettings(onlyRT) -- No longer necessary
onlyRT = onlyRT or false
if onlyRT then
SetCVar("shadowRt", 0)
return
end
if(db.RaidGraphics) then
for c,v in pairs(db.GraphicsCVars) do
SetCVar(c, v)
end
UIErrorsFrame:AddMessage("Regular graphics settings enabled", 1, 1, 0)
else
for c,v in pairs(db.RaidGraphicsCVars) do
SetCVar(c, v)
end
UIErrorsFrame:AddMessage("Raid graphics settings enabled", 1, 1, 0)
end
db.RaidGraphics = not db.RaidGraphics
KLAddon:debug("TGS: "..tostring(db.RaidGraphics))
end ]]
function KLAddon:ToggleLayout()
local CurrentLayout = C_EditMode.GetLayouts().activeLayout -- Toggle between first and second custom layout (DynamicCam or Regular)
local specRole = GetSpecializationRole(GetSpecialization())
if CurrentLayout == 3 then
C_EditMode.SetActiveLayout(4)
if specRole == "HEALER" then
EnhanceQoL.Aura.UF.Profiles.SetActiveName("DynamicCam-Heal")
else
EnhanceQoL.Aura.UF.Profiles.SetActiveName("DynamicCam")
end
RaidNotice_AddMessage(RaidWarningFrame, "Active layout: " .. C_EditMode.GetLayouts().layouts[2].layoutName, ChatTypeInfo["SYSTEM"])
else
C_EditMode.SetActiveLayout(3)
if specRole == "HEALER" then
EnhanceQoL.Aura.UF.Profiles.SetActiveName("Healing")
else
EnhanceQoL.Aura.UF.Profiles.SetActiveName("0.74 Scale")
end
RaidNotice_AddMessage(RaidWarningFrame, "Active layout: " .. C_EditMode.GetLayouts().layouts[1].layoutName, ChatTypeInfo["SYSTEM"])
end
end
function KLAddon:DoTweaks()
if not MacroFrame then C_AddOns.LoadAddOn("Blizzard_MacroUI") end
MacroFrame:SetHeight(626)
MacroFrame.MacroSelector:SetHeight(346)
MacroFrameSelectedMacroBackground:ClearAllPoints()
MacroFrameSelectedMacroBackground:SetPoint("TOPLEFT", 5, -418)
MacroFrameTextBackground:ClearAllPoints()
MacroFrameTextBackground:SetPoint("TOPLEFT", "MacroFrame", 6, -489)
MacroHorizontalBarLeft:ClearAllPoints()
MacroHorizontalBarLeft:SetPoint("TOPLEFT", 2, -410)
-- Small tweaks
AddonList:SetHeight(800)
AddonList.ScrollBox:SetHeight(700)
ObjectiveTrackerFrame.Header.Background:SetAlpha(0.50)
ObjectiveTrackerFrame.Header.Text:SetJustifyH("CENTER")
ObjectiveTrackerFrame.Header.Text:SetText(" Tracker ")
ObjectiveTrackerFrame.Header.Text:SetFontHeight(20)
--ObjectiveTrackerFrame.Header.Text:SetFont("Interface\\AddOns\\SharedMedia_MyMedia\\font\\PTSansNarrow-Bold.ttf", 18)
FriendsFrame:SetHeight(800)
--tinsert(PAPERDOLL_STATCATEGORIES[1].stats, { stat = "MOVESPEED" }) -- Add movement speed to character frame
hooksecurefunc("ExtraActionBar_Update", function()
ExtraActionButton1.style:Hide()
end)
ExtraActionButton1:SetScale(0.8)
ZoneAbilityFrame:SetScale(0.8)
ZoneAbilityFrame.Style:Hide()
do
local function ChatFilter(self, event, msg, ...)
if msg:find("You have rewards waiting for you in the Endeavor Coffer.") then return true end
return false
end
ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", ChatFilter)
end
-- CVars --
SetCVar("minimapTrackingShowAll", 1) -- Show all Townsfolk Minimap filters
SetCVar("AutoPushSpellToActionBar", 0)
SetCVar("breakUpLargeNumbers", 0) -- https://www.youtube.com/watch?v=ta7lyqqPRXY Classic-like worldtext (damage numbers)
SetCVar("floatingCombatTextCombatDamageDirectionalScale", 0)
SetCVar("WorldTextCritScreenY", -0.05)
SetCVar("WorldTextScreenY", 0.015)
SetCVar("WorldTextScale", 1.7)
SetCVar("WorldTextRandomZMax", 2)
SetCVar("WorldTextRandomZMin", 2)
end
do
EventHandlerFrame:SetScript("OnEvent", function(self, event, arg1, ...)
if event == "PLAYER_ENTERING_WORLD" then
self:UnregisterEvent(event) -- Only need this once
KLAddon:DoTweaks()
KLAddon:InitSpecBar()
KLAddon:debug(event)
elseif event == "ADDON_LOADED" and arg1 == addonName then
self:UnregisterEvent(event) -- Only need this once
KLAddon:debug(event)
db = KLAddonDB or { -- Keeping this in case I need it again
["RaidGraphics"] = false,
["Modules"] = {},
["GraphicsCVars"] = {
["graphicsShadowQuality"] = "",
["graphicsLiquidDetail"] = "",
["graphicsParticleDensity"] = "",
["graphicsSSAO"] = "",
["graphicsDepthEffects"] = "",
["graphicsComputeEffects"] = "",
["graphicsOutlineMode"] = "",
["graphicsTextureResolution"] = "",
["graphicsSpellDensity"] = "",
["graphicsProjectedTextures"] = "",
["graphicsViewDistance"] = "",
["graphicsEnvironmentDetail"] = "",
["graphicsGroundClutter"] = "",
["shadowRt"] = ""
},
["RaidGraphicsCVars"] = {
["graphicsShadowQuality"] = "",
["graphicsLiquidDetail"] = "",
["graphicsParticleDensity"] = "",
["graphicsSSAO"] = "",
["graphicsDepthEffects"] = "",
["graphicsComputeEffects"] = "",
["graphicsOutlineMode"] = "",
["graphicsTextureResolution"] = "",
["graphicsSpellDensity"] = "",
["graphicsProjectedTextures"] = "",
["graphicsViewDistance"] = "",
["graphicsEnvironmentDetail"] = "",
["graphicsGroundClutter"] = "",
["shadowRt"] = ""
}
}
--Load Modules?
KLAddon:print("Addon Loaded")
elseif event == "PLAYER_SPECIALIZATION_CHANGED" then
for i=1,GetNumSpecializations() do
if i==GetSpecialization() then
_G["SpecBarFrameButton"..i]:SetHighlightLocked(true)
else
_G["SpecBarFrameButton"..i]:SetHighlightLocked(false)
end
end
elseif event == "ZONE_CHANGED_NEW_AREA" then
if KLAddon:IsInInstance() and GetCurrentGraphicsSetting() == 0 then
SetCurrentGraphicsSetting(1)
UIErrorsFrame:AddMessage("Using Raid/Battleground Graphics Settings", 1, 0, 0)
elseif not KLAddon:IsInInstance() and GetCurrentGraphicsSetting() == 1 then
SetCurrentGraphicsSetting(0)
UIErrorsFrame:AddMessage("Using Normal Graphics Settings", 1, 0, 0)
end
end
end)
end
--------- BINDINGS / SLASH CMDS -----------
-- BINDING_NAME_KLTOGGLEGRAPHICSSETTINGS = "Toggle Graphics Settings (KLAddon)" -- No longer needed
BINDING_NAME_KLTOGGLEEDITMODELAYOUT = "Toggle Edit Mode Layout (KLAddon)"
BINDING_NAME_KLTOGGLECAMERAFOV = "Toggle Camera FOV (KLAddon)" -- Todo: Add settings?
BINDING_NAME_KLTOGGLEFRIENDLYPLATES = "Toggle Friendly and NPC Nameplates"
SLASH_KLADEPR1 = "/tgs"
SLASH_KLA1 = "/KLA"
SLASH_KLA2 = "/KLAddon"
SLASH_KLPULL1 = "/pull"
SlashCmdList["KLPULL"] = function(msg)
local param = strsplit(" ", msg)
local timer = tonumber(param)
if not timer then -- NaN
return KLAddon:print("Usage: /pull [number]")
end
C_PartyInfo.DoCountdown(timer)
end
SlashCmdList["KLADEPR"] = function()
KLAddon:print("Deprecated command. Use /kla [update / tgs]")
end
SlashCmdList["KLA"] = function(msg)
local param = strsplit(" ", msg)
--[[ if param == "update" then KLAddon:UpdateCVars()
elseif param == "tgs" then KLAddon:ToggleGraphicsSettings()
else
-- Open settings
end]]
end