/
launch.lua
340 lines (300 loc) · 12.1 KB
/
launch.lua
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
------------------------------------------------------------------------
-- Launch Tukui Script
------------------------------------------------------------------------
local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
-- this install Tukui with default settings.
local function install()
SetCVar("buffDurations", 1)
SetCVar("consolidateBuffs", 0)
SetCVar("lootUnderMouse", 1)
SetCVar("autoSelfCast", 1)
SetCVar("mapQuestDifficulty", 1)
SetCVar("scriptErrors", 1)
SetCVar("nameplateShowFriends", 0)
SetCVar("nameplateShowFriendlyPets", 0)
SetCVar("nameplateShowFriendlyGuardians", 0)
SetCVar("nameplateShowFriendlyTotems", 0)
SetCVar("nameplateShowEnemies", 1)
SetCVar("nameplateShowEnemyPets", 1)
SetCVar("ShowClassColorInNameplate", 1)
SetCVar("screenshotQuality", 10)
SetCVar("cameraDistanceMax", 50)
SetCVar("cameraDistanceMaxFactor", 3.4)
SetCVar("chatMouseScroll", 1)
SetCVar("chatStyle", "im")
SetCVar("WholeChatWindowClickable", 0)
SetCVar("ConversationMode", "inline")
SetCVar("CombatDamage", 1)
SetCVar("CombatHealing", 1)
SetCVar("showTutorials", 0)
SetCVar("showNewbieTips", 0)
SetCVar("Maxfps", 120)
SetCVar("autoDismountFlying", 1)
SetCVar("autoQuestWatch", 1)
SetCVar("autoQuestProgress", 1)
SetCVar("showLootSpam", 1)
SetCVar("guildMemberNotify", 1)
SetCVar("UberTooltips", 1)
SetCVar("removeChatDelay", 1)
SetCVar("showVKeyCastbar", 1)
SetCVar("colorblindMode", 0)
SetCVar("autoLootDefault", 1)
SetCVar("bloatthreat", 0)
SetCVar("bloattest", 0)
SetCVar("bloatnameplates", 0)
SetCVar("threatWarning", 3)
if IsAddOnLoaded("a") then
SetCVar("ffxDeath", "0")
SetCVar("ffxNetherWorld", "0")
SetCVar("ffxGlow", "0")
end
-- Var ok, now setting chat frames if using Tukui chats.
if (C.chat.enable == true) and (not IsAddOnLoaded("Prat") or not IsAddOnLoaded("Chatter")) then
FCF_ResetChatWindows()
FCF_SetLocked(ChatFrame1, 1)
FCF_DockFrame(ChatFrame2)
FCF_SetLocked(ChatFrame2, 1)
FCF_OpenNewWindow(L.chat_general)
FCF_SetLocked(ChatFrame3, 1)
FCF_DockFrame(ChatFrame3)
FCF_OpenNewWindow(LOOT.."/"..L.chat_trade)
FCF_UnDockFrame(ChatFrame4)
FCF_SetLocked(ChatFrame4, 1)
ChatFrame4:Show()
for i = 1, NUM_CHAT_WINDOWS do
local frame = _G[format("ChatFrame%s", i)]
local chatFrameId = frame:GetID()
local chatName = FCF_GetChatWindowInfo(chatFrameId)
-- set the size of chat frames
if not T.lowversion then
frame:Size(366, 117)
SetChatWindowSavedDimensions(chatFrameId, 366, T.Scale(117))
-- move general bottom left or Loot (if found) on right
if i == 1 then
frame:ClearAllPoints()
frame:Point("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 9, 9)
elseif i == 4 and chatName == LOOT.."/"..L.chat_trade then
frame:ClearAllPoints()
frame:Point("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -9, 9)
end
else
frame:Size(350, 93)
SetChatWindowSavedDimensions(chatFrameId, 350, T.Scale(93))
-- move general bottom left or Loot (if found) on right
if i == 1 then
frame:ClearAllPoints()
frame:Point("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 9, 26)
elseif i == 4 and chatName == LOOT.."/"..L.chat_trade then
frame:ClearAllPoints()
frame:Point("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -9, 26)
end
end
-- save new default position and dimension
FCF_SavePositionAndDimensions(frame)
-- set default tukui font size
FCF_SetChatWindowFontSize(nil, frame, 13)
-- rename windows general and combat log
if i == 1 then FCF_SetWindowName(frame, "G, S & W") end
if i == 2 then FCF_SetWindowName(frame, "Log") end
end
ChatFrame_RemoveAllMessageGroups(ChatFrame1)
ChatFrame_RemoveChannel(ChatFrame1, L.chat_trade) -- erf, it seem we need to localize this now
ChatFrame_RemoveChannel(ChatFrame1, L.chat_defense) -- erf, it seem we need to localize this now
ChatFrame_RemoveChannel(ChatFrame1, L.chat_recrutment) -- erf, it seem we need to localize this now
ChatFrame_RemoveChannel(ChatFrame1, L.chat_lfg) -- erf, it seem we need to localize this now
ChatFrame_AddMessageGroup(ChatFrame1, "SAY")
ChatFrame_AddMessageGroup(ChatFrame1, "EMOTE")
ChatFrame_AddMessageGroup(ChatFrame1, "YELL")
ChatFrame_AddMessageGroup(ChatFrame1, "GUILD")
ChatFrame_AddMessageGroup(ChatFrame1, "OFFICER")
ChatFrame_AddMessageGroup(ChatFrame1, "GUILD_ACHIEVEMENT")
ChatFrame_AddMessageGroup(ChatFrame1, "WHISPER")
ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_SAY")
ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_EMOTE")
ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_YELL")
ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_WHISPER")
ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_BOSS_EMOTE")
ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_BOSS_WHISPER")
ChatFrame_AddMessageGroup(ChatFrame1, "PARTY")
ChatFrame_AddMessageGroup(ChatFrame1, "PARTY_LEADER")
ChatFrame_AddMessageGroup(ChatFrame1, "RAID")
ChatFrame_AddMessageGroup(ChatFrame1, "RAID_LEADER")
ChatFrame_AddMessageGroup(ChatFrame1, "RAID_WARNING")
ChatFrame_AddMessageGroup(ChatFrame1, "BATTLEGROUND")
ChatFrame_AddMessageGroup(ChatFrame1, "BATTLEGROUND_LEADER")
ChatFrame_AddMessageGroup(ChatFrame1, "BG_HORDE")
ChatFrame_AddMessageGroup(ChatFrame1, "BG_ALLIANCE")
ChatFrame_AddMessageGroup(ChatFrame1, "BG_NEUTRAL")
ChatFrame_AddMessageGroup(ChatFrame1, "SYSTEM")
ChatFrame_AddMessageGroup(ChatFrame1, "ERRORS")
ChatFrame_AddMessageGroup(ChatFrame1, "AFK")
ChatFrame_AddMessageGroup(ChatFrame1, "DND")
ChatFrame_AddMessageGroup(ChatFrame1, "IGNORED")
ChatFrame_AddMessageGroup(ChatFrame1, "ACHIEVEMENT")
ChatFrame_AddMessageGroup(ChatFrame1, "BN_WHISPER")
ChatFrame_AddMessageGroup(ChatFrame1, "BN_CONVERSATION")
-- Setup the spam chat frame
ChatFrame_RemoveAllMessageGroups(ChatFrame3)
ChatFrame_AddChannel(ChatFrame3, L.chat_trade) -- erf, it seem we need to localize this now
ChatFrame_AddChannel(ChatFrame3, L.chat_general) -- erf, it seem we need to localize this now
ChatFrame_AddChannel(ChatFrame3, L.chat_defense) -- erf, it seem we need to localize this now
ChatFrame_AddChannel(ChatFrame3, L.chat_recrutment) -- erf, it seem we need to localize this now
ChatFrame_AddChannel(ChatFrame3, L.chat_lfg) -- erf, it seem we need to localize this now
-- Setup the right chat
ChatFrame_RemoveAllMessageGroups(_G["ChatFrame"..C.chat.rightchatnumber])
ChatFrame_AddChannel(_G["ChatFrame"..C.chat.rightchatnumber], L.chat_trade) -- erf, it seem we need to localize this now
ChatFrame_AddMessageGroup(_G["ChatFrame"..C.chat.rightchatnumber], "COMBAT_XP_GAIN")
ChatFrame_AddMessageGroup(_G["ChatFrame"..C.chat.rightchatnumber], "COMBAT_HONOR_GAIN")
ChatFrame_AddMessageGroup(_G["ChatFrame"..C.chat.rightchatnumber], "COMBAT_FACTION_CHANGE")
ChatFrame_AddMessageGroup(_G["ChatFrame"..C.chat.rightchatnumber], "LOOT")
ChatFrame_AddMessageGroup(_G["ChatFrame"..C.chat.rightchatnumber], "MONEY")
ChatFrame_AddMessageGroup(_G["ChatFrame"..C.chat.rightchatnumber], "SKILL")
-- enable classcolor automatically on login and on each character without doing /configure each time.
ToggleChatColorNamesByClassGroup(true, "SAY")
ToggleChatColorNamesByClassGroup(true, "EMOTE")
ToggleChatColorNamesByClassGroup(true, "YELL")
ToggleChatColorNamesByClassGroup(true, "GUILD")
ToggleChatColorNamesByClassGroup(true, "OFFICER")
ToggleChatColorNamesByClassGroup(true, "GUILD_ACHIEVEMENT")
ToggleChatColorNamesByClassGroup(true, "ACHIEVEMENT")
ToggleChatColorNamesByClassGroup(true, "WHISPER")
ToggleChatColorNamesByClassGroup(true, "PARTY")
ToggleChatColorNamesByClassGroup(true, "PARTY_LEADER")
ToggleChatColorNamesByClassGroup(true, "RAID")
ToggleChatColorNamesByClassGroup(true, "RAID_LEADER")
ToggleChatColorNamesByClassGroup(true, "RAID_WARNING")
ToggleChatColorNamesByClassGroup(true, "BATTLEGROUND")
ToggleChatColorNamesByClassGroup(true, "BATTLEGROUND_LEADER")
ToggleChatColorNamesByClassGroup(true, "CHANNEL1")
ToggleChatColorNamesByClassGroup(true, "CHANNEL2")
ToggleChatColorNamesByClassGroup(true, "CHANNEL3")
ToggleChatColorNamesByClassGroup(true, "CHANNEL4")
ToggleChatColorNamesByClassGroup(true, "CHANNEL5")
end
-- reset saved variables on char
TukuiDataPerChar = {}
-- reset movable stuff into original position
for i = 1, getn(T.MoverFrames) do
if T.MoverFrames[i] then T.MoverFrames[i]:SetUserPlaced(false) end
end
-- tell savedvariable that we installed Tukui perfectly
TukuiDataPerChar.installv5 = true
ReloadUI()
end
local function cvar()
end
local function DisableTukui()
DisableAddOn("Tukui")
ReloadUI()
end
------------------------------------------------------------------------
-- Popups
------------------------------------------------------------------------
StaticPopupDialogs["TUKUIDISABLE_UI"] = {
text = L.popup_disableui,
button1 = ACCEPT,
button2 = CANCEL,
OnAccept = DisableTukui,
timeout = 0,
whileDead = 1,
}
StaticPopupDialogs["TUKUIINSTALL_UI"] = {
text = L.popup_install,
button1 = ACCEPT,
button2 = CANCEL,
OnAccept = install,
OnCancel = function() TukuiDataPerChar.installv5 = true end,
timeout = 0,
whileDead = 1,
}
StaticPopupDialogs["TUKUIRESET_UI"] = {
text = L.popup_reset,
button1 = ACCEPT,
button2 = CANCEL,
OnAccept = install,
OnCancel = function() TukuiDataPerChar.installv5 = true end,
timeout = 0,
whileDead = 1,
}
StaticPopupDialogs["TUKUIDISABLE_RAID"] = {
text = L.popup_2raidactive,
button1 = "DPS - TANK",
button2 = "HEAL",
OnAccept = function() DisableAddOn("Tukui_Raid_Healing") EnableAddOn("Tukui_Raid") ReloadUI() end,
OnCancel = function() EnableAddOn("Tukui_Raid_Healing") DisableAddOn("Tukui_Raid") ReloadUI() end,
timeout = 0,
whileDead = 1,
}
------------------------------------------------------------------------
-- On login function, look for some infos!
------------------------------------------------------------------------
local TukuiOnLogon = CreateFrame("Frame")
TukuiOnLogon:RegisterEvent("PLAYER_ENTERING_WORLD")
TukuiOnLogon:SetScript("OnEvent", function(self, event)
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
-- create empty saved vars if they doesn't exist.
if (TukuiData == nil) then TukuiData = {} end
if (TukuiDataPerChar == nil) then TukuiDataPerChar = {} end
if T.getscreenwidth < 1200 then
SetCVar("useUiScale", 0)
StaticPopup_Show("TUKUIDISABLE_UI")
else
SetCVar("useUiScale", 1)
if C["general"].multisampleprotect == true then
SetMultisampleFormat(1)
end
if C["general"].uiscale > 1 then C["general"].uiscale = 1 end
if C["general"].uiscale < 0.64 then C["general"].uiscale = 0.64 end
-- set our uiscale
SetCVar("uiScale", C["general"].uiscale)
-- we adjust UIParent to screen #1 if Eyefinity is found
if T.eyefinity then
local width = T.eyefinity
local height = T.getscreenheight
-- if autoscale is off, find a new width value of UIParent for screen #1.
if not C.general.autoscale or height > 1200 then
local h = UIParent:GetHeight()
local ratio = T.getscreenheight / h
local w = T.eyefinity / ratio
width = w
height = h
end
UIParent:SetSize(width, height)
UIParent:ClearAllPoints()
UIParent:SetPoint("CENTER")
end
-- install default if we never ran Tukui on this character.
if not TukuiDataPerChar.installv5 then
StaticPopup_Show("TUKUIINSTALL_UI")
end
end
if (IsAddOnLoaded("Tukui_Raid") and IsAddOnLoaded("Tukui_Raid_Healing")) then
StaticPopup_Show("TUKUIDISABLE_RAID")
end
print(L.core_welcome1..T.version)
print(L.core_welcome2)
end)
------------------------------------------------------------------------
-- UI HELP
------------------------------------------------------------------------
-- Print Help Messages
local function UIHelp()
print(" ")
print(L.core_uihelp1)
print(L.core_uihelp2)
print(L.core_uihelp3)
print(L.core_uihelp4)
print(L.core_uihelp5)
print(L.core_uihelp6)
print(L.core_uihelp7)
print(L.core_uihelp8)
print(L.core_uihelp9)
print(L.core_uihelp10)
print(L.core_uihelp11)
print(" ")
print(L.core_uihelp100)
end
SLASH_UIHELP1 = "/UIHelp"
SlashCmdList["UIHELP"] = UIHelp
SLASH_CONFIGURE1 = "/resetui"
SlashCmdList.CONFIGURE = function() StaticPopup_Show("TUKUIRESET_UI") end