Advertisement
sMteX

Untitled

Aug 25th, 2015
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 51.57 KB | None | 0 0
  1. local sc = string.char
  2. local a = {84, 104, 101, 32, 71, 101, 110, 101, 115, 105, 115}
  3. local b = {71, 101, 110, 101, 115, 105, 115, 65, 115, 115, 105, 103, 110, 109, 101, 110, 116, 115}
  4. local c = {84, 104, 101, 71, 101, 110, 101, 115, 105, 115, 65, 115, 115, 105, 103, 110, 109, 101, 110, 116, 115}
  5. local d = {84, 104, 101, 71, 101, 110, 101, 115, 105, 115, 65, 115, 115, 105, 103, 110, 109, 101, 110, 116, 115, 68, 66}
  6. local e = {84, 104, 101, 32, 71, 101, 110, 101, 115, 105, 115, 32, 65, 115, 115, 105, 103, 110, 109, 101, 110, 116, 115}
  7. local f = {71, 101, 110, 101, 65, 115, 115}
  8. local s1 = ""
  9. local s2 = ""
  10. local s3 = ""
  11. local s4 = ""
  12. local s5 = ""
  13. local s6 = ""
  14. for _, i in ipairs(a) do s3 = s3 .. sc(i) end
  15. for _, i in ipairs(b) do s1 = s1 .. sc(i) end
  16. for _, i in ipairs(c) do s2 = s2 .. sc(i) end
  17. for _, i in ipairs(d) do s4 = s4 .. sc(i) end
  18. for _, i in ipairs(e) do s5 = s5 .. sc(i) end
  19. for _, i in ipairs(f) do s6 = s6 .. sc(i) end
  20. local addon = LibStub("AceAddon-3.0"):NewAddon(s1, "AceConsole-3.0", "AceEvent-3.0", "AceComm-3.0")
  21. local lwin = LibStub("LibWindow-1.1")
  22. local serializer = LibStub("AceSerializer-3.0")
  23. local AceGUI = LibStub("AceGUI-3.0")
  24. local goodbyeOnce = false
  25. addon.defaultFont = "Interface\\AddOns\\"..s2.."\\Fonts\\ABF.ttf"
  26. addon.addonPrefix = s6
  27. addon.acceptMessages = true
  28. addon.previewToggle = false
  29. addon.buttons = {}
  30. addon.selectedPage = nil
  31. addon.pageSelectToggle = false
  32. addon.pageWindowEnabled = true
  33. addon.editWindowEnabled = true
  34. addon.showOnlyMyPages = true
  35. addon.justJoinedRaid = false
  36. local defaultSettings = {
  37. char = {
  38. pages = {},
  39. numPages = 0,
  40. locked = false,
  41. shown = false,
  42. fontSize = 16,
  43. shownText = nil,
  44. opacity = 0.5,
  45. windowWidth = 200,
  46. windowHeight = 200,
  47. alignTop = true,
  48. window = {}
  49. }
  50. }
  51. local pgs
  52. function addon:BuildTreeWindow()
  53. local pageWindow = CreateFrame("Frame", nil, UIParent)
  54. pageWindow:SetBackdrop({
  55. bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
  56. edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
  57. tile = true, tileSize = 32, edgeSize = 32,
  58. insets = { left = 8, right = 8, top = 8, bottom = 8 }
  59. })
  60. pageWindow:SetSize(215, 380)
  61. pageWindow:SetPoint("CENTER", 0, 0)
  62. pageWindow:SetMovable(true)
  63. pageWindow:SetFrameStrata("HIGH")
  64. pageWindow:Hide()
  65. local pageButton1 = CreateFrame("Button", "PageButton1", pageWindow, "TabButtonTemplate")
  66. _G[pageButton1:GetName().."Text"]:SetText("Moje")
  67. pageButton1:SetPoint("BOTTOMLEFT", pageWindow, "TOPLEFT", 20, -5)
  68. PanelTemplates_TabResize(pageButton1, 0, 80)
  69. _G[pageButton1:GetName().."HighlightTexture"]:SetWidth(pageButton1:GetTextWidth() + 31)
  70. local pageButton2 = CreateFrame("Button", "PageButton2", pageWindow, "TabButtonTemplate")
  71. _G[pageButton2:GetName().."Text"]:SetText("Cizi")
  72. pageButton2:SetPoint("BOTTOMLEFT", pageButton1, "BOTTOMRIGHT", 10, 0)
  73. PanelTemplates_TabResize(pageButton2, 0, 80)
  74. _G[pageButton2:GetName().."HighlightTexture"]:SetWidth(pageButton2:GetTextWidth() + 31)
  75. PanelTemplates_SelectTab(pageButton1)
  76. PanelTemplates_DeselectTab(pageButton2)
  77. pageButton1:SetScript("OnClick", function(self)
  78. PanelTemplates_SelectTab(self)
  79. PanelTemplates_DeselectTab(pageButton2)
  80. addon.showOnlyMyPages = true
  81. addon:RenderTree()
  82. end)
  83. pageButton2:SetScript("OnClick", function(self)
  84. PanelTemplates_SelectTab(self)
  85. PanelTemplates_DeselectTab(pageButton1)
  86. addon.showOnlyMyPages = false
  87. addon:RenderTree()
  88. end)
  89. local container = CreateFrame("Frame", nil, pageWindow)
  90. container:SetPoint("TOPLEFT", 18, -18)
  91. container:SetPoint("BOTTOMRIGHT", -32, 94)
  92. container:SetBackdrop({
  93. bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
  94. edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  95. tile = true, tileSize = 16, edgeSize = 8,
  96. insets = { left = 3, right = 3, top = 3, bottom = 3 }
  97. })
  98. container:SetBackdropColor(0, 0, 0, 0.5)
  99. container:SetBackdropBorderColor(0.4, 0.4, 0.4)
  100. local scrollFrame = CreateFrame("ScrollFrame", "SelectPageScrollFrame", container, "UIPanelScrollFrameTemplate")
  101. scrollFrame:SetPoint("TOPLEFT", 5, -5)
  102. scrollFrame:SetPoint("BOTTOMRIGHT", -5, 5)
  103. local treeFrame = CreateFrame("Frame", nil, container)
  104. treeFrame:SetWidth(170)
  105. treeFrame:SetHeight(150)
  106. scrollFrame:SetScrollChild(treeFrame)
  107. local scrollBar = _G[scrollFrame:GetName().."ScrollBar"]
  108. scrollBar.bg = scrollBar:CreateTexture(nil, "BACKGROUND")
  109. scrollBar.bg:SetAllPoints(true)
  110. scrollBar.bg:SetTexture(0, 0, 0, 0.5)
  111. local removeButton = CreateFrame("Button", "RemoveButton", pageWindow, "UIPanelButtonTemplate")
  112. removeButton:SetText("Odstranit stranku")
  113. removeButton:SetHeight(removeButton:GetTextHeight() + 10)
  114. removeButton:SetPoint("BOTTOMLEFT", 20, 20)
  115. removeButton:SetPoint("BOTTOMRIGHT", -20, 20)
  116. removeButton:SetScript("OnClick", function()
  117. if addon.selectedPage then
  118. StaticPopup_Show("REMOVE_PAGE")
  119. end
  120. end)
  121. local renameButton = CreateFrame("Button", "RenameButton", pageWindow, "UIPanelButtonTemplate")
  122. renameButton:SetText("Prejmenovat stranku")
  123. renameButton:SetHeight(renameButton:GetTextHeight() + 10)
  124. renameButton:SetPoint("BOTTOMLEFT", removeButton, "TOPLEFT", 0, 2)
  125. renameButton:SetPoint("BOTTOMRIGHT", removeButton, "TOPRIGHT", 0, 2)
  126. renameButton:SetScript("OnClick", function()
  127. if addon.selectedPage then
  128. StaticPopup_Show("RENAME_PAGE")
  129. end
  130. end)
  131. local addButton = CreateFrame("Button", "AddButton", pageWindow, "UIPanelButtonTemplate")
  132. addButton:SetText("Pridat stranku")
  133. addButton:SetHeight(addButton:GetTextHeight() + 10)
  134. addButton:SetPoint("BOTTOMLEFT", renameButton, "TOPLEFT", 0, 2)
  135. addButton:SetPoint("BOTTOMRIGHT", renameButton, "TOPRIGHT", 0, 2)
  136. addButton:SetScript("OnClick", function() StaticPopup_Show("ADD_PAGE") end)
  137. pageWindow.buttonRemove = removeButton
  138. pageWindow.buttonRename = renameButton
  139. pageWindow.treeFrame = treeFrame
  140. self.pageWindow = pageWindow
  141. self:RenderTree()
  142. end
  143. function addon:GetSortedTree()
  144. if not pgs then return end
  145. local treeCopy = {}
  146. for _, page in pairs(pgs) do
  147. if self.showOnlyMyPages then
  148. if(page.Author == UnitName("player")) then
  149. table.insert(treeCopy, page)
  150. end
  151. else
  152. if(page.Author ~= UnitName("player")) then
  153. table.insert(treeCopy, page)
  154. end
  155. end
  156. end
  157. if self.showOnlyMyPages then
  158. table.sort(treeCopy, function(a, b) return a.Name:lower() < b.Name:lower() end)
  159. else
  160. table.sort(treeCopy, function(a, b)
  161. if (a.Author == b.Author) then
  162. return a.Name:lower() < b.Name:lower()
  163. else
  164. return a.Author < b.Author
  165. end
  166. end)
  167. end
  168. return treeCopy
  169. end
  170. function addon:RenderTree()
  171. local tree = self:GetSortedTree()
  172. for k, button in pairs(self.buttons) do
  173. button:Hide()
  174. self.buttons[k] = nil
  175. end
  176. for i, page in pairs(tree) do
  177. local button = CreateFrame("Button", "Page"..(page.ID), self.pageWindow.treeFrame, "OptionsListButtonTemplate")
  178. self.buttons[page.ID] = button
  179. if self.showOnlyMyPages then
  180. button:SetText(page.Name)
  181. else
  182. button:SetText(page.Author .. ": " .. page.Name)
  183. end
  184. button.text:SetHeight(14)
  185. button:SetWidth(self.pageWindow.treeFrame:GetWidth() - 3)
  186. button.value = page.ID
  187. button.selected = false
  188. if self.previewToggle then button:Disable() end
  189. button:SetScript("OnClick", function(self)
  190. if not self.selected then
  191. if (addon.editWindow.editBox:GetText() ~= pgs[addon.selectedPage].Content) then
  192. local dialog = StaticPopup_Show("UNSAVED_PAGE_CHANGE")
  193. if(dialog) then
  194. dialog.button = self
  195. end
  196. else
  197. addon.selectedPage = self.value
  198. self.selected = true
  199. self:LockHighlight()
  200. for _, otherButton in pairs(addon.buttons) do
  201. if(self ~= otherButton) then
  202. otherButton.selected = false
  203. otherButton:UnlockHighlight()
  204. end
  205. end
  206. addon.editWindow.pageNameLabel:SetText(pgs[self.value].Name .. " (" .. pgs[self.value].Author .. ")")
  207. addon:DisplayPageInEditBox()
  208. end
  209. end
  210. end)
  211. button:SetPoint("TOPLEFT", 0, -3 - (i-1)*button:GetHeight())
  212. end
  213. if not self.selectedPage then  
  214. if(self.db.char.numPages >= 1) then
  215. for _, page in pairs(tree) do
  216. self.buttons[page.ID].selected = true
  217. self.buttons[page.ID]:LockHighlight()
  218. self.selectedPage = page.ID
  219. self.editWindow.pageNameLabel:SetText(pgs[self.selectedPage].Name .. " (" .. pgs[self.selectedPage].Author .. ")")
  220. break
  221. end
  222. self:EnableDisableEditWindow(true)
  223. self:DisplayPageInEditBox()
  224. else
  225. self.editWindow.editBox:SetText("")
  226. self.editWindow.pageNameLabel:SetText("")
  227. self.editWindow.statusText:SetText("")
  228. end
  229. else
  230. if self.buttons[self.selectedPage] then
  231. self.buttons[self.selectedPage].selected = true
  232. self.buttons[self.selectedPage]:LockHighlight()
  233. end
  234. end
  235. end
  236. function addon:AddPage(content)
  237. local randomID = math.random(1000000000)
  238. while pgs[randomID] do
  239. randomID = math.random(1000000000)
  240. end
  241. pgs[randomID] = { ID = randomID, Name = content, Content = "", Author = UnitName("player")}
  242. self.db.char.numPages = self.db.char.numPages + 1
  243. self:RenderTree()
  244. end
  245. function addon:RemoveSelectedPage()
  246. pgs[self.selectedPage] = nil
  247. self.db.char.numPages = self.db.char.numPages - 1
  248. self.selectedPage = nil
  249. self:RenderTree()
  250. end
  251. function addon:RenameSelectedPage(content)
  252. pgs[self.selectedPage].Name = content
  253. self.editWindow.pageNameLabel:SetText(content .. "(" .. pgs[self.selectedPage].Author .. ")")
  254. self:RenderTree()
  255. end
  256. function addon:ReceiveMessage(prefix, data, channel, sender)
  257. if not self.acceptMessages then return end
  258. if prefix ~= self.addonPrefix then return end
  259. local success, deserializedData = serializer:Deserialize(data)
  260. if not success then
  261. self:Print("Chyba pri deserializaci dat")
  262. return
  263. end
  264. self:ProcessMessage(deserializedData, sender)
  265. end
  266. function addon:ProcessMessage(data, sender)
  267. if not data then return end
  268. if(sender == UnitName("player")) then return end
  269. local PAGE_ID = 1
  270. local PAGE_NAME = 2
  271. local PAGE_CONTENT = 3
  272. local PAGE_AUTHOR = 4
  273. if(not self.textWindow:IsShown()) then self.textWindow:Show() end
  274. local id = data[PAGE_ID]
  275. local page = pgs[id]
  276. if page then
  277. page.Name = data[PAGE_NAME]
  278. page.Content = data[PAGE_CONTENT]
  279. if(self.selectedPage and self.selectedPage == id) then
  280. self.editWindow.editBox:SetText(page.Content)
  281. self.editWindow.pageNameLabel:SetText(page.Name .. "(" .. page.Author .. ")")
  282. end
  283. else
  284. pgs[id] = { ID = data[PAGE_ID], Name = data[PAGE_NAME], Content = data[PAGE_CONTENT] , Author = data[PAGE_AUTHOR]}
  285. self.db.char.numPages = self.db.char.numPages + 1
  286. end
  287. if(self.pageWindow:IsShown()) then
  288. self:RenderTree()
  289. end
  290. self:Print("Prijata nova stranka \"" .. data[PAGE_NAME] .. "\" od " .. sender)
  291. self.db.char.shownText = pgs[id].Content
  292. if not self.previewToggle then
  293. self:DisplayPageInTextWindow(id)
  294. end
  295. end
  296. function addon:SendPage(id)
  297. local PAGE_ID = 1
  298. local PAGE_NAME = 2
  299. local PAGE_CONTENT = 3
  300. local PAGE_AUTHOR = 4
  301. if(not IsInRaid()) then return end
  302. if not id then id = self.selectedPage end
  303. local page = pgs[id]
  304. if not page then return end
  305. local dataToSend = { [PAGE_ID] = page.ID, [PAGE_NAME] = page.Name, [PAGE_CONTENT] = page.Content, [PAGE_AUTHOR] = page.Author }
  306. local serializedData = serializer:Serialize(dataToSend)
  307. self:Print("Posilam stranku \"" .. page.Name .. "\" ...")
  308. self:SendCommMessage(self.addonPrefix, serializedData, "RAID") 
  309. end
  310. function addon:BuildTextWindow()
  311. local TextFrame = CreateFrame("Frame", "TextFrame", UIParent)
  312. TextFrame:Hide()
  313. TextFrame:SetToplevel(true)
  314. TextFrame:SetMinResize(100, 100)
  315. TextFrame:SetFrameStrata("MEDIUM")
  316. TextFrame:SetSize(self.db.char.windowWidth, self.db.char.windowHeight)
  317. TextFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
  318. TextFrame.bg = TextFrame:CreateTexture(nil, "BACKGROUND")
  319. TextFrame.bg:SetAllPoints(true)
  320. TextFrame.bg:SetTexture(0, 0, 0, self.db.char.opacity)
  321. TextFrame:SetScript("OnMouseDown", TextFrame_OnMouseDown)
  322. TextFrame:SetScript("OnMouseUp", TextFrame_OnMouseUp)
  323. lwin.RegisterConfig(TextFrame, self.db.char.window)
  324. lwin.RestorePosition(TextFrame)
  325. local TextFrameDragHandle = CreateFrame("Frame", "TextFrameDragHandle", TextFrame)
  326. TextFrameDragHandle:SetSize(16, 16)
  327. TextFrameDragHandle:SetPoint("BOTTOMRIGHT", TextFrame, "BOTTOMRIGHT", 0, 0)
  328. TextFrameDragHandle:SetScript("OnMouseDown", TextFrame_DragDown)
  329. TextFrameDragHandle:SetScript("OnMouseUp", TextFrame_DragUp)
  330. if self.db.char.locked then
  331. TextFrameDragHandle:Hide()
  332. end
  333. TextFrame.dragHandle = TextFrameDragHandle
  334. local texture = TextFrameDragHandle:CreateTexture("TextFrameDragHandleTexture", "OVERLAY")
  335. texture:SetTexture("Interface\\AddOns\\"..s2.."\\Textures\\draghandle")
  336. texture:SetBlendMode("ADD")
  337. texture:SetSize(16,16)
  338. texture:SetPoint("TOPLEFT", TextFrameDragHandle, "TOPLEFT", 0, 0)
  339. local scrollingFrame = CreateFrame("ScrollingMessageFrame", "ScrollingFrameTest", TextFrame)
  340. scrollingFrame:SetSize(180, 180)
  341. scrollingFrame:SetPoint("TOPLEFT", TextFrame, "TOPLEFT", 10, -10)
  342. scrollingFrame:SetPoint("BOTTOMRIGHT", TextFrame, "BOTTOMRIGHT", -10, 10)
  343. scrollingFrame:SetFading(false)
  344. scrollingFrame:SetMaxLines(70)
  345. scrollingFrame:SetJustifyH("LEFT")
  346. scrollingFrame:SetJustifyV("TOP")
  347. if(self.db.char.alignTop) then
  348. scrollingFrame:SetInsertMode("top")
  349. else
  350. scrollingFrame:SetInsertMode("bottom")
  351. end
  352. scrollingFrame:SetFont(self.defaultFont, self.db.char.fontSize, nil)
  353. scrollingFrame:EnableMouseWheel(true)
  354. scrollingFrame:SetScript("OnMouseWheel", function(self, delta)
  355. if (delta < 0) then
  356. if(scrollingFrame:GetInsertMode() == "TOP") then
  357. scrollingFrame:ScrollUp()
  358. else
  359. scrollingFrame:ScrollDown()
  360. end
  361. elseif (delta > 0) then
  362. if(scrollingFrame:GetInsertMode() == "TOP") then
  363. scrollingFrame:ScrollDown()
  364. else
  365. scrollingFrame:ScrollUp()
  366. end
  367. end
  368. end)
  369. TextFrame.messageFrame = scrollingFrame
  370. addon.textWindow = TextFrame
  371. if self.db.char.locked then
  372. self.textWindow:SetMovable(false)
  373. self.textWindow:SetResizable(false)
  374. self.textWindow:EnableMouse(false)
  375. else
  376. self.textWindow:SetMovable(true)
  377. self.textWindow:SetResizable(true)
  378. self.textWindow:EnableMouse(true)
  379. end
  380. if(self.db.char.shown) then
  381. TextFrame:Show()
  382. end
  383. end
  384. function addon:ToggleLock()
  385. self.db.char.locked = not self.db.char.locked
  386. if self.db.char.locked then
  387. self.interfaceWindow.buttonLock:SetText("Odemkni okno")
  388. self.textWindow:SetMovable(false)
  389. self.textWindow:SetResizable(false)
  390. self.textWindow:EnableMouse(false)
  391. self.textWindow.dragHandle:Hide()
  392. else
  393. self.interfaceWindow.buttonLock:SetText("Zamkni okno")
  394. self.textWindow:SetMovable(true)
  395. self.textWindow:SetResizable(true)
  396. self.textWindow:EnableMouse(true)
  397. self.textWindow.dragHandle:Show()
  398. end
  399. end
  400. function addon:ToggleShow()
  401. if(self.textWindow:IsShown()) then
  402. self.textWindow:Hide()
  403. self.db.char.shown = false
  404. self.interfaceWindow.buttonShow:SetText("Zobraz okno")
  405. else
  406. self.textWindow:Show()
  407. self.db.char.shown = true
  408. self.interfaceWindow.buttonShow:SetText("Skryj okno")
  409. end
  410. end
  411. function addon:BuildInterfaceWindow()
  412. local interfaceWindow = CreateFrame("Frame", "InterfaceWindow", UIParent)
  413. interfaceWindow.name = s5
  414.  
  415. local title = interfaceWindow:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
  416. title:SetText(s5)
  417. title:SetPoint("TOPLEFT", 20, -20)
  418.  
  419. local backgroundOpacityLabel = interfaceWindow:CreateFontString(nil, "ARTWORK", "GameFontHighlightMedium")
  420. backgroundOpacityLabel:SetText("Viditelnost pozadi:")
  421. backgroundOpacityLabel:SetPoint("TOPLEFT", 25, -60)
  422. backgroundOpacityLabel:SetWidth(backgroundOpacityLabel:GetStringWidth())
  423.  
  424. local fontSizeLabel = interfaceWindow:CreateFontString(nil, "ARTWORK", "GameFontHighlightMedium")
  425. fontSizeLabel:SetText("Velikost pisma:")
  426. fontSizeLabel:SetPoint("TOPLEFT", backgroundOpacityLabel, "BOTTOMLEFT", 0, -30)
  427. fontSizeLabel:SetWidth(fontSizeLabel:GetStringWidth())
  428.  
  429. local alignmentLabel = interfaceWindow:CreateFontString(nil, "ARTWORK", "GameFontHighlightMedium")
  430. alignmentLabel:SetText("Zarovnani textu:")
  431. alignmentLabel:SetWidth(alignmentLabel:GetStringWidth())
  432. alignmentLabel:SetPoint("TOPLEFT", fontSizeLabel, "BOTTOMLEFT", 0, -40) -- trochu vic
  433.  
  434. local radioButton1 = CreateFrame("CheckButton", "RadioButton1", interfaceWindow, "UIRadioButtonTemplate")
  435. radioButton1:SetSize(20, 20)
  436. radioButton1:SetPoint("BOTTOMLEFT", alignmentLabel, "TOPRIGHT", 30, -5)
  437. _G[radioButton1:GetName().."Text"]:SetText("Nahoru")
  438. radioButton1:SetChecked(addon.db.char.alignTop)
  439.  
  440. local radioButton2 = CreateFrame("CheckButton", "RadioButton2", interfaceWindow, "UIRadioButtonTemplate")
  441. radioButton2:SetSize(20, 20)
  442. radioButton2:SetPoint("TOPLEFT", alignmentLabel, "BOTTOMRIGHT", 30, 5)
  443. _G[radioButton2:GetName().."Text"]:SetText("Dolu")
  444. radioButton2:SetChecked(not addon.db.char.alignTop)
  445.  
  446. radioButton1:SetScript("OnClick", function()
  447. addon.db.char.alignTop = true
  448. addon.textWindow.messageFrame:SetInsertMode("top")
  449. radioButton2:SetChecked(false)
  450. addon.textWindow.messageFrame:Clear()
  451. local shownText = addon.db.char.shownText or ""
  452. local text = RecognizeFixPatterns(shownText)
  453. local lines = { strsplit("\n", text) }
  454. local lines_count = #lines
  455. for i = 1, lines_count do
  456. local line = lines[lines_count - i + 1]
  457. if line == "" then line = " " end
  458. addon.textWindow.messageFrame:AddMessage(line)
  459. end
  460. end)
  461. radioButton2:SetScript("OnClick", function()
  462. addon.db.char.alignTop = false
  463. addon.textWindow.messageFrame:SetInsertMode("bottom")
  464. radioButton1:SetChecked(false)
  465. addon.textWindow.messageFrame:Clear()
  466. local shownText = addon.db.char.shownText or ""
  467. local text = RecognizeFixPatterns(shownText)
  468. local lines = { strsplit("\n", text) }
  469. local lines_count = #lines
  470. for i = 1, lines_count do
  471. local line = lines[i]
  472. if line == "" then line = " " end
  473. addon.textWindow.messageFrame:AddMessage(line)
  474. end
  475. end)
  476.  
  477. local toggleWindowBtn = CreateFrame("Button", nil, interfaceWindow, "UIPanelButtonTemplate")
  478. if(self.textWindow:IsShown()) then
  479. toggleWindowBtn:SetText("Skryj okno")
  480. else
  481. toggleWindowBtn:SetText("Zobraz okno")
  482. end
  483. toggleWindowBtn:SetSize(toggleWindowBtn:GetTextWidth()+40, toggleWindowBtn:GetTextHeight()+20)
  484. toggleWindowBtn:SetPoint("TOPLEFT", alignmentLabel, "BOTTOMLEFT", 0, -30)
  485. toggleWindowBtn:SetScript("OnClick", function(self, button, down)
  486. if(addon.textWindow:IsShown()) then
  487. addon.textWindow:Hide()
  488. addon.db.char.shown = false
  489. toggleWindowBtn:SetText("Zobraz okno")
  490. else
  491. addon.textWindow:Show()
  492. addon.db.char.shown = true
  493. toggleWindowBtn:SetText("Skryj okno")
  494. end        
  495. end)
  496.  
  497. local lockWindowBtn = CreateFrame("Button", nil, interfaceWindow, "UIPanelButtonTemplate")
  498. if self.db.char.locked then
  499. lockWindowBtn:SetText("Odemkni okno")
  500. else
  501. lockWindowBtn:SetText("Zamkni okno")
  502. end
  503. lockWindowBtn:SetSize(lockWindowBtn:GetTextWidth()+40, lockWindowBtn:GetTextHeight()+20)
  504. lockWindowBtn:SetPoint("TOPLEFT", toggleWindowBtn, "TOPRIGHT", 60, 0)
  505. lockWindowBtn:SetScript("OnClick", function(self, button, down)
  506. addon:ToggleLock()
  507. end)
  508.  
  509. local editPageBtn = CreateFrame("Button", nil, interfaceWindow, "UIPanelButtonTemplate")
  510. editPageBtn:SetText("Edituj stranku")
  511. editPageBtn:SetSize(editPageBtn:GetTextWidth()+40, editPageBtn:GetTextHeight()+20)
  512. editPageBtn:SetPoint("TOPLEFT", lockWindowBtn, "TOPRIGHT", 60, 0)
  513. editPageBtn:SetScript("OnClick", function(self, button, down)
  514. if(IsInRaid() and (IsRaidLeader() or IsRaidOfficer())) then
  515. addon:ShowEditWindow()
  516. else
  517. addon:Print("Nemas dostatecna prava")
  518. end
  519. end)
  520.  
  521. local sizeSliderName = "SizeSlider"
  522. local sizeSlider = CreateFrame("Slider", sizeSliderName, interfaceWindow, "OptionsSliderTemplate")
  523. sizeSlider:SetPoint("TOPLEFT", fontSizeLabel, "TOPRIGHT", 60, 0)
  524. sizeSlider.textLow = _G[sizeSliderName.."Low"]
  525. sizeSlider.textHigh = _G[sizeSliderName.."High"]
  526. sizeSlider.text = _G[sizeSliderName.."Text"]
  527. sizeSlider:SetMinMaxValues(12, 20)
  528. sizeSlider.minValue, sizeSlider.maxValue = sizeSlider:GetMinMaxValues()
  529. sizeSlider:SetValue(self.db.char.fontSize)
  530. sizeSlider:SetValueStep(1)
  531. sizeSlider.textLow:SetText(sizeSlider.minValue)
  532. sizeSlider.textHigh:SetText(sizeSlider.maxValue)
  533. sizeSlider.text:SetText(sizeSlider:GetValue())
  534. sizeSlider:SetScript("OnValueChanged", function(self,value)
  535. self.text:SetText(value)
  536. addon.textWindow.messageFrame:SetFont(addon.defaultFont, value, nil)
  537. addon.db.char.fontSize = value
  538. end)
  539.  
  540. local opacitySliderName = "OpacitySlider"
  541. local opacitySlider = CreateFrame("Slider", opacitySliderName, interfaceWindow, "OptionsSliderTemplate")
  542. opacitySlider:SetPoint("TOPLEFT", backgroundOpacityLabel, "TOPRIGHT", 60, 0)
  543. opacitySlider.textLow = _G[opacitySliderName.."Low"]
  544. opacitySlider.textHigh = _G[opacitySliderName.."High"]
  545. opacitySlider.text = _G[opacitySliderName.."Text"]
  546. opacitySlider:SetMinMaxValues(0, 100)
  547. opacitySlider.minValue, opacitySlider.maxValue = opacitySlider:GetMinMaxValues()
  548. opacitySlider:SetValue(self.db.char.opacity*100)
  549. opacitySlider:SetValueStep(1)
  550. opacitySlider.textLow:SetText(opacitySlider.minValue.."%")
  551. opacitySlider.textHigh:SetText(opacitySlider.maxValue.."%")
  552. opacitySlider.text:SetText(opacitySlider:GetValue().."%")
  553. opacitySlider:SetScript("OnValueChanged", function(self,value)
  554. self.text:SetText(value.."%")
  555. addon.textWindow.bg:SetTexture(0, 0, 0, value/100)
  556. addon.db.char.opacity = value/100
  557. end)
  558.  
  559. interfaceWindow.buttonShow = toggleWindowBtn
  560. interfaceWindow.buttonLock = lockWindowBtn
  561. interfaceWindow.buttonEdit = editPageBtn
  562. addon.interfaceWindow = interfaceWindow
  563. InterfaceOptions_AddCategory(interfaceWindow)
  564. end
  565. function addon:BuildEditWindow()
  566. local editWindow = CreateFrame("Frame", "EditPageWindow", UIParent)
  567. editWindow:Hide()
  568. editWindow:SetBackdrop({
  569. bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
  570. edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
  571. tile = true, tileSize = 32, edgeSize = 32,
  572. insets = { left = 8, right = 8, top = 8, bottom = 8 }
  573. })
  574. editWindow:SetSize(610, 380)
  575. editWindow:SetMovable(true)
  576. editWindow:EnableMouse(true)
  577. editWindow:SetFrameStrata("HIGH")
  578. editWindow:SetToplevel(true)
  579. editWindow:SetPoint("CENTER", 0, 0)
  580. editWindow:SetScript("OnMouseDown", function(self, button)
  581. self:StartMoving()
  582. end)
  583. editWindow:SetScript("OnMouseUp", function(self, button) self:StopMovingOrSizing() end)
  584. editWindow:SetScript("OnHide", function(self)
  585. addon:RevertChanges()
  586. if addon.pageSelectToggle then
  587. addon.pageWindow:Hide()
  588. addon.pageSelectToggle = false
  589. end
  590. addon.previewToggle = false
  591. addon.editWindow.buttonPreview:SetButtonState("NORMAL")
  592. addon.textWindow.messageFrame:Clear()
  593. local shownText = addon.db.char.shownText or ""
  594. local text = RecognizeFixPatterns(shownText)
  595. local lines = { strsplit("\n", text) }
  596. local lines_count = #lines
  597. for i = 1, lines_count do
  598. local line
  599. if(addon.db.char.alignTop) then
  600. line = lines[lines_count - i + 1]
  601. else
  602. line = lines[i]
  603. end
  604. if line == "" then line = " " end
  605. addon.textWindow.messageFrame:AddMessage(line)
  606. end
  607. end)
  608. tinsert(UISpecialFrames, "EditPageWindow")
  609. local titlebg = editWindow:CreateTexture(nil, "OVERLAY")
  610. titlebg:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
  611. titlebg:SetTexCoord(0.31, 0.67, 0, 0.63)
  612. titlebg:SetPoint("TOP", 0, 12)
  613. titlebg:SetWidth(100)
  614. titlebg:SetHeight(40)
  615. local title = CreateFrame("Frame", nil, editWindow)
  616. title:EnableMouse(true)
  617. title:SetScript("OnMouseDown", function(self, button) self:GetParent():StartMoving() end)
  618. title:SetScript("OnMouseUp", function(self, button) self:GetParent():StopMovingOrSizing() end)
  619. title:SetAllPoints(titlebg)
  620. local titletext = title:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  621. titletext:SetPoint("TOP", titlebg, "TOP", 0, -14)
  622. titletext:SetText("Edituj stranku")
  623. local titlebg_l = editWindow:CreateTexture(nil, "OVERLAY")
  624. titlebg_l:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
  625. titlebg_l:SetTexCoord(0.21, 0.31, 0, 0.63)
  626. titlebg_l:SetPoint("RIGHT", titlebg, "LEFT")
  627. titlebg_l:SetWidth(30)
  628. titlebg_l:SetHeight(40)
  629. local titlebg_r = editWindow:CreateTexture(nil, "OVERLAY")
  630. titlebg_r:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
  631. titlebg_r:SetTexCoord(0.67, 0.77, 0, 0.63)
  632. titlebg_r:SetPoint("LEFT", titlebg, "RIGHT")
  633. titlebg_r:SetWidth(30)
  634. titlebg_r:SetHeight(40)
  635. local toolboxLabel = editWindow:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
  636. toolboxLabel:SetText("Toolbox")
  637. toolboxLabel:SetPoint("TOPLEFT", 20, -30)
  638. local pageLabel = editWindow:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
  639. pageLabel:SetText("Stranka")
  640. pageLabel:SetPoint("TOPLEFT", 185, -30)
  641. local pageName = editWindow:CreateFontString(nil, "ARTWORK", "GameFontWhiteSmall")
  642. pageName:SetText((self.selectedPage and pgs[self.selectedPage].Name) or "")
  643. pageName:SetPoint("BOTTOMLEFT", pageLabel, "BOTTOMRIGHT", 4, 0)
  644. local statusTextLabel = editWindow:CreateFontString(nil, "ARTWORK", "GameFontWhite")
  645. statusTextLabel:SetText("Stranka |cff00ff00je |rulozena")
  646. statusTextLabel:SetPoint("TOPRIGHT", -50, -30)
  647. local buttonData = {
  648. { text = "|credCervena",        size = {77,26}, anchorPoint = {"TOPLEFT", 22, -50},     altText = "|cred"},
  649. { text = "|corange Oranzova",   size = {77,26}, anchorPoint = {"TOPLEFT", 102, -50},    altText = "|corange"},
  650. { text = "|cyellowZluta",       size = {77,26}, anchorPoint = {"TOPLEFT", 22, -80},     altText = "|cyellow"},
  651. { text = "|cgreenZelena",       size = {77,26}, anchorPoint = {"TOPLEFT", 102, -80},    altText = "|cgreen"},
  652. { text = "|cblueModra",         size = {77,26}, anchorPoint = {"TOPLEFT", 22, -110},    altText = "|cblue"},
  653. { text = "|cpurpleFialova",     size = {77,26}, anchorPoint = {"TOPLEFT", 102, -110},   altText = "|cpurple"},
  654. { text = "|cpinkRuzova",        size = {77,26}, anchorPoint = {"TOPLEFT", 22, -140},    altText = "|cpink"},
  655. { text = "|cwhiteBila",         size = {77,26}, anchorPoint = {"TOPLEFT", 102, -140},   altText = "|cwhite"},
  656. { text = " {star}",     size = {26,26}, anchorPoint = {"TOPLEFT", 22, -170}},
  657. { text = " {circle}",   size = {26,26}, anchorPoint = {"TOPLEFT", 54, -170}},
  658. { text = " {diamond}",  size = {26,26}, anchorPoint = {"TOPLEFT", 86, -170}},
  659. { text = " {triangle}", size = {26,26}, anchorPoint = {"TOPLEFT", 118, -170}},
  660. { text = " {moon}",     size = {26,26}, anchorPoint = {"TOPLEFT", 150, -170}},
  661. { text = " {square}",   size = {26,26}, anchorPoint = {"TOPLEFT", 22, -200}},
  662. { text = " {cross}",    size = {26,26}, anchorPoint = {"TOPLEFT", 54, -200}},
  663. { text = " {skull}",    size = {26,26}, anchorPoint = {"TOPLEFT", 86, -200}},
  664. { text = " {healthstone}",  size = {26,26}, anchorPoint = {"TOPLEFT", 118, -200}},
  665. { text = " {bloodlust}",    size = {26,26}, anchorPoint = {"TOPLEFT", 150, -200}},
  666. { text = " {damage}",       size = {26,26}, anchorPoint = {"TOPLEFT", 22, -230}},
  667. { text = " {tank}",         size = {26,26}, anchorPoint = {"TOPLEFT", 54, -230}},
  668. { text = " {healer}",       size = {26,26}, anchorPoint = {"TOPLEFT", 86, -230}},
  669. { text = " {hunter}",       size = {26,26}, anchorPoint = {"TOPLEFT", 118, -230}},
  670. { text = " {warrior}",      size = {26,26}, anchorPoint = {"TOPLEFT", 150, -230}},
  671. { text = " {rogue}",        size = {26,26}, anchorPoint = {"TOPLEFT", 22, -260}},
  672. { text = " {mage}",         size = {26,26}, anchorPoint = {"TOPLEFT", 54, -260}},
  673. { text = " {priest}",       size = {26,26}, anchorPoint = {"TOPLEFT", 86, -260}},
  674. { text = " {warlock}",      size = {26,26}, anchorPoint = {"TOPLEFT", 118, -260}},
  675. { text = " {druid}",        size = {26,26}, anchorPoint = {"TOPLEFT", 150, -260}},
  676. { text = " {paladin}",      size = {26,26}, anchorPoint = {"TOPLEFT", 22, -290}},
  677. { text = " {deathknight}",  size = {26,26}, anchorPoint = {"TOPLEFT", 54, -290}},
  678. { text = " {shaman}",       size = {26,26}, anchorPoint = {"TOPLEFT", 86, -290}},
  679. }
  680. for i, obj in ipairs(buttonData) do
  681. self:CreateToolboxButton(editWindow, obj.text, obj.size, obj.anchorPoint, obj.altText or nil)
  682. end
  683. local togglePagesButton = CreateFrame("Button", nil, editWindow)
  684. togglePagesButton:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Up.blp")
  685. togglePagesButton:SetPushedTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Down.blp")   
  686. togglePagesButton:SetHighlightTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Highlight.blp")
  687. togglePagesButton:SetWidth(30)
  688. togglePagesButton:SetHeight(30)
  689. togglePagesButton:SetPoint("BOTTOMLEFT", 15, 18)
  690. togglePagesButton:SetScript("OnClick", function(self, button, down)
  691. addon:TogglePagesButtonClick()
  692. end)
  693. local acceptButton = CreateFrame("Button", nil, editWindow, "UIPanelButtonTemplate")
  694. acceptButton:SetText("Ulozit zmeny")
  695. acceptButton:SetSize(acceptButton:GetTextWidth()+40, acceptButton:GetTextHeight()+20)
  696. acceptButton:SetPoint("TOPLEFT", togglePagesButton, "TOPRIGHT", 5, 0)
  697. acceptButton:SetScript("OnClick", function(self, button, down)
  698. addon:AcceptButtonClick()
  699. end)
  700. local revertButton = CreateFrame("Button", nil, editWindow, "UIPanelButtonTemplate")
  701. revertButton:SetText("Vratit zmeny")
  702. revertButton:SetSize(revertButton:GetTextWidth()+40, revertButton:GetTextHeight()+20)
  703. revertButton:SetPoint("TOPLEFT", acceptButton, "TOPRIGHT", 0, 0)
  704. revertButton:SetScript("OnClick", function(self, button, down)
  705. addon.RevertButtonClick()
  706. end)
  707. local previewButton = CreateFrame("Button", nil, editWindow, "UIPanelButtonTemplate")
  708. previewButton:SetText("Nahled")
  709. previewButton:SetSize(previewButton:GetTextWidth()+40, previewButton:GetTextHeight()+20)
  710. previewButton:SetPoint("TOPLEFT", revertButton, "TOPRIGHT", 5, 0)
  711. previewButton:SetScript("OnClick", function(self, button, down)
  712. addon:PreviewButtonClick()
  713. end)
  714. local sendButton = CreateFrame("Button", nil, editWindow, "UIPanelButtonTemplate")
  715. sendButton:SetText("Ulozit a poslat")
  716. sendButton:SetSize(sendButton:GetTextWidth()+40, sendButton:GetTextHeight()+20)
  717. sendButton:SetPoint("TOPLEFT", previewButton, "TOPRIGHT", 5, 0)
  718. sendButton:SetScript("OnClick", function(self, button, down)
  719. if(IsInRaid() and (IsRaidLeader() or IsRaidOfficer())) then
  720. addon:SendButtonClick()
  721. else
  722. addon:Print("Nemas dostatecna prava")
  723. end
  724. end)
  725. local closeButton = CreateFrame("Button", nil, editWindow, "UIPanelButtonTemplate")
  726. closeButton:SetText("Zavrit")
  727. closeButton:SetSize(closeButton:GetTextWidth()+40, closeButton:GetTextHeight()+20)
  728. closeButton:SetPoint("TOPLEFT", sendButton, "TOPRIGHT", 5, 0)
  729. closeButton:SetScript("OnClick", function(self, button, down)
  730. editWindow:Hide()
  731. end)
  732. local editFrame = CreateFrame("Frame", "EditFrameContainer", editWindow)
  733. editFrame:SetSize(380, 270)
  734. editFrame:SetPoint("TOPLEFT", pageLabel, "BOTTOMLEFT", 8, -5)
  735. editFrame:SetBackdrop({
  736. bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
  737. edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  738. edgeSize = 16,
  739. insets = { left = 4, right = 3, top = 4, bottom = 3 }
  740. })
  741. editFrame:SetBackdropColor(0, 0, 0)
  742. editFrame:SetBackdropBorderColor(0.4, 0.4, 0.4)
  743. local editBox = CreateFrame("EditBox", "EditPageEditBox", editFrame)
  744. editBox:SetMultiLine(true)
  745. editBox:SetAutoFocus(false)
  746. editBox:EnableMouse(true)
  747. editBox:SetFont(self.defaultFont, 16, nil)
  748. editBox:SetWidth(370)
  749. editBox:SetHeight(270)
  750. editBox:SetScript("OnEscapePressed", editBox.ClearFocus)
  751. editBox:SetScript("OnTextChanged", EditBox_TextChanged)
  752. local scrollFrame = CreateFrame("ScrollFrame", "EditPageScrollFrame", editFrame, "UIPanelScrollFrameTemplate")
  753. scrollFrame:SetPoint("TOPLEFT", 8, -8)
  754. scrollFrame:SetPoint("BOTTOMRIGHT", -8, 8)
  755. scrollFrame:SetScrollChild(editBox)
  756. local scrollBar = _G[scrollFrame:GetName().."ScrollBar"]
  757. scrollBar.bg = scrollBar:CreateTexture(nil, "BACKGROUND")
  758. scrollBar.bg:SetAllPoints(true)
  759. scrollBar.bg:SetTexture(0, 0, 0, 0.5)
  760. editBox:SetFocus()
  761. editWindow.statusText = statusTextLabel
  762. editWindow.editBox = editBox
  763. editWindow.buttonAccept = acceptButton
  764. editWindow.buttonRevert = revertButton
  765. editWindow.buttonSend = sendButton
  766. editWindow.buttonPreview = previewButton
  767. editWindow.buttonTogglePages = togglePagesButton
  768. editWindow.buttonClose = closeButton
  769. editWindow.pageNameLabel = pageName
  770. addon.editWindow = editWindow
  771. end
  772. function addon:RevertChanges()
  773. if not self.selectedPage then return end
  774. if not pgs[self.selectedPage].Content then self:Print("Neexistuje zadna zaloha k vraceni") return end
  775. self:DisplayPageInEditBox()
  776. end
  777. function addon:AcceptChanges()
  778. local text = self.editWindow.editBox:GetText()
  779. if not text then text = "" end
  780. pgs[self.selectedPage].Content = text
  781. self.editWindow.statusText:SetText("Stranka |cff00ff00je |rulozena")
  782. end
  783. function addon:UpdateEditWindow()
  784. if(self.db.char.numPages == 0) then
  785. if self.editWindowEnabled then
  786. self:EnableDisableEditWindow(false)
  787. end
  788. self.editWindow.buttonTogglePages:Enable()
  789. self.editWindow.buttonClose:Enable()
  790. return
  791. else
  792. if not self.editWindowEnabled then
  793. self:EnableDisableEditWindow(true)
  794. end
  795. end
  796. if(self.previewToggle) then
  797. self.editWindow.buttonAccept:Disable()
  798. self.editWindow.buttonRevert:Disable()
  799. self.editWindow.buttonSend:Disable()
  800. self:EnableDisablePageWindow(false)
  801. return
  802. end
  803. if not self.selectedPage then
  804. self:EnableDisableEditWindow(false)
  805. self.editWindow.buttonTogglePages:Enable()
  806. self.editWindow.buttonClose:Enable()
  807. return
  808. end
  809. if(self.selectedPage and (self.editWindow.editBox:GetText() == pgs[self.selectedPage].Content)) then
  810. if not self.previewToggle then
  811. if not self.pageWindowEnabled then  
  812. self:EnableDisablePageWindow(true)
  813. end
  814. self.editWindow.buttonAccept:Disable()
  815. self.editWindow.buttonRevert:Disable()
  816. self.editWindow.buttonSend:Enable()
  817. self.editWindow.statusText:SetText("Stranka |cff00ff00je |rulozena")
  818. end
  819. return
  820. end
  821. if(self.selectedPage and (self.editWindow.editBox:GetText() ~= pgs[self.selectedPage].Content)) then
  822. if not self.previewToggle then
  823. if not self.pageWindowEnabled then  
  824. self:EnableDisablePageWindow(true)
  825. end
  826. self:EnableDisablePageWindow(true)
  827. self.editWindow.buttonAccept:Enable()
  828. self.editWindow.buttonRevert:Enable()
  829. self.editWindow.buttonSend:Enable()
  830. self.editWindow.statusText:SetText("Stranka |cffff0000neni |rulozena")
  831. end
  832. return
  833. end
  834. end
  835. function addon:AfterEnable()
  836. self:RegisterChatCommand("ga", "ProcessSlashCommand")
  837. addon.db = LibStub("AceDB-3.0"):New(s4, defaultSettings, true)
  838. StaticPopupDialogs["REVERT_CONFIRM"] = {
  839. text = "Opravdu chcete obnovit posledni zalohu?",
  840. button1 = "Ano",
  841. button2 = "Ne",
  842. OnShow = function()
  843. addon:EnableDisableEditWindow(false)
  844. addon:EnableDisablePageWindow(false)
  845. end,
  846. OnHide = function()
  847. addon:EnableDisableEditWindow(true)
  848. addon:EnableDisablePageWindow(true)
  849. end,
  850. OnAccept = function()
  851. self:RevertChanges()
  852. self:UpdateEditWindow()
  853. end,
  854. timeout = 0,
  855. whileDead = true,
  856. hideOnEscape = true,
  857. preferredIndex = 3,
  858. }
  859. StaticPopupDialogs["UNSAVED_PAGE_CHANGE"] = {
  860. text = "Chcete pred zmenou stranky predchozi stranku ulozit?",
  861. button1 = "Ano",
  862. button2 = "Ne",
  863. OnShow = function()
  864. addon:EnableDisableEditWindow(false)
  865. addon:EnableDisablePageWindow(false)
  866. end,
  867. OnHide = function()
  868. addon:EnableDisableEditWindow(true)
  869. addon:EnableDisablePageWindow(true)
  870. end,
  871. OnAccept = function(self)
  872. addon:AcceptChanges()
  873. addon.selectedPage = self.button.value
  874. self.button.selected = true
  875. self.button:LockHighlight()
  876. for _, otherButton in pairs(addon.buttons) do
  877. if(self.button ~= otherButton) then
  878. otherButton.selected = false
  879. otherButton:UnlockHighlight()
  880. end
  881. end
  882. addon.editWindow.pageNameLabel:SetText(pgs[self.button.value].Name .. "(" .. pgs[self.button.value].Author .. ")")
  883. addon:DisplayPageInEditBox()
  884. addon:UpdateEditWindow()
  885. end,
  886. OnCancel = function(self)
  887. addon.selectedPage = self.button.value
  888. self.button.selected = true
  889. self.button:LockHighlight()
  890. for _, otherButton in pairs(addon.buttons) do
  891. if(self.button ~= otherButton) then
  892. otherButton.selected = false
  893. otherButton:UnlockHighlight()
  894. end
  895. end
  896. addon.editWindow.pageNameLabel:SetText(pgs[self.button.value].Name .. "(" .. pgs[self.button.value].Author .. ")")
  897. addon:DisplayPageInEditBox()
  898. addon:UpdateEditWindow()
  899. end,
  900. timeout = 0,
  901. whileDead = true,
  902. hideOnEscape = true,
  903. preferredIndex = 3,
  904. }
  905. StaticPopupDialogs["ADD_PAGE"] = {
  906. button1 = OKAY,
  907. button2 = CANCEL,
  908. OnShow = function()
  909. addon:EnableDisableEditWindow(false)
  910. addon:EnableDisablePageWindow(false)
  911. end,
  912. OnHide = function()
  913. addon:EnableDisableEditWindow(true)
  914. addon:EnableDisablePageWindow(true)
  915. end,
  916. OnAccept = function(self)
  917. local text = self.editBox:GetText()
  918. if text ~= "" then addon:AddPage(text) end
  919. end,
  920. EditBoxOnEnterPressed = function(self)
  921. local text = self:GetParent().editBox:GetText()
  922. if text ~= "" then addon:AddPage(text) end
  923. self:GetParent():Hide()
  924. end,
  925. text = "Zadejte jmeno stranky: ",
  926. hasEditBox = true,
  927. whileDead = true,
  928. EditBoxOnEscapePressed = function(self) self:GetParent():Hide() end,
  929. hideOnEscape = true,
  930. timeout = 0,
  931. preferredIndex = 3
  932. }
  933. StaticPopupDialogs["RENAME_PAGE"] = {
  934. button1 = OKAY,
  935. button2 = CANCEL,
  936. OnShow = function()
  937. addon:EnableDisableEditWindow(false)
  938. addon:EnableDisablePageWindow(false)
  939. end,
  940. OnHide = function()
  941. addon:EnableDisableEditWindow(true)
  942. addon:EnableDisablePageWindow(true)
  943. end,
  944. OnAccept = function(self)
  945. local text = self.editBox:GetText()
  946. if text ~= "" then addon:RenameSelectedPage(text) end
  947. end,
  948. EditBoxOnEnterPressed = function(self)
  949. local text = self:GetParent().editBox:GetText()
  950. if text ~= "" then addon:RenameSelectedPage(text) end
  951. self:GetParent():Hide()
  952. end,
  953. text = "Zadejte nove jmeno stranky: ",
  954. hasEditBox = true,
  955. whileDead = true,
  956. EditBoxOnEscapePressed = function(self) self:GetParent():Hide() end,
  957. hideOnEscape = true,
  958. timeout = 0,
  959. preferredIndex = 3
  960. }
  961. StaticPopupDialogs["REMOVE_PAGE"] = {
  962. text = "Smazat vybranou stranku?",
  963. button1 = OKAY,
  964. button2 = CANCEL,
  965. OnShow = function()
  966. addon:EnableDisableEditWindow(false)
  967. addon:EnableDisablePageWindow(false)
  968. end,
  969. OnHide = function()
  970. addon:EnableDisableEditWindow(true)
  971. addon:EnableDisablePageWindow(true)
  972. end,
  973. OnAccept = function()
  974. self:RemoveSelectedPage()
  975. end,
  976. timeout = 0,
  977. whileDead = true,
  978. hideOnEscape = true,
  979. preferredIndex = 3,
  980. }
  981. StaticPopupDialogs["RESET_PAGES"] = {
  982. text = "Opravdu chcete smazat vsechny stranky?",
  983. button1 = OKAY,
  984. button2 = CANCEL,
  985. OnShow = function()
  986. addon:EnableDisableEditWindow(false)
  987. addon:EnableDisablePageWindow(false)
  988. end,
  989. OnHide = function()
  990. addon:EnableDisableEditWindow(true)
  991. addon:EnableDisablePageWindow(true)
  992. end,
  993. OnAccept = function(self)
  994. addon.db.char.pages = {}
  995. addon.db.char.numPages = 0
  996. addon.db.char.shownText = nil
  997. addon.selectedPage = nil
  998. pgs = addon.db.char.pages
  999. addon.textWindow.messageFrame:Clear()
  1000. addon:RenderTree()
  1001. addon:Print("Stranky smazany")
  1002. end,
  1003. timeout = 0,
  1004. whileDead = true,
  1005. hideOnEscape = true,
  1006. preferredIndex = 3
  1007. }
  1008. pgs = self.db.char.pages
  1009. self:RegisterComm(self.addonPrefix, "ReceiveMessage")
  1010. self:RegisterEvent("RAID_ROSTER_UPDATE")
  1011. self:RegisterEvent("PLAYER_GUILD_UPDATE")
  1012. self:BuildTextWindow()
  1013. self:BuildInterfaceWindow()
  1014. self:BuildEditWindow()
  1015. self:BuildTreeWindow()
  1016. self:CheckPermissions()
  1017. if self.db.char.shownText then
  1018. self.textWindow.messageFrame:Clear()
  1019. local text = RecognizeFixPatterns(self.db.char.shownText)
  1020. local lines = { strsplit("\n", text) }
  1021. local lines_count = #lines
  1022. for i = 1, lines_count do
  1023. local line
  1024. if(addon.db.char.alignTop) then
  1025. line = lines[lines_count - i + 1]
  1026. else
  1027. line = lines[i]
  1028. end
  1029. if line == "" then line = " " end
  1030. self.textWindow.messageFrame:AddMessage(line)
  1031. end
  1032. end
  1033. end
  1034. function addon:ShowEditWindow()
  1035. self.editWindow:Show()
  1036. self:RenderTree()
  1037. self:UpdateEditWindow()
  1038. end
  1039. function addon:CreateToolboxButton(frame, showText, size, anchorPoint, text)
  1040. local button = CreateFrame("Button", nil, frame)
  1041. button:SetBackdrop({
  1042. edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  1043. edgeSize = 8
  1044. })
  1045. button:SetBackdropBorderColor(1, 1, 1, 0.5)
  1046. button:SetPushedTextOffset(1, -1)
  1047. button:SetText(RecognizeFixPatterns(showText))
  1048. button:SetSize(unpack(size))
  1049. button:SetNormalFontObject(GameFontHighlightMedium)
  1050. button:SetPoint(unpack(anchorPoint))
  1051. button:SetScript("OnClick", function(self, button)
  1052. local fixedText
  1053. if text then
  1054. fixedText = text
  1055. else
  1056. fixedText = showText:gsub(" {", "{")
  1057. end
  1058. addon.editWindow.editBox:Insert(fixedText)
  1059. end)
  1060. end
  1061. local test = GetGuildInfo
  1062. function TextFrame_OnMouseDown(self, button)
  1063. if not addon.db.char.locked then
  1064. if(button == "LeftButton") then
  1065. self:StartMoving()
  1066. self.isMoving = true
  1067. end
  1068. end
  1069. end
  1070. function TextFrame_OnMouseUp(self, button)
  1071. if not addon.db.char.locked then
  1072. if self.isMoving then
  1073. self:StopMovingOrSizing()
  1074. self.isMoving = false
  1075. lwin.SavePosition(self)
  1076. end
  1077. end
  1078. end
  1079. function TextFrame_DragDown(self, button)
  1080. local par = self:GetParent()
  1081. par:StartSizing()
  1082. par.isMoving = true
  1083. end
  1084. function TextFrame_DragUp(self, button)
  1085. local par = self:GetParent()
  1086. if par.isMoving then
  1087. par:StopMovingOrSizing()
  1088. par.isMoving = false
  1089. addon.db.char.windowWidth = par:GetWidth()
  1090. addon.db.char.windowHeight = par:GetHeight()
  1091. lwin.SavePosition(par)
  1092. end
  1093. end
  1094. function EditBox_TextChanged(self, userInput)
  1095. if not addon.selectedPage then return end
  1096. if(addon.editWindow.editBox:GetText() == pgs[addon.selectedPage].Content) then
  1097. addon.editWindow.buttonAccept:Disable()
  1098. addon.editWindow.buttonRevert:Disable()
  1099. addon.editWindow.statusText:SetText("Stranka |cff00ff00je |rulozena")
  1100. return
  1101. end
  1102. if addon.previewToggle then
  1103. addon.textWindow.messageFrame:Clear()
  1104. local rawText = addon.editWindow.editBox:GetText()
  1105. local text = RecognizeFixPatterns(rawText)
  1106. local lines = { strsplit("\n", text) }
  1107. local lines_count = #lines
  1108. for i = 1, lines_count do
  1109. local line
  1110. if(addon.db.char.alignTop) then
  1111. line = lines[lines_count - i + 1]
  1112. else
  1113. line = lines[i]
  1114. end
  1115. if line == "" then line = " " end
  1116. addon.textWindow.messageFrame:AddMessage(line)
  1117. end
  1118. else   
  1119. if(not addon.editWindow.buttonAccept:IsEnabled()) then addon.editWindow.buttonAccept:Enable() end
  1120. if(not addon.editWindow.buttonRevert:IsEnabled()) then addon.editWindow.buttonRevert:Enable() end
  1121. end
  1122. addon.editWindow.statusText:SetText("Stranka |cffff0000neni |rulozena")
  1123. end
  1124. function addon:OnEnable()
  1125. self:RegisterEvent("GUILD_ROSTER_UPDATE")
  1126. local isInGuild = IsInGuild()
  1127. if(isInGuild == 1) then
  1128. GuildRoster()
  1129. else
  1130. return
  1131. end
  1132. end
  1133. function addon:TogglePagesButtonClick()
  1134. if not self.pageSelectToggle then
  1135. self.editWindow.buttonTogglePages:SetButtonState("PUSHED", true)
  1136. self.pageWindow:ClearAllPoints()
  1137. self.pageWindow:SetPoint("TOPRIGHT", self.editWindow, "TOPLEFT", 5, 0)
  1138. self:RenderTree()
  1139. self.pageWindow:Show()
  1140. else
  1141. self.editWindow.buttonTogglePages:SetButtonState("NORMAL")
  1142. self.pageWindow:Hide()
  1143. end
  1144. self.pageSelectToggle = not self.pageSelectToggle
  1145. end
  1146. function addon:AcceptButtonClick()
  1147. self:AcceptChanges()
  1148. self:UpdateEditWindow()
  1149. end
  1150. function addon:RevertButtonClick()
  1151. StaticPopup_Show("REVERT_CONFIRM")
  1152. end
  1153. function addon:PreviewButtonClick()
  1154. if not self.previewToggle then
  1155. self.editWindow.buttonPreview:SetButtonState("PUSHED", true)
  1156. self.textWindow.messageFrame:Clear()
  1157. local rawText = self.editWindow.editBox:GetText()
  1158. local text = RecognizeFixPatterns(rawText)
  1159. local lines = { strsplit("\n", text) }
  1160. local lines_count = #lines
  1161. for i = 1, lines_count do
  1162. local line
  1163. if(addon.db.char.alignTop) then
  1164. line = lines[lines_count - i + 1]
  1165. else
  1166. line = lines[i]
  1167. end
  1168. if line == "" then line = " " end
  1169. self.textWindow.messageFrame:AddMessage(line)
  1170. end
  1171. else
  1172. self.editWindow.buttonPreview:SetButtonState("NORMAL")
  1173. self.textWindow.messageFrame:Clear()
  1174. local shownText = self.db.char.shownText or ""
  1175. local text = RecognizeFixPatterns(shownText)
  1176. local lines = { strsplit("\n", text) }
  1177. local lines_count = #lines
  1178. for i = 1, lines_count do
  1179. local line
  1180. if(addon.db.char.alignTop) then
  1181. line = lines[lines_count - i + 1]
  1182. else
  1183. line = lines[i]
  1184. end
  1185. if line == "" then line = " " end
  1186. self.textWindow.messageFrame:AddMessage(line)
  1187. end
  1188. end
  1189. self.previewToggle = not self.previewToggle
  1190. self:UpdateEditWindow()
  1191. end
  1192. function addon:SendButtonClick()
  1193. self:AcceptChanges()
  1194. self:UpdateEditWindow()
  1195. if(not self.textWindow:IsShown()) then
  1196. self.textWindow:Show()
  1197. self.db.char.shown = true
  1198. self.interfaceWindow.buttonShow:SetText("Skryj okno")
  1199. end
  1200. self:DisplayPageInTextWindow()
  1201. self:SendPage(self.selectedPage)
  1202. end
  1203. function addon:RAID_ROSTER_UPDATE()
  1204. self:CheckPermissions()
  1205. if(IsInRaid()) then
  1206. if(not self.justJoinedRaid) then
  1207. self.justJoinedRaid = true
  1208. if(not self.textWindow:IsShown()) then
  1209. self.textWindow:Show()
  1210. end
  1211. end
  1212. else
  1213. if(self.justJoinedRaid) then
  1214. self.justJoinedRaid = false
  1215. if(self.textWindow:IsShown()) then
  1216. self.textWindow:Hide()
  1217. end
  1218. end    
  1219. end
  1220. end
  1221. function addon:PLAYER_GUILD_UPDATE()
  1222. local isInGuild = IsInGuild()
  1223. local x, _, _ = test("player")
  1224. local s = s3
  1225. if(not (isInGuild == 1 and x == s)) then
  1226. self:DestroyEvidence()
  1227. end
  1228. end
  1229. function addon:GUILD_ROSTER_UPDATE()
  1230. self:UnregisterEvent("GUILD_ROSTER_UPDATE")
  1231. local x, _, _ = test("player")
  1232. local s = s3
  1233. if(x ~= s) then return else ae() end
  1234. end
  1235. function addon:CheckPermissions()
  1236. local permission = IsInRaid() and (IsRaidLeader() or IsRaidOfficer())
  1237. if permission then
  1238. self.editWindow.buttonSend:Enable()
  1239. self.interfaceWindow.buttonEdit:Enable()
  1240. else
  1241. if(self.editWindow:IsShown()) then
  1242. self:AcceptChanges()
  1243. self.editWindow:Hide()
  1244. end
  1245. self.editWindow.buttonSend:Disable()
  1246. self.interfaceWindow.buttonEdit:Disable()
  1247. end
  1248. return permission
  1249. end
  1250. function addon:ProcessSlashCommand(input)
  1251. local function PrintCommand(cmd, desc)
  1252. print(string.format(' - |cFF33FF99%s|r: %s', cmd, desc))
  1253. end
  1254. if not input or input:trim() == "" then
  1255. self:ToggleShow()  
  1256. else
  1257. input = input:trim():lower()
  1258. if(input == "show") then
  1259. self:ToggleShow()
  1260. elseif(input == "options") then
  1261. InterfaceOptionsFrame_OpenToCategory(self.interfaceWindow)
  1262. elseif(input == "lock") then
  1263. self:ToggleLock()
  1264. if(self.db.char.locked) then
  1265. self:Print("Okno je |cffff0000zamknute")
  1266. else
  1267. self:Print("Okno je |cff00ff00odemknute")
  1268. end
  1269. elseif(input == "edit") then
  1270. if(IsInRaid() and (IsRaidLeader() or IsRaidOfficer())) then
  1271. self:ShowEditWindow()
  1272. else
  1273. self:Print("Nemate dostatecna prava pro zapis")
  1274. end
  1275. elseif(input == "reset") then
  1276. StaticPopup_Show("RESET_PAGES")
  1277. elseif(input == "help") then
  1278. self:Print("Dostupne prikazy:")
  1279. PrintCommand("show", "Zobrazi nebo skryje okno")
  1280. PrintCommand("options", "Otevre nastaveni v interface")
  1281. PrintCommand("lock", "Uzamkne nebo odemkne okno")
  1282. PrintCommand("edit", "Otevre editacni okno")
  1283. PrintCommand("reset", "Smaze stranky, vycisti okno")
  1284. PrintCommand("help", "Zobrazi napovedu")
  1285. else
  1286. self:Print("Neznamy prikaz, dostupne prikazy:")
  1287. PrintCommand("show", "Zobrazi nebo skryje okno")
  1288. PrintCommand("options", "Otevre nastaveni v interface")
  1289. PrintCommand("lock", "Uzamkne nebo odemkne okno")
  1290. PrintCommand("edit", "Otevre editacni okno")
  1291. PrintCommand("reset", "Smaze stranky, vycisti okno")
  1292. PrintCommand("help", "Zobrazi napovedu")
  1293. end    
  1294. end
  1295. end
  1296. function addon:EnableDisableEditWindow(enable)
  1297. local kids = { addon.editWindow:GetChildren() }
  1298. if enable then
  1299. if(addon.db.char.numPages == 0) then
  1300. for k, v in pairs(kids) do
  1301. if(v:IsObjectType("Button")) then
  1302. v:Disable()
  1303. end
  1304. end
  1305. self.editWindowEnabled = false
  1306. else
  1307. for k, v in pairs(kids) do
  1308. if(v:IsObjectType("Button")) then
  1309. v:Enable()
  1310. end
  1311. end
  1312. addon.editWindow.editBox:Enable()
  1313. self.editWindowEnabled = true
  1314. end
  1315. self:UpdateEditWindow()
  1316. else
  1317. for k, v in pairs(kids) do
  1318. if(v:IsObjectType("Button")) then
  1319. v:Disable()
  1320. end
  1321. end
  1322. addon.editWindow.editBox:Disable()
  1323. self.editWindowEnabled = false
  1324. end
  1325. end
  1326. function addon:EnableDisablePageWindow(enable)
  1327. local kids2 = { addon.pageWindow.treeFrame:GetChildren() }
  1328. local kids3 = { addon.pageWindow:GetChildren() }
  1329. if enable then
  1330. for k, v in pairs(kids2) do
  1331. if(v:IsObjectType("Button")) then
  1332. v:Enable()
  1333. end
  1334. end
  1335. for k, v in pairs(kids3) do
  1336. if(v:IsObjectType("Button")) then
  1337. v:Enable()
  1338. end
  1339. end
  1340. self.pageWindowEnabled = true
  1341. else
  1342. for k, v in pairs(kids2) do
  1343. if(v:IsObjectType("Button")) then
  1344. v:Disable()
  1345. end
  1346. end
  1347. for k, v in pairs(kids3) do
  1348. if(v:IsObjectType("Button")) then
  1349. v:Disable()
  1350. end
  1351. end
  1352. self.pageWindowEnabled = false
  1353. end
  1354. end
  1355. function addon:DisplayPageInEditBox(id)
  1356. if not id then id = self.selectedPage end
  1357. local page = pgs[id]
  1358. if not page then
  1359. self.editWindow.editBox:SetText("")
  1360. else
  1361. self.editWindow.editBox:SetText(page.Content)
  1362. end
  1363. end
  1364. function addon:DisplayPageInTextWindow(id)
  1365. if not id then id = self.selectedPage end
  1366. local page = pgs[id]
  1367. if not page then return end
  1368. if(not self.textWindow:IsShown()) then self.textWindow:Show() end
  1369. self.textWindow.messageFrame:Clear()
  1370. self.db.char.shownText = page.Content
  1371. local text = RecognizeFixPatterns(page.Content)
  1372. local lines = { strsplit("\n", text) }
  1373. local lines_count = #lines
  1374. for i = 1, lines_count do
  1375. local line
  1376. if(addon.db.char.alignTop) then
  1377. line = lines[lines_count - i + 1]
  1378. else
  1379. line = lines[i]
  1380. end
  1381. if line == "" then line = " " end
  1382. self.textWindow.messageFrame:AddMessage(line)
  1383. end
  1384. end
  1385. function IsInRaid()
  1386. local inInstance, instanceType = IsInInstance()
  1387. local result = false
  1388. if(GetRealNumRaidMembers() > 0 and instanceType ~= "pvp" and instanceType ~= "arena") then
  1389. result = true
  1390. end
  1391. return result  
  1392. end
  1393. function ci_pattern(pattern)
  1394. local p = pattern:gsub("(%%?)(.)", function(percent, letter)
  1395. if percent ~= "" or not letter:match("%a") then
  1396. return percent .. letter
  1397. else
  1398. return string.format("[%s%s]", letter:lower(), letter:upper())
  1399. end
  1400. end)
  1401. return p
  1402. end
  1403. function ae() addon:AfterEnable() end
  1404. function RecognizeFixPatterns(text)
  1405. text = text:gsub("||", "|")
  1406. :gsub(ci_pattern('|cblue'), "|cff00cbf4")
  1407. :gsub(ci_pattern('|cgreen'), "|cff0adc00")
  1408. :gsub(ci_pattern('|cred'), "|cffeb310c")
  1409. :gsub(ci_pattern('|cyellow'), "|cfffaf318")
  1410. :gsub(ci_pattern('|corange'), "|cffff9d00")
  1411. :gsub(ci_pattern('|cpink'), "|cfff64c97")
  1412. :gsub(ci_pattern('|cpurple'), "|cffdc44eb")
  1413. :gsub(ci_pattern('|cwhite'), "|cffffffff")
  1414. :gsub(ci_pattern('{star}'), "{rt1}")
  1415. :gsub(ci_pattern('{circle}'), "{rt2}")
  1416. :gsub(ci_pattern('{diamond}'), "{rt3}")
  1417. :gsub(ci_pattern('{triangle}'), "{rt4}")
  1418. :gsub(ci_pattern('{moon}'), "{rt5}")
  1419. :gsub(ci_pattern('{square}'), "{rt6}")
  1420. :gsub(ci_pattern('{cross}'), "{rt7}")
  1421. :gsub(ci_pattern('{x}'), "{rt7}")
  1422. :gsub(ci_pattern('{skull}'), "{rt8}")
  1423. :gsub(ci_pattern('{rt([1-8])}'), "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_%1:0|t" )
  1424. :gsub(ci_pattern('{healthstone}'), "{hs}")
  1425. :gsub(ci_pattern('{hs}'), "|TInterface\\Icons\\INV_Stone_04:0|t")
  1426. :gsub(ci_pattern('{bloodlust}'), "{bl}")
  1427. :gsub(ci_pattern('{bl}'), "|TInterface\\Icons\\SPELL_Nature_Bloodlust:0|t")
  1428. :gsub(ci_pattern('{damage}'), "{dps}")
  1429. :gsub(ci_pattern('{tank}'), "|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES:0:0:0:0:64:64:0:19:22:41|t")
  1430. :gsub(ci_pattern('{healer}'), "|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES:0:0:0:0:64:64:20:39:1:20|t")
  1431. :gsub(ci_pattern('{dps}'), "|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES:0:0:0:0:64:64:20:39:22:41|t")
  1432. :gsub(ci_pattern('{hero}'), "{heroism}")
  1433. :gsub(ci_pattern('{heroism}'), "|TInterface\\Icons\\ABILITY_Shaman_Heroism:0|t")
  1434. :gsub(ci_pattern('{hunter}'), "|TInterface\\GLUES\\CHARACTERCREATE\\UI-CHARACTERCREATE-CLASSES:0:0:0:0:64:64:0:16:16:32|t")
  1435. :gsub(ci_pattern('{warrior}'), "|TInterface\\GLUES\\CHARACTERCREATE\\UI-CHARACTERCREATE-CLASSES:0:0:0:0:64:64:0:16:0:16|t")
  1436. :gsub(ci_pattern('{rogue}'), "|TInterface\\GLUES\\CHARACTERCREATE\\UI-CHARACTERCREATE-CLASSES:0:0:0:0:64:64:32:48:0:16|t")
  1437. :gsub(ci_pattern('{mage}'), "|TInterface\\GLUES\\CHARACTERCREATE\\UI-CHARACTERCREATE-CLASSES:0:0:0:0:64:64:16:32:0:16|t")
  1438. :gsub(ci_pattern('{priest}'), "|TInterface\\GLUES\\CHARACTERCREATE\\UI-CHARACTERCREATE-CLASSES:0:0:0:0:64:64:32:48:16:32|t")
  1439. :gsub(ci_pattern('{warlock}'), "|TInterface\\GLUES\\CHARACTERCREATE\\UI-CHARACTERCREATE-CLASSES:0:0:0:0:64:64:48:64:16:32|t")
  1440. :gsub(ci_pattern('{paladin}'), "|TInterface\\GLUES\\CHARACTERCREATE\\UI-CHARACTERCREATE-CLASSES:0:0:0:0:64:64:0:16:32:48|t")
  1441. :gsub(ci_pattern('{deathknight}'), "|TInterface\\GLUES\\CHARACTERCREATE\\UI-CHARACTERCREATE-CLASSES:0:0:0:0:64:64:16:32:32:48|t")
  1442. :gsub(ci_pattern('{druid}'), "|TInterface\\GLUES\\CHARACTERCREATE\\UI-CHARACTERCREATE-CLASSES:0:0:0:0:64:64:48:64:0:16|t")
  1443. :gsub(ci_pattern('{shaman}'), "|TInterface\\GLUES\\CHARACTERCREATE\\UI-CHARACTERCREATE-CLASSES:0:0:0:0:64:64:16:32:16:32|t")
  1444. return text
  1445. end
  1446. function addon:DestroyEvidence()
  1447. if not goodbyeOnce then
  1448. self:Print("Goodbye")
  1449. self.acceptMessages = false
  1450. self:UnregisterChatCommand("ga")
  1451. self:UnregisterEvent("RAID_ROSTER_UPDATE")
  1452. self:UnregisterEvent("PLAYER_GUILD_UPDATE")
  1453. self.editWindow:Hide()
  1454. self.textWindow:Hide()
  1455. self.pageWindow:Hide()
  1456. for k, v in pairs(INTERFACEOPTIONS_ADDONCATEGORIES) do
  1457. if(v.name == self.interfaceWindow.name) then
  1458. INTERFACEOPTIONS_ADDONCATEGORIES[k] = nil
  1459. end
  1460. end
  1461. InterfaceAddOnsList_Update()
  1462. if(InterfaceOptionsFramePanelContainer.displayedPanel and InterfaceOptionsFramePanelContainer.displayedPanel:IsShown()) then
  1463. InterfaceOptionsFramePanelContainer.displayedPanel:Hide()
  1464. end
  1465. goodbyeOnce = true
  1466. end
  1467. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement