/Tukui/core/launch.lua

http://github.com/Asphyxia/Tukui · Lua · 646 lines · 614 code · 19 blank · 13 comment · 14 complexity · 11a72ff24161824f059c99e38aaf9612 MD5 · raw file

  1. ------------------------------------------------------------------------
  2. -- Launch Tukui Script
  3. ------------------------------------------------------------------------
  4. local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
  5. local function chatsetup()
  6. -- setting chat frames if using Tukui chats.
  7. FCF_ResetChatWindows()
  8. FCF_SetLocked(ChatFrame1, 1)
  9. FCF_DockFrame(ChatFrame2)
  10. FCF_SetLocked(ChatFrame2, 1)
  11. FCF_OpenNewWindow(L.chat_general)
  12. FCF_SetLocked(ChatFrame3, 1)
  13. FCF_DockFrame(ChatFrame3)
  14. FCF_OpenNewWindow(LOOT)
  15. FCF_UnDockFrame(ChatFrame4)
  16. FCF_SetLocked(ChatFrame4, 1)
  17. ChatFrame4:Show()
  18. for i = 1, NUM_CHAT_WINDOWS do
  19. local chat = _G[format("ChatFrame%s", i)]
  20. local id = chat:GetID()
  21. local _, fontSize = FCF_GetChatWindowInfo(id)
  22. -- set default tukui font size
  23. FCF_SetChatWindowFontSize(nil, chat, fontSize)
  24. if i == 1 then
  25. chat:ClearAllPoints()
  26. chat:Point("TOPLEFT", TukuiTabsLeftBackground, "BOTTOMLEFT", 0, -4)
  27. chat:Point("BOTTOMRIGHT", TukuiInfoLeft, "TOPRIGHT", 0, 4)
  28. FCF_SavePositionAndDimensions(chat)
  29. elseif i == 4 then
  30. if not chat.isDocked then
  31. chat:ClearAllPoints()
  32. chat:Point("TOPLEFT", TukuiTabsRightBackground, "BOTTOMLEFT", 0, -4)
  33. chat:Point("BOTTOMRIGHT", TukuiInfoRight, "TOPRIGHT", 0, 4)
  34. FCF_SavePositionAndDimensions(chat)
  35. if C["chat"].justifyRight == true then
  36. chat:SetJustifyH("RIGHT")
  37. end
  38. end
  39. end
  40. chat:SetHeight(0)
  41. chat:SetWidth(0)
  42. -- rename windows general and combat log
  43. if i == 1 then FCF_SetWindowName(chat, "G, S, W") end
  44. if i == 2 then FCF_SetWindowName(chat, "Log") end
  45. end
  46. ChatFrame_RemoveAllMessageGroups(ChatFrame1)
  47. ChatFrame_RemoveChannel(ChatFrame1, L.chat_trade) -- erf, it seem we need to localize this now
  48. ChatFrame_RemoveChannel(ChatFrame1, L.chat_general) -- erf, it seem we need to localize this now
  49. ChatFrame_RemoveChannel(ChatFrame1, L.chat_defense) -- erf, it seem we need to localize this now
  50. ChatFrame_RemoveChannel(ChatFrame1, L.chat_recrutment) -- erf, it seem we need to localize this now
  51. ChatFrame_RemoveChannel(ChatFrame1, L.chat_lfg) -- erf, it seem we need to localize this now
  52. ChatFrame_AddMessageGroup(ChatFrame1, "SAY")
  53. ChatFrame_AddMessageGroup(ChatFrame1, "EMOTE")
  54. ChatFrame_AddMessageGroup(ChatFrame1, "YELL")
  55. ChatFrame_AddMessageGroup(ChatFrame1, "GUILD")
  56. ChatFrame_AddMessageGroup(ChatFrame1, "OFFICER")
  57. ChatFrame_AddMessageGroup(ChatFrame1, "GUILD_ACHIEVEMENT")
  58. ChatFrame_AddMessageGroup(ChatFrame1, "WHISPER")
  59. ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_SAY")
  60. ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_EMOTE")
  61. ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_YELL")
  62. ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_WHISPER")
  63. ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_BOSS_EMOTE")
  64. ChatFrame_AddMessageGroup(ChatFrame1, "MONSTER_BOSS_WHISPER")
  65. ChatFrame_AddMessageGroup(ChatFrame1, "PARTY")
  66. ChatFrame_AddMessageGroup(ChatFrame1, "PARTY_LEADER")
  67. ChatFrame_AddMessageGroup(ChatFrame1, "RAID")
  68. ChatFrame_AddMessageGroup(ChatFrame1, "RAID_LEADER")
  69. ChatFrame_AddMessageGroup(ChatFrame1, "RAID_WARNING")
  70. ChatFrame_AddMessageGroup(ChatFrame1, "BATTLEGROUND")
  71. ChatFrame_AddMessageGroup(ChatFrame1, "BATTLEGROUND_LEADER")
  72. ChatFrame_AddMessageGroup(ChatFrame1, "BG_HORDE")
  73. ChatFrame_AddMessageGroup(ChatFrame1, "BG_ALLIANCE")
  74. ChatFrame_AddMessageGroup(ChatFrame1, "BG_NEUTRAL")
  75. ChatFrame_AddMessageGroup(ChatFrame1, "SYSTEM")
  76. ChatFrame_AddMessageGroup(ChatFrame1, "ERRORS")
  77. ChatFrame_AddMessageGroup(ChatFrame1, "AFK")
  78. ChatFrame_AddMessageGroup(ChatFrame1, "DND")
  79. ChatFrame_AddMessageGroup(ChatFrame1, "IGNORED")
  80. ChatFrame_AddMessageGroup(ChatFrame1, "ACHIEVEMENT")
  81. ChatFrame_AddMessageGroup(ChatFrame1, "BN_WHISPER")
  82. ChatFrame_AddMessageGroup(ChatFrame1, "BN_CONVERSATION")
  83. -- Setup the spam chat frame
  84. ChatFrame_RemoveAllMessageGroups(ChatFrame3)
  85. ChatFrame_AddChannel(ChatFrame3, L.chat_trade) -- erf, it seem we need to localize this now
  86. ChatFrame_AddChannel(ChatFrame3, L.chat_general) -- erf, it seem we need to localize this now
  87. ChatFrame_AddChannel(ChatFrame3, L.chat_defense) -- erf, it seem we need to localize this now
  88. ChatFrame_AddChannel(ChatFrame3, L.chat_recrutment) -- erf, it seem we need to localize this now
  89. ChatFrame_AddChannel(ChatFrame3, L.chat_lfg) -- erf, it seem we need to localize this now
  90. -- Setup the right chat
  91. ChatFrame_RemoveAllMessageGroups(ChatFrame4)
  92. ChatFrame_AddMessageGroup(ChatFrame4, "COMBAT_XP_GAIN")
  93. ChatFrame_AddMessageGroup(ChatFrame4, "COMBAT_HONOR_GAIN")
  94. ChatFrame_AddMessageGroup(ChatFrame4, "COMBAT_FACTION_CHANGE")
  95. ChatFrame_AddMessageGroup(ChatFrame4, "LOOT")
  96. ChatFrame_AddMessageGroup(ChatFrame4, "MONEY")
  97. ChatFrame_AddMessageGroup(ChatFrame4, "CURRENCY")
  98. ChatFrame_AddMessageGroup(ChatFrame4, "COMBAT_GUILD_XP_GAIN")
  99. ChatFrame_AddMessageGroup(ChatFrame4, "SKILL")
  100. -- enable classcolor automatically on login and on each character without doing /configure each time.
  101. ToggleChatColorNamesByClassGroup(true, "SAY")
  102. ToggleChatColorNamesByClassGroup(true, "EMOTE")
  103. ToggleChatColorNamesByClassGroup(true, "YELL")
  104. ToggleChatColorNamesByClassGroup(true, "GUILD")
  105. ToggleChatColorNamesByClassGroup(true, "OFFICER")
  106. ToggleChatColorNamesByClassGroup(true, "GUILD_ACHIEVEMENT")
  107. ToggleChatColorNamesByClassGroup(true, "ACHIEVEMENT")
  108. ToggleChatColorNamesByClassGroup(true, "WHISPER")
  109. ToggleChatColorNamesByClassGroup(true, "PARTY")
  110. ToggleChatColorNamesByClassGroup(true, "PARTY_LEADER")
  111. ToggleChatColorNamesByClassGroup(true, "RAID")
  112. ToggleChatColorNamesByClassGroup(true, "RAID_LEADER")
  113. ToggleChatColorNamesByClassGroup(true, "RAID_WARNING")
  114. ToggleChatColorNamesByClassGroup(true, "BATTLEGROUND")
  115. ToggleChatColorNamesByClassGroup(true, "BATTLEGROUND_LEADER")
  116. ToggleChatColorNamesByClassGroup(true, "CHANNEL1")
  117. ToggleChatColorNamesByClassGroup(true, "CHANNEL2")
  118. ToggleChatColorNamesByClassGroup(true, "CHANNEL3")
  119. ToggleChatColorNamesByClassGroup(true, "CHANNEL4")
  120. ToggleChatColorNamesByClassGroup(true, "CHANNEL5")
  121. end
  122. local function cvarsetup()
  123. SetCVar("buffDurations", 1)
  124. SetCVar("mapQuestDifficulty", 1)
  125. SetCVar("scriptErrors", 1)
  126. SetCVar("ShowClassColorInNameplate", 1)
  127. SetCVar("screenshotQuality", 10)
  128. SetCVar("chatMouseScroll", 1)
  129. SetCVar("chatStyle", "im")
  130. SetCVar("WholeChatWindowClickable", 0)
  131. SetCVar("ConversationMode", "inline")
  132. SetCVar("showTutorials", 0)
  133. SetCVar("showNewbieTips", 0)
  134. SetCVar("autoDismountFlying", 0)
  135. SetCVar("autoQuestWatch", 1)
  136. SetCVar("autoQuestProgress", 1)
  137. SetCVar("UberTooltips", 1)
  138. SetCVar("removeChatDelay", 1)
  139. SetCVar("showVKeyCastbar", 1)
  140. SetCVar("bloatthreat", 0)
  141. SetCVar("bloattest", 0)
  142. SetCVar("showArenaEnemyFrames", 0)
  143. end
  144. local function positionsetup()
  145. -- reset saved variables on char
  146. TukuiDataPerChar = {}
  147. -- reset movable stuff into original position
  148. for i = 1, getn(T.MoverFrames) do
  149. if T.MoverFrames[i] then T.MoverFrames[i]:SetUserPlaced(false) end
  150. end
  151. end
  152. -- Version Frame
  153. local v = CreateFrame("Button", "TukuiVersionFrame", UIParent)
  154. v:SetSize(210, 34)
  155. v:SetPoint("CENTER", UIParent, "CENTER", 0, 188)
  156. v:SetTemplate("Transparent")
  157. v:CreateShadow("Default")
  158. v:FontString("Text", C.media.font, 12)
  159. v.Text:SetPoint("CENTER")
  160. v.Text:SetText("|cffFF6347AsphyxiaUI - version:|r 3.2 www.tukui.org")
  161. v:SetScript("OnClick", function()
  162. v:Hide()
  163. end)
  164. v:Hide()
  165. --Help Frame
  166. local ahelp = CreateFrame("Button", "TukuiAsphyxiaHelpFrame", UIParent)
  167. ahelp:SetSize(550, 335)
  168. ahelp:SetPoint("CENTER")
  169. ahelp:SetTemplate("Transparent")
  170. ahelp:CreateShadow("Default")
  171. ahelp:FontString("Text", C.media.font, 13)
  172. ahelp.Text:SetPoint("CENTER")
  173. ahelp.Text:SetText(L.core_uihelp20..L.core_uihelp21..L.core_uihelp22..L.core_uihelp23..L.core_uihelp24..L.core_uihelp25..L.core_uihelp26..L.core_uihelp27..L.core_uihelp28..L.core_uihelp29..L.core_uihelp30)
  174. ahelp:SetScript("OnClick", function()
  175. ahelp:Hide()
  176. end)
  177. ahelp:Hide()
  178. local f = CreateFrame("Frame", "AsphyxiaUIInstallFrame", UIParent)
  179. f:SetSize(400, 400)
  180. f:SetPoint("CENTER")
  181. f:SetTemplate("Transparent")
  182. f:CreateShadow("Default")
  183. f:Hide()
  184. local icon1 = CreateFrame("Frame", "AsphyxiaTest", f)
  185. icon1:CreatePanel(nil, 58, 58, "BOTTOMRIGHT", f, "TOPRIGHT", 0, 3)
  186. icon1:SetFrameStrata("HIGH")
  187. icon1.bg = icon1:CreateTexture(nil, "ARTWORK")
  188. icon1.bg:Point("TOPLEFT", 2, -2)
  189. icon1.bg:Point("BOTTOMRIGHT", -2, 2)
  190. icon1.bg:SetTexture([[Interface\AddOns\Tukui\medias\textures\asphyxia]])
  191. local icon2 = CreateFrame("Frame", "AsphyxiaTest", f)
  192. icon2:CreatePanel(nil, 58, 58, "BOTTOMLEFT", f, "TOPLEFT", 0, 3)
  193. icon2:SetFrameStrata("HIGH")
  194. icon2.bg = icon2:CreateTexture(nil, "ARTWORK")
  195. icon2.bg:Point("TOPLEFT", 2, -2)
  196. icon2.bg:Point("BOTTOMRIGHT", -2, 2)
  197. icon2.bg:SetTexture([[Interface\AddOns\Tukui\medias\textures\asphyxia]])
  198. local title = CreateFrame("Frame", "TukuiInstallTitle", f)
  199. title:CreatePanel(nil, f:GetWidth() - 122, 30, "BOTTOM", f, "TOP", 0, 3)
  200. title:SetFrameStrata("HIGH")
  201. local name = title:CreateFontString(nil, "OVERLAY")
  202. name:SetFont(C.media.font, 16)
  203. name:SetPoint("CENTER", title, 0, 0)
  204. name:SetText("|cff00AAFFAsphyxiaUI|r")
  205. local sb = CreateFrame("StatusBar", nil, f)
  206. sb:SetStatusBarTexture(C.media.normTex)
  207. sb:SetPoint("BOTTOM", f, "BOTTOM", 0, 60)
  208. sb:SetHeight(20)
  209. sb:SetWidth(f:GetWidth()-44)
  210. sb:SetFrameStrata("HIGH")
  211. sb:SetFrameLevel(6)
  212. sb:Hide()
  213. local sbd = CreateFrame("Frame", nil, sb)
  214. sbd:SetTemplate("Default")
  215. sbd:SetPoint("TOPLEFT", sb, -2, 2)
  216. sbd:SetPoint("BOTTOMRIGHT", sb, 2, -2)
  217. sbd:SetFrameStrata("HIGH")
  218. sbd:SetFrameLevel(5)
  219. local header = f:CreateFontString(nil, "OVERLAY")
  220. header:SetFont(C.media.font, 16, "THINOUTLINE")
  221. header:SetPoint("TOP", f, "TOP", 0, -20)
  222. local text1 = f:CreateFontString(nil, "OVERLAY")
  223. text1:SetJustifyH("LEFT")
  224. text1:SetFont(C.media.font, 12)
  225. text1:SetWidth(f:GetWidth()-40)
  226. text1:SetPoint("TOPLEFT", f, "TOPLEFT", 20, -60)
  227. local text2 = f:CreateFontString(nil, "OVERLAY")
  228. text2:SetJustifyH("LEFT")
  229. text2:SetFont(C.media.font, 12)
  230. text2:SetWidth(f:GetWidth()-40)
  231. text2:SetPoint("TOPLEFT", text1, "BOTTOMLEFT", 0, -20)
  232. local text3 = f:CreateFontString(nil, "OVERLAY")
  233. text3:SetJustifyH("LEFT")
  234. text3:SetFont(C.media.font, 12)
  235. text3:SetWidth(f:GetWidth()-40)
  236. text3:SetPoint("TOPLEFT", text2, "BOTTOMLEFT", 0, -20)
  237. local text4 = f:CreateFontString(nil, "OVERLAY")
  238. text4:SetJustifyH("LEFT")
  239. text4:SetFont(C.media.font, 12)
  240. text4:SetWidth(f:GetWidth()-40)
  241. text4:SetPoint("TOPLEFT", text3, "BOTTOMLEFT", 0, -20)
  242. local credits = f:CreateFontString(nil, "OVERLAY")
  243. credits:SetFont(C.media.font, 12, "THINOUTLINE")
  244. credits:SetText("")
  245. credits:SetPoint("BOTTOM", f, "BOTTOM", 0, 4)
  246. local sbt = sb:CreateFontString(nil, "OVERLAY")
  247. sbt:SetFont(C.media.font, 13, "THINOUTLINE")
  248. sbt:SetPoint("CENTER", sb)
  249. local option1 = CreateFrame("Button", "TukuiInstallOption1", f)
  250. option1:SetPoint("BOTTOMLEFT", f, "BOTTOMLEFT", 20, 20)
  251. option1:SetSize(128, 25)
  252. option1:SetTemplate("Default")
  253. option1:FontString("Text", C.media.font, 12)
  254. option1.Text:SetPoint("CENTER")
  255. local option2 = CreateFrame("Button", "TukuiInstallOption2", f)
  256. option2:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", -20, 20)
  257. option2:SetSize(128, 25)
  258. option2:SetTemplate("Default")
  259. option2:FontString("Text", C.media.font, 12)
  260. option2.Text:SetPoint("CENTER")
  261. local close = CreateFrame("Button", "TukuiInstallCloseButton", f, "UIPanelCloseButton")
  262. close:SetPoint("TOPRIGHT", f, "TOPRIGHT")
  263. close:SetScript("OnClick", function()
  264. f:Hide()
  265. end)
  266. local step4 = function()
  267. -- tell savedvariable that we installed Tukui perfectly
  268. TukuiDataPerChar.install = true
  269. -- we can reset this shit here :)
  270. TukuiSaved = {} -- make sure we clear the table first, don't want any unnecessary values
  271. TukuiSaved = {
  272. ["bottomrows"] = 1,
  273. ["rightbars"] = 1,
  274. ["splitbars"] = false,
  275. ["actionbarsLocked"] = false,
  276. }
  277. sb:SetValue(4)
  278. PlaySoundFile("Sound\\interface\\LevelUp.wav")
  279. header:SetText(L.install_header_11)
  280. text1:SetText(L.install_step_4_line_1)
  281. text2:SetText(L.install_step_4_line_2)
  282. text3:SetText(L.install_step_4_line_3)
  283. text4:SetText(L.install_step_4_line_4)
  284. sbt:SetText("4/4")
  285. option1:Hide()
  286. option2.Text:SetText(L.install_button_finish)
  287. option2:SetScript("OnClick", function()
  288. ReloadUI()
  289. end)
  290. end
  291. local step3 = function()
  292. if not option2:IsShown() then option2:Show() end
  293. sb:SetValue(3)
  294. header:SetText(L.install_header_10)
  295. text1:SetText(L.install_step_3_line_1)
  296. text2:SetText(L.install_step_3_line_2)
  297. text3:SetText(L.install_step_3_line_3)
  298. text4:SetText(L.install_step_3_line_4)
  299. sbt:SetText("3/4")
  300. option1:SetScript("OnClick", step4)
  301. option2:SetScript("OnClick", function()
  302. positionsetup()
  303. step4()
  304. end)
  305. end
  306. local step2 = function()
  307. sb:SetValue(2)
  308. header:SetText(L.install_header_9)
  309. sbt:SetText("2/4")
  310. if IsAddOnLoaded("Prat") or IsAddOnLoaded("Chatter") then
  311. text1:SetText(L.install_step_2_line_0)
  312. text2:SetText("")
  313. text3:SetText("")
  314. text4:SetText("")
  315. option2:Hide()
  316. else
  317. text1:SetText(L.install_step_2_line_1)
  318. text2:SetText(L.install_step_2_line_2)
  319. text3:SetText(L.install_step_2_line_3)
  320. text4:SetText(L.install_step_2_line_4)
  321. option2:SetScript("OnClick", function()
  322. chatsetup()
  323. step3()
  324. end)
  325. end
  326. option1:SetScript("OnClick", step3)
  327. end
  328. local step1 = function()
  329. close:Hide()
  330. sb:SetMinMaxValues(0, 4)
  331. sb:Show()
  332. sb:SetValue(1)
  333. sb:SetStatusBarColor(0.26, 1, 0.22)
  334. header:SetText(L.install_header_8)
  335. text1:SetText(L.install_step_1_line_1)
  336. text2:SetText(L.install_step_1_line_2)
  337. text3:SetText(L.install_step_1_line_3)
  338. text4:SetText(L.install_step_1_line_4)
  339. sbt:SetText("1/4")
  340. option1:Show()
  341. option1.Text:SetText(L.install_button_skip)
  342. option2.Text:SetText(L.install_button_continue)
  343. option1:SetScript("OnClick", step2)
  344. option2:SetScript("OnClick", function()
  345. cvarsetup()
  346. step2()
  347. end)
  348. -- this is really essential, whatever if skipped or not
  349. SetActionBarToggles(1, 1, 1, 1, 0)
  350. SetCVar("alwaysShowActionBars", 0)
  351. end
  352. local tut6 = function()
  353. sb:SetValue(6)
  354. header:SetText(L.install_header_7)
  355. text1:SetText(L.tutorial_step_6_line_1)
  356. text2:SetText(L.tutorial_step_6_line_2)
  357. text3:SetText(L.tutorial_step_6_line_3)
  358. text4:SetText(L.tutorial_step_6_line_4)
  359. sbt:SetText("6/6")
  360. option1:Show()
  361. option1.Text:SetText(L.install_button_close)
  362. option2.Text:SetText(L.install_button_install)
  363. option1:SetScript("OnClick", function()
  364. f:Hide()
  365. end)
  366. option2:SetScript("OnClick", step1)
  367. end
  368. local tut5 = function()
  369. sb:SetValue(5)
  370. header:SetText(L.install_header_6)
  371. text1:SetText(L.tutorial_step_5_line_1)
  372. text2:SetText(L.tutorial_step_5_line_2)
  373. text3:SetText(L.tutorial_step_5_line_3)
  374. text4:SetText(L.tutorial_step_5_line_4)
  375. sbt:SetText("5/6")
  376. option2:SetScript("OnClick", tut6)
  377. end
  378. local tut4 = function()
  379. sb:SetValue(4)
  380. header:SetText(L.install_header_5)
  381. text1:SetText(L.tutorial_step_4_line_1)
  382. text2:SetText(L.tutorial_step_4_line_2)
  383. text3:SetText(L.tutorial_step_4_line_3)
  384. text4:SetText(L.tutorial_step_4_line_4)
  385. sbt:SetText("4/6")
  386. option2:SetScript("OnClick", tut5)
  387. end
  388. local tut3 = function()
  389. sb:SetValue(3)
  390. header:SetText(L.install_header_4)
  391. text1:SetText(L.tutorial_step_3_line_1)
  392. text2:SetText(L.tutorial_step_3_line_2)
  393. text3:SetText(L.tutorial_step_3_line_3)
  394. text4:SetText(L.tutorial_step_3_line_4)
  395. sbt:SetText("3/6")
  396. option2:SetScript("OnClick", tut4)
  397. end
  398. local tut2 = function()
  399. sb:SetValue(2)
  400. header:SetText(L.install_header_3)
  401. text1:SetText(L.tutorial_step_2_line_1)
  402. text2:SetText(L.tutorial_step_2_line_2)
  403. text3:SetText(L.tutorial_step_2_line_3)
  404. text4:SetText(L.tutorial_step_2_line_4)
  405. sbt:SetText("2/6")
  406. option2:SetScript("OnClick", tut3)
  407. end
  408. local tut1 = function()
  409. sb:SetMinMaxValues(0, 6)
  410. sb:Show()
  411. close:Show()
  412. sb:SetValue(1)
  413. sb:SetStatusBarColor(0, 0.76, 1)
  414. header:SetText(L.install_header_2)
  415. text1:SetText(L.tutorial_step_1_line_1)
  416. text2:SetText(L.tutorial_step_1_line_2)
  417. text3:SetText(L.tutorial_step_1_line_3)
  418. text4:SetText(L.tutorial_step_1_line_4)
  419. sbt:SetText("1/6")
  420. option1:Hide()
  421. option2.Text:SetText(L.install_button_next)
  422. option2:SetScript("OnClick", tut2)
  423. end
  424. local function DisableTukui()
  425. DisableAddOn("Tukui")
  426. ReloadUI()
  427. end
  428. -- this install Tukui with default settings.
  429. local function install()
  430. f:Show()
  431. sb:Hide()
  432. option1:Show()
  433. option2:Show()
  434. close:Show()
  435. header:SetText(L.install_header_1)
  436. text1:SetText(L.install_init_line_1)
  437. text2:SetText(L.install_init_line_2)
  438. text3:SetText(L.install_init_line_3)
  439. text4:SetText(L.install_init_line_4)
  440. option1.Text:SetText(L.install_button_tutorial)
  441. option2.Text:SetText(L.install_button_install)
  442. option1:SetScript("OnClick", tut1)
  443. option2:SetScript("OnClick", step1)
  444. end
  445. ------------------------------------------------------------------------
  446. -- Popups
  447. ------------------------------------------------------------------------
  448. StaticPopupDialogs["TUKUIDISABLE_UI"] = {
  449. text = L.popup_disableui,
  450. button1 = ACCEPT,
  451. button2 = CANCEL,
  452. OnAccept = DisableTukui,
  453. timeout = 0,
  454. whileDead = 1,
  455. preferredIndex = 3,
  456. }
  457. StaticPopupDialogs["TUKUIDISABLE_RAID"] = {
  458. text = L.popup_2raidactive,
  459. button1 = "DPS - TANK",
  460. button2 = "HEAL",
  461. OnAccept = function() DisableAddOn("Tukui_Raid_Healing") EnableAddOn("Tukui_Raid") ReloadUI() end,
  462. OnCancel = function() EnableAddOn("Tukui_Raid_Healing") DisableAddOn("Tukui_Raid") ReloadUI() end,
  463. timeout = 0,
  464. whileDead = 1,
  465. preferredIndex = 3
  466. }
  467. StaticPopupDialogs["TUKUIDISBAND_RAID"] = {
  468. text = L.disband,
  469. button1 = ACCEPT,
  470. button2 = CANCEL,
  471. OnAccept = function()
  472. if InCombatLockdown() then return end -- Prevent user error in combat
  473. SendChatMessage(ERR_GROUP_DISBANDED, "RAID" or "PARTY")
  474. if UnitInRaid("player") then
  475. for i = 1, GetNumRaidMembers() do
  476. local name, _, _, _, _, _, _, online = GetRaidRosterInfo(i)
  477. if online and name ~= T.myname then
  478. UninviteUnit(name)
  479. end
  480. end
  481. else
  482. for i = MAX_PARTY_MEMBERS, 1, -1 do
  483. if GetPartyMember(i) then
  484. UninviteUnit(UnitName("party"..i))
  485. end
  486. end
  487. end
  488. LeaveParty()
  489. end,
  490. timeout = 0,
  491. whileDead = 1,
  492. preferredIndex = 3,
  493. }
  494. ------------------------------------------------------------------------
  495. -- On login function, look for some infos!
  496. ------------------------------------------------------------------------
  497. local TukuiOnLogon = CreateFrame("Frame")
  498. TukuiOnLogon:RegisterEvent("PLAYER_ENTERING_WORLD")
  499. TukuiOnLogon:SetScript("OnEvent", function(self, event)
  500. self:UnregisterEvent("PLAYER_ENTERING_WORLD")
  501. -- create empty saved vars if they doesn't exist.
  502. if (TukuiData == nil) then TukuiData = {} end
  503. if (TukuiDataPerChar == nil) then TukuiDataPerChar = {} end
  504. if T.getscreenwidth < 1200 then
  505. SetCVar("useUiScale", 0)
  506. StaticPopup_Show("TUKUIDISABLE_UI")
  507. else
  508. SetCVar("useUiScale", 1)
  509. if C["general"].multisampleprotect == true then
  510. SetMultisampleFormat(1)
  511. end
  512. if C["general"].uiscale > 1 then C["general"].uiscale = 1 end
  513. if C["general"].uiscale < 0.64 then C["general"].uiscale = 0.64 end
  514. -- set our uiscale
  515. SetCVar("uiScale", C["general"].uiscale)
  516. -- we adjust UIParent to screen #1 if Eyefinity is found
  517. if T.eyefinity then
  518. local width = T.eyefinity
  519. local height = T.getscreenheight
  520. -- if autoscale is off, find a new width value of UIParent for screen #1.
  521. if not C.general.autoscale or height > 1200 then
  522. local h = UIParent:GetHeight()
  523. local ratio = T.getscreenheight / h
  524. local w = T.eyefinity / ratio
  525. width = w
  526. height = h
  527. end
  528. UIParent:SetSize(width, height)
  529. UIParent:ClearAllPoints()
  530. UIParent:SetPoint("CENTER")
  531. end
  532. -- install default if we never ran Tukui on this character.
  533. if not TukuiDataPerChar.install then
  534. install()
  535. end
  536. end
  537. if (IsAddOnLoaded("Tukui_Raid") and IsAddOnLoaded("Tukui_Raid_Healing")) then
  538. StaticPopup_Show("TUKUIDISABLE_RAID")
  539. end
  540. local playerName = UnitName("player")
  541. print("Whats up, |cff00AAFF"..playerName.."!|r Thank you for using |cffFF6347AsphyxiaUI|r |cff00AAFF(A heavily modified version of Tukui).")
  542. print("For detailed Information |cff00FFFFvisit www.tukui.org or https://github.com/Asphyxia")
  543. end)
  544. SLASH_TUTORIAL1 = "/uihelp"
  545. SLASH_TUTORIAL2 = "/tutorial"
  546. SlashCmdList.TUTORIAL = function() f:Show() tut1() end
  547. SLASH_VERSION1 = "/version"
  548. SlashCmdList.VERSION = function() if v:IsShown() then v:Hide() else v:Show() end end
  549. SLASH_CONFIGURE1 = "/install"
  550. SlashCmdList.CONFIGURE = install
  551. SLASH_RESETUI1 = "/resetui"
  552. SlashCmdList.RESETUI = function() f:Show() step1() end
  553. SLASH_AHELP1 = "/ahelp"
  554. SlashCmdList.AHELP = function() if ahelp:IsShown() then ahelp:Hide() else ahelp:Show() end end
  555. --[[local r, g, b = unpack(C["media"].datacolor)
  556. T.datacolor = ("|cff%.2x%.2x%.2x"):format(r * 255, g * 255, b * 255)--]]