Walkerbo

SpellChatLua

Sep 19th, 2021
1,006
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --
  2. -- SpellChat
  3. -- Version: 1.0.9.0
  4. -- Author: Walkerbo
  5. -- Email: walkerbo.saurfang@gmail.com
  6. -- Date: Friday 14 May 2021
  7. --
  8.  
  9. -- I have tried to name variables, functions, frames, and buttons to be descriptive
  10.  
  11. -- ===================================================================================================
  12. -- ===================================================================================================
  13. -- ===========================         Metrics, Lists & Variables          ===========================
  14. -- ===================================================================================================
  15. -- ===================================================================================================
  16.  
  17. local addonName = "SpellChat"
  18. local versionNumber = "SR 1.0.9.0"
  19. local currentClass = UnitClassBase("player")
  20.  
  21. -- ===========================         table of variables          ===========================
  22. local VariableList = {
  23.     currentAddClassNavigationButton = "",
  24.     currentAddClassSpellList = {},
  25.     currentAddPhraseTextBox = false,
  26.     currentClassSpellEnabled = false,
  27.     currentClassSpellID = 0,
  28.     currentClassSpellLink = "",
  29.     currentClassSpellList = {},
  30.     currentClassSpellPercentage = 0,
  31.     currentClassSpellPhrase = "",
  32.     currentHandWaveChatList = {},
  33.     currentHandWaveChatPhrase = "",
  34.     currentItemEnabled = false,
  35.     currentItemID = 0,
  36.     currentItemLink = "",
  37.     currentItemPercentage = 0,
  38.     currentItemPhrase = ""
  39. }
  40.  
  41. local SortedHandButtonTable = {}
  42.  
  43. -- ===========================         banner and buttons          ===========================
  44. local ImageList = {
  45.     deathKnightButton = ("Interface\\AddOns\\SpellChat\\Files\\DeathKnightButton"),
  46.     deathKnightButtonH = ("Interface\\AddOns\\SpellChat\\Files\\DeathKnightButtonH"),
  47.     demonHunterButton = ("Interface\\AddOns\\SpellChat\\Files\\DemonHunterButton"),
  48.     demonHunterButtonH = ("Interface\\AddOns\\SpellChat\\Files\\DemonHunterButtonH"),
  49.     druidButton = ("Interface\\AddOns\\SpellChat\\Files\\DruidButton"),
  50.     druidButtonH = ("Interface\\AddOns\\SpellChat\\Files\\DruidButtonH"),
  51.     generalChat1Button = ("Interface\\AddOns\\SpellChat\\Files\\GeneralChat175"),
  52.     generalChat1ButtonH = ("Interface\\AddOns\\SpellChat\\Files\\GeneralChat1"),
  53.     generalChat2Button = ("Interface\\AddOns\\SpellChat\\Files\\GeneralChat275"),
  54.     generalChat2ButtonH = ("Interface\\AddOns\\SpellChat\\Files\\GeneralChat2"),
  55.     groupGoodbyeButton = ("Interface\\AddOns\\SpellChat\\Files\\GroupGoodbye75"),
  56.     groupGoodbyeButtonH = ("Interface\\AddOns\\SpellChat\\Files\\GroupGoodbye"),
  57.     groupHelloButton = ("Interface\\AddOns\\SpellChat\\Files\\GroupHello75"),
  58.     groupHelloButtonH = ("Interface\\AddOns\\SpellChat\\Files\\GroupHello"),
  59.     guildGoodbyeButton = ("Interface\\AddOns\\SpellChat\\Files\\GuildGoodbye75"),
  60.     guildGoodbyeButtonH = ("Interface\\AddOns\\SpellChat\\Files\\GuildGoodbye"),
  61.     guildHelloButton = ("Interface\\AddOns\\SpellChat\\Files\\GuildHello75"),
  62.     guildHelloButtonH = ("Interface\\AddOns\\SpellChat\\Files\\GuildHello"),
  63.     handButton = ("Interface\\AddOns\\SpellChat\\Files\\GroupButton"),
  64.     handButtonH = ("Interface\\AddOns\\SpellChat\\Files\\GroupButtonH"),
  65.     hunterButton = ("Interface\\AddOns\\SpellChat\\Files\\HunterButton"),
  66.     hunterButtonH = ("Interface\\AddOns\\SpellChat\\Files\\HunterButtonH"),
  67.     itemButton = ("Interface\\AddOns\\SpellChat\\Files\\ItemsButton"),
  68.     itemButtonH = ("Interface\\AddOns\\SpellChat\\Files\\ItemsButtonH"),
  69.     lfgChat1Button = ("Interface\\AddOns\\SpellChat\\Files\\LFG175"),
  70.     lfgChat1ButtonH = ("Interface\\AddOns\\SpellChat\\Files\\LFG1"),
  71.     lfgChat2Button = ("Interface\\AddOns\\SpellChat\\Files\\LFG275"),
  72.     lfgChat2ButtonH = ("Interface\\AddOns\\SpellChat\\Files\\LFG2"),
  73.     mageButton = ("Interface\\AddOns\\SpellChat\\Files\\MageButton"),
  74.     mageButtonH = ("Interface\\AddOns\\SpellChat\\Files\\MageButtonH"),
  75.     monkButton = ("Interface\\AddOns\\SpellChat\\Files\\MonkButton"),
  76.     monkButtonH = ("Interface\\AddOns\\SpellChat\\Files\\MonkButtonH"),
  77.     paladinButton = ("Interface\\AddOns\\SpellChat\\Files\\PaladinButton"),
  78.     paladinButtonH = ("Interface\\AddOns\\SpellChat\\Files\\PaladinButtonH"),
  79.     priestButton = ("Interface\\AddOns\\SpellChat\\Files\\PriestButton"),
  80.     priestButtonH = ("Interface\\AddOns\\SpellChat\\Files\\PriestButtonH"),
  81.     removeSpellItemButton = ("Interface\\AddOns\\SpellChat\\Files\\RedCross"),
  82.     rogueButton = ("Interface\\AddOns\\SpellChat\\Files\\RogueButton"),
  83.     rogueButtonH = ("Interface\\AddOns\\SpellChat\\Files\\RogueButtonH"),
  84.     shamanButton = ("Interface\\AddOns\\SpellChat\\Files\\ShamanButton"),
  85.     shamanButtonH = ("Interface\\AddOns\\SpellChat\\Files\\ShamanButtonH"),
  86.     spellChatBanner = ("Interface\\AddOns\\SpellChat\\Files\\SpellChatBanner"),
  87.     spellChatButton = ("Interface\\AddOns\\SpellChat\\Files\\SpellChatButton"),
  88.     spellChatButtonH = ("Interface\\AddOns\\SpellChat\\Files\\SpellChatButtonH"),
  89.     spellChatMagicButton = ("Interface\\AddOns\\SpellChat\\Files\\SpellChatMagicButton75"),
  90.     spellChatMagicButtonH = ("Interface\\AddOns\\SpellChat\\Files\\SpellChatMagicButton"),
  91.     tradeChat1Button = ("Interface\\AddOns\\SpellChat\\Files\\TradeChat175"),
  92.     tradeChat1ButtonH = ("Interface\\AddOns\\SpellChat\\Files\\TradeChat1"),
  93.     tradeChat2Button = ("Interface\\AddOns\\SpellChat\\Files\\TradeChat275"),
  94.     tradeChat2ButtonH = ("Interface\\AddOns\\SpellChat\\Files\\TradeChat2"),
  95.     warlockButton = ("Interface\\AddOns\\SpellChat\\Files\\WarlockButton"),
  96.     warlockButtonH = ("Interface\\AddOns\\SpellChat\\Files\\WarlockButtonH"),
  97.     warriorButton = ("Interface\\AddOns\\SpellChat\\Files\\WarriorButton"),
  98.     warriorButtonH = ("Interface\\AddOns\\SpellChat\\Files\\WarriorButtonH"),
  99.     yellChatButton = ("Interface\\AddOns\\SpellChat\\Files\\YellChat75")
  100. }
  101.  
  102. -- ===========================         edge and text colours          ===========================
  103. local ColourList = {
  104.     deathKnightEdge = {0.77, 0.12, 0.23}, -- rgb(196, 30, 58)
  105.     demonHunterEdge = {0.64, 0.19, 0.79}, -- rgb(163,48,201)
  106.     druidEdge = {1, 0.49, 0.04}, -- rgb(255,124,10)
  107.     generalEdge = {0, 1, 1}, -- rgb(0,255,255)
  108.     groupEdge = {1, 0.47, 0}, -- rgb(255,120,0)
  109.     guildEdge = {0, 1, 0}, -- rgb(0,255,0)
  110.     hunterEdge = {0.67, 0.83, 0.45}, -- rgb(170,211,114)
  111.     itemEdge = {1, 1, 0}, -- rgb(255,255,0)
  112.     lfgEdge = {0.5, 0, 1}, -- rgb(127,0,255)
  113.     mageEdge = {0.25, 0.78, 0.92}, -- rgb(63,199,235)
  114.     monkEdge = {0, 1, 0.6}, -- rgb(0,255,152)
  115.     paladinEdge = {0.96, 0.55, 0.73}, -- rgb(244,140,186)
  116.     priestEdge = {1, 1, 1}, -- rgb(255,255,255)
  117.     rogueEdge = {1, 0.96, 0.41}, -- rgb(255,244,104)
  118.     shamanEdge = {0, 0.44, 0.87}, -- rgb(0,112,221)
  119.     spellChatEdge = {1, 0.2, 0.8}, -- rgb(255, 51, 204)
  120.     spellChatPetMountLink = "|cffff8000", -- rgb(255, 128, 0)
  121.     spellChatText = "|cffff33cc", -- rgb(255, 51, 204)
  122.     tradeEdge = {1, 0.88, 0}, -- rgb(255,225,0)
  123.     warlockEdge = {0.53, 0.53, 0.93}, -- rgb(135,136,238)
  124.     warriorEdge = {0.78, 0.61, 0.43} -- rgb(198,155,109)
  125. }
  126.  
  127. -- ===========================         all the element sizes          ===========================
  128. local NumberList = {
  129.     addChatHeaderHeight = 31,
  130.     addPhraseTextBoxHeight = 25,
  131.     bannerBoxSize = 50,
  132.     bannerGap = 30,
  133.     bannerScale = 0.25,
  134.     chatHeaderHeight = 61,
  135.     chatScrollParentHeight = 224,
  136.     checkBoxBigGap = 15,
  137.     checkBoxGap = 10,
  138.     checkBoxSmallGap = 6,
  139.     checkEnableBottomGap = -2,
  140.     classFrameHeight = 384,
  141.     classFrameWidth = 610,
  142.     clearTargetListHeight = 35,
  143.     handWaveSelectChatButtonHeight = 32.6,
  144.     handWaveSelectChatButtonGap = -3,
  145.     edgeSize = 20,
  146.     enableCheckBoxSize = 30,
  147.     enableCheckBoxSmallSize = 25,
  148.     handWaveScrollButtonHeight = 20,
  149.     handWaveScrollButtonNumber = 7,
  150.     handWaveScrollFrameHeight = 224,
  151.     insetSize = 5,
  152.     magicButtonScale = 1,
  153.     navButtonGapW = 55,
  154.     navButtonSize = 40,
  155.     navSpellChatButtonGapX = 65,
  156.     navSpellChatButtonGapY = 150,
  157.     navSpellChatButtonSize = 60,
  158.     percentageTextBoxHeight = 25,
  159.     percentageTextBoxWidth = 40,
  160.     phraseTextButtonHeight = 30,
  161.     scaleTextBoxGap = 13,
  162.     scrollFrameHeight = 260,
  163.     scrollFrameWidth = 210,
  164.     scrollSpellFrameHight = 331,
  165.     scrollSpellFrameWidth = 379,
  166.     slashCommandHeight = 150,
  167.     slashCommandWidth = 300,
  168.     spellChatFrameBottomGap = 20,
  169.     spellChatFrameScale = 1,
  170.     spellChatMainFrameHeight = 630,
  171.     spellChatMainFrameWidth = 650,
  172.     spellItemChatScrollButtonHeight = 20,
  173.     spellItemChatScrollButtonNumber = 7,
  174.     spellItemScrollButtonHeight = 20,
  175.     spellItemScrollButtonNumber = 8
  176. }
  177.  
  178. -- ===========================         all the strings          ===========================
  179. local TextList = {
  180.     addonLoaded = ColourList.spellChatText .. " *** " .. addonName .. " - " .. versionNumber .. " Loaded *** \n",
  181.     addItemButtonText = "Add Item",
  182.     addSpellButtonText = "Add Spell",
  183.     allErrorMessagesText = " Error Messages",
  184.     buttonFontObject = Game18Font,
  185.     chatFrequencyText = "% Chat Frequency",
  186.     checkBoxFontObject = Game18Font,
  187.     checkBoxSmallFontObject = NumberFontNormalLargeYellow,
  188.     clearAllListsText = ColourList.spellChatText .. "[SpellChat]:|r All Lists Cleared",
  189.     clearChatListButtonText = "Clear Chat List",
  190.     clearCurrentListText = "Clear Current List",
  191.     clearItemListButtonText = "Clear Item List",
  192.     clearSpellListButtonText = "Clear Spell List",
  193.     enableSpellChatsText = " Enable Spell Chats",
  194.     errorAlreadyListed = ColourList.spellChatText .. "[SpellChat]:|r That Spell / Item Is Already Listed",
  195.     errorNoOnuseAction = ColourList.spellChatText .. "[SpellChat]:|r That Item Has No OnUse Action",
  196.     errorNotAnItem = ColourList.spellChatText .. "[SpellChat]:|r That Was Not An Item",
  197.     errorNotASpell = ColourList.spellChatText .. "[SpellChat]:|r That Was Not A Spell",
  198.     errorNoPhrases = ColourList.spellChatText .. "[SpellChat]:|r You Have No Phrases For This Chat",
  199.     errorNotInAGroup = ColourList.spellChatText .. "[SpellChat]:|r You Are Not In A Group",
  200.     errorNotInAGuild = ColourList.spellChatText .. "[SpellChat]:|r You Are Not In A Guild",
  201.     errorTradeChatNotAvailable = ColourList.spellChatText .. "[SpellChat]:|r Trade Chat Not Available In This Zone",
  202.     generalChat1ChannelButtonText = "General Chat 1",
  203.     generalChat2ChannelButtonText = "General Chat 2",
  204.     groupGoodbyeButtonText = "Group Goodbye",
  205.     groupHelloButtonText = "Group Hello",
  206.     guildGoodbyeButtonText = "Guild Goodbye",
  207.     guildHelloButtonText = "Guild Hello",
  208.     handTitleFontObject = Game24Font,
  209.     keybindButtonText = "Keybinding UI",
  210.     lfgChat1Channel2ButtonText = "LFG Chat 2",
  211.     lfgChat1ChannelButtonText = "LFG Chat 1",
  212.     sixButtonEnableText = " Enable SpellChat Button Box",
  213.     slashCommandFontObject = NumberFontNormalLargeYellow,
  214.     spellChatButtonGridOpacityText = "% SpellChat Button Box Opacity",
  215.     spellChatButtonGridScaleText = "% SpellChat Button Box Scale",
  216.     spellChatButtonOpacityText = "% SpellChat Buttton Opacity",
  217.     spellChatButtonScaleText = "% SpellChat Buttton Scale",
  218.     spellChatButtonText = " Enable SpellChat Button",
  219.     spellChatEnableText = " Enable SpellChat",
  220.     spellChatUIScaleText = "% SpellChatUI Scale",
  221.     tradeChat1Channel2ButtonText = "Trade Chat 2",
  222.     tradeChat1ChannelButtonText = "Trade Chat 1",
  223.     generalButtonsToggleText = " General Chat Buttons",
  224.     groupButtonsToggleText = " Group Chat Buttons",
  225.     guildButtonsToggleText = " Guild Chat Buttons",
  226.     lfgButtonsToggleText = " LFG Chat Buttons",
  227.     tradeButtonsToggleText = " Trade Chat Buttons",
  228.     yellChatChannelButtonText = "Yell Chat",
  229.     slashCommandText1 = ("Slash Commands:\n\n" ..
  230.         ColourList.spellChatText ..
  231.             "/spc |r  -  Toggle SpellChat Frame\n" ..
  232.                 ColourList.spellChatText ..
  233.                     "/spcpos |r  -  Reset SpellChat Layout\n" ..
  234.                         ColourList.spellChatText ..
  235.                             "/spcc |r  -  Clear All Lists\n" ..
  236.                                 ColourList.spellChatText ..
  237.                                     "/spcgdh |r  -  Guild Hello Message\n" ..
  238.                                         ColourList.spellChatText ..
  239.                                             "/spcgdg |r  -  Guild Goodbye Message\n" ..
  240.                                                 ColourList.spellChatText ..
  241.                                                     "/spcgph |r  -  Group Hello Message\n" ..
  242.                                                         ColourList.spellChatText ..
  243.                                                             "/spcgpg |r  -  Group Goodbye Message\n"),
  244.     slashCommandText2 = (ColourList.spellChatText ..
  245.         "/spcg1 |r  -  General Chat Message 1\n" ..
  246.             ColourList.spellChatText ..
  247.                 "/spcg2 |r  -  General Chat Message 2\n" ..
  248.                     ColourList.spellChatText ..
  249.                         "/spct1 |r  -  Trade Chat 1\n" ..
  250.                             ColourList.spellChatText ..
  251.                                 "/spct2 |r  -  Trade Chat 2\n" ..
  252.                                     ColourList.spellChatText ..
  253.                                         "/spcl1 |r  -  LFG Chat 1\n" ..
  254.                                             ColourList.spellChatText ..
  255.                                                 "/spcl2 |r  -  LFG Chat 2\n" ..
  256.                                                     ColourList.spellChatText ..
  257.                                                         "/spcds |r  -  Reset Settings To Defaults"),
  258.     buttonClickText = ("Button Clicks:\n\n" ..
  259.         ColourList.spellChatText ..
  260.             "Clear List Buttons |r  -  Right Click\n" ..
  261.                 ColourList.spellChatText ..
  262.                     "Toggle SpellChat Frame |r  -  Right Click SpellChat Buttons\n" ..
  263.                         ColourList.spellChatText ..
  264.                             "Drag SpellChat Buttons |r  -  Middle Click SpellChat Buttons\n" ..
  265.                                 ColourList.spellChatText ..
  266.                                     "Add Items and Spells to lists |r  -  Drag and Drop onto the add buttons\n" ..
  267.                                         ColourList.spellChatText ..
  268.                                             "Insert Items, Pets, Mounts and Spells into chats |r  -  Drag and Drop into the chat box\n" ..
  269.                                                 ColourList.spellChatText ..
  270.                                                     "Insert Achievements into chats |r  -  Focus on Chat box Alt-Click\n" ..
  271.                                                         ColourList.spellChatText ..
  272.                                                             "Insert Adventure Journal Bosses and Boss Spells into chats |r  -  Focus on Chat box Alt-Click\n" ..
  273.                                                                 ColourList.spellChatText ..
  274.                                                                     "Insert Adventure Journal Items into chats |r  -  Focus on Chat box Alt-Click\n")
  275. }
  276.  
  277. -- ===========================         global keybinding Names          ===========================
  278. BINDING_HEADER_SPCTKEYBINDINGTITLE = "- SpellChat -"
  279. BINDING_NAME_SPCTRESETSPELLCHATUILAYOUT = "Reset SpellChat UI Layout"
  280. BINDING_NAME_SPCTRUNGENERALCHANNELCHAT1FUNCTION = "General Chat Message 1"
  281. BINDING_NAME_SPCTRUNGENERALCHANNELCHAT2FUNCTION = "General Chat Message 2"
  282. BINDING_NAME_SPCTRUNGROUPGOODBYECHATFUNCTION = "Group Goodbye Chat Message"
  283. BINDING_NAME_SPCTRUNGROUPHELLOCHATFUNCTION = "Group Hello Chat Message"
  284. BINDING_NAME_SPCTRUNGUILDGOODBYECHATFUNCTION = "Guild Goodbye Chat Message"
  285. BINDING_NAME_SPCTRUNGUILDHELLOCHATFUNCTION = "Guild Hello Chat Message"
  286. BINDING_NAME_SPCTRUNLFGCHANNELCHAT1FUNCTION = "LFG Chat Message 1"
  287. BINDING_NAME_SPCTRUNLFGCHANNELCHAT2FUNCTION = "LFG Chat Message 2"
  288. BINDING_NAME_SPCTRUNTRADECHANNELCHAT1FUNCTION = "Trade Chat Message 1"
  289. BINDING_NAME_SPCTRUNTRADECHANNELCHAT2FUNCTION = "Trade Chat Message 2"
  290. BINDING_NAME_SPCTTOGGLESPELLCHATINTERFACEFRAME = "Toggle SpellChat Interface Frame"
  291.  
  292. -- ===================================================================================================
  293. -- ===================================================================================================
  294. -- ===========================         Functions          ===========================
  295. -- ===================================================================================================
  296. -- ===================================================================================================
  297.  
  298. local function initialiseLists() -- build lists if they do not already exist
  299.     if not SpellChatOptionsList then
  300.         DeathKnightSpellList = {}
  301.         DemonHunterSpellList = {}
  302.         DruidSpellList = {}
  303.         HunterSpellList = {}
  304.         MageSpellList = {}
  305.         MonkSpellList = {}
  306.         PaladinSpellList = {}
  307.         PriestSpellList = {}
  308.         RogueSpellList = {}
  309.         ShamanSpellList = {}
  310.         WarlockSpellList = {}
  311.         WarriorSpellList = {}
  312.         SpellChatGuildHelloList = {}
  313.         SpellChatGuildGoodbyeList = {}
  314.         SpellChatGroupHelloList = {}
  315.         SpellChatGroupGoodbyeList = {}
  316.         SpellChatGeneral1List = {}
  317.         SpellChatGeneral2List = {}
  318.         SpellChatTrade1List = {}
  319.         SpellChatTrade2List = {}
  320.         SpellChatLFG1List = {}
  321.         SpellChatLFG2List = {}
  322.         SpellChatItemList = {}
  323.         SpellChatPetList = {} -- debug --
  324.         SpellChatHandButtonList = {
  325.             [1] = {guildButtons = true}, -- each button needs to be in order
  326.             [2] = {groupButtons = true},
  327.             [3] = {generalButtons = true},
  328.             [4] = {tradeButtons = true},
  329.             [5] = {lfgButttons = true}
  330.         }
  331.         SpellChatOptionsList = {
  332.             buttonBoxEnabled = true,
  333.             buttonBoxIsHidden = false,
  334.             buttonBoxOpacity = 1,
  335.             buttonBoxScale = 1,
  336.             errorMessagesEnabled = true,
  337.             magicButtonEnabled = true,
  338.             magicButtonOpacity = 1,
  339.             magicButtonScale = 1,
  340.             spellChatEnabled = true,
  341.             spellChatFrameScale = 1
  342.         }
  343.         SpellChatInterfaceFrame:Show() -- show spellchat UI on first login
  344.     end
  345. end
  346.  
  347. local function setCheckBoxesAndScales() -- set up the checkboxes and the frame and buttons scale
  348.     if SpellChatOptionsList.spellChatEnabled then
  349.         SpellChatFrame1.EnableSpellChatCheckBox:SetChecked(true)
  350.     else
  351.         SpellChatFrame1.EnableSpellChatCheckBox:SetChecked(false)
  352.         SpellChatFrame1.EnableSpellChatButtonCheckBox:SetEnabled(false)
  353.         SpellChatFrame1.EnableSpellChatSixButtonCheckBox:SetEnabled(false)
  354.         SpellChatFrame1.ErrorMessagesCheckBox:SetEnabled(false)
  355.     end
  356.     if SpellChatOptionsList.magicButtonEnabled then
  357.         SpellChatFrame1.EnableSpellChatButtonCheckBox:SetChecked(true)
  358.         spellChatMagicButton:Show()
  359.     else
  360.         SpellChatFrame1.EnableSpellChatButtonCheckBox:SetChecked(false)
  361.         spellChatMagicButton:Hide()
  362.     end
  363.     if SpellChatOptionsList.buttonBoxEnabled then
  364.         SpellChatFrame1.EnableSpellChatSixButtonCheckBox:SetChecked(true)
  365.         HandWaveButtonGridFrame:Show()
  366.     else
  367.         SpellChatFrame1.EnableSpellChatSixButtonCheckBox:SetChecked(false)
  368.         HandWaveButtonGridFrame:Hide()
  369.     end
  370.     if SpellChatHandButtonList[1].guildButtons then
  371.         SpellChatFrame1.GuildChatButtonsCheckBox:SetChecked(true)
  372.     else
  373.         SpellChatFrame1.GuildChatButtonsCheckBox:SetChecked(false)
  374.     end
  375.     if SpellChatHandButtonList[2].groupButtons then
  376.         SpellChatFrame1.GroupChatButtonsCheckBox:SetChecked(true)
  377.     else
  378.         SpellChatFrame1.GroupChatButtonsCheckBox:SetChecked(false)
  379.     end
  380.     if SpellChatHandButtonList[3].generalButtons then
  381.         SpellChatFrame1.GeneralChatButtonsCheckBox:SetChecked(true)
  382.     else
  383.         SpellChatFrame1.GeneralChatButtonsCheckBox:SetChecked(false)
  384.     end
  385.     if SpellChatHandButtonList[4].tradeButtons then
  386.         SpellChatFrame1.TradeChatButtonsCheckBox:SetChecked(true)
  387.     else
  388.         SpellChatFrame1.TradeChatButtonsCheckBox:SetChecked(false)
  389.     end
  390.     if SpellChatHandButtonList[5].lfgButttons then
  391.         SpellChatFrame1.LFGChatButtonsCheckBox:SetChecked(true)
  392.     else
  393.         SpellChatFrame1.LFGChatButtonsCheckBox:SetChecked(false)
  394.     end
  395.     if SpellChatOptionsList.errorMessagesEnabled then
  396.         SpellChatFrame1.ErrorMessagesCheckBox:SetChecked(true)
  397.     else
  398.         SpellChatFrame1.ErrorMessagesCheckBox:SetChecked(false)
  399.     end
  400.     SpellChatInterfaceFrame:SetScale(SpellChatOptionsList.spellChatFrameScale)
  401.     SpellChatFrame1.SpellChatFrameScaleTextBox:SetNumber(SpellChatOptionsList.spellChatFrameScale * 100)
  402.  
  403.     spellChatMagicButton:SetScale(SpellChatOptionsList.magicButtonScale)
  404.     SpellChatFrame1.MagicButtonScaleTextBox:SetNumber(SpellChatOptionsList.magicButtonScale * 100)
  405.     spellChatMagicButton:SetAlpha(SpellChatOptionsList.magicButtonOpacity)
  406.     SpellChatFrame1.MagicButtonOpacityTextBox:SetNumber(SpellChatOptionsList.magicButtonOpacity * 100)
  407.  
  408.     HandWaveButtonGridFrame:SetScale(SpellChatOptionsList.buttonBoxScale)
  409.     SpellChatFrame1.ButtonGridScaleTextBox:SetText(SpellChatOptionsList.buttonBoxScale * 100)
  410.     SpellChatFrame1.ButtonGridOpacityTextBox:SetText(SpellChatOptionsList.buttonBoxOpacity * 100)
  411. end
  412.  
  413. local function handWaveGridFrameButtonLayout()
  414.     buttonCount, lastAnchor, buttonFrameWidthMultiplier = 1, HandWaveButtonGridFrame, 1 -- button build variables
  415.     HandWaveButtonGridFrameguildButtons:Hide() -- hide all buttons to ensure no ghosting
  416.     HandWaveButtonGridFrameguildButtons2:Hide()
  417.     HandWaveButtonGridFramegroupButtons:Hide()
  418.     HandWaveButtonGridFramegroupButtons2:Hide()
  419.     HandWaveButtonGridFramegeneralButtons:Hide()
  420.     HandWaveButtonGridFramegeneralButtons2:Hide()
  421.     HandWaveButtonGridFrametradeButtons:Hide()
  422.     HandWaveButtonGridFrametradeButtons2:Hide()
  423.     HandWaveButtonGridFramelfgButttons:Hide()
  424.     HandWaveButtonGridFramelfgButttons2:Hide()
  425.     HandWaveButtonGridFrame:SetSize(NumberList.navButtonSize * buttonFrameWidthMultiplier, NumberList.navButtonSize * 2) -- set the button frame to its default size
  426.     for a, b in pairs(SpellChatHandButtonList) do
  427.         for k, v in pairs(b) do -- loop through the table at index
  428.             if v then -- if the current button name is true
  429.                 thisButton = _G["HandWaveButtonGridFrame" .. k] -- set this button to the global button 2
  430.                 thisButton:ClearAllPoints()
  431.                 thisButton:SetAlpha(SpellChatOptionsList.buttonBoxOpacity)
  432.                 thisButton:Show()
  433.                 thisButton2 = _G["HandWaveButtonGridFrame" .. k .. "2"] -- set this button to the global button namebutton name
  434.                 thisButton2:ClearAllPoints()
  435.                 thisButton2:SetAlpha(SpellChatOptionsList.buttonBoxOpacity)
  436.                 thisButton2:Show()
  437.                 if buttonCount == 1 then
  438.                     thisButton:SetPoint("TOPLEFT", HandWaveButtonGridFrame, "TOPLEFT") -- the very first button gets anchored to the button frame
  439.                     thisButton2:SetPoint("TOP", thisButton, "BOTTOM") -- button 2 gets anchored to the button 1
  440.                 else
  441.                     thisButton:SetPoint("LEFT", lastAnchor, "RIGHT") -- each subsequent button 1 gets anchored to the previous button 1
  442.                     thisButton2:SetPoint("TOP", thisButton, "BOTTOM") -- button 2 gets anchored to the button 1
  443.                 end
  444.                 HandWaveButtonGridFrame:SetSize(
  445.                     NumberList.navButtonSize * buttonFrameWidthMultiplier,
  446.                     NumberList.navButtonSize * 2
  447.                 ) -- expand the frame by the number of buttons
  448.                 buttonCount = buttonCount + 1 -- increase button count
  449.                 lastAnchor = thisButton -- set the current button 1
  450.                 buttonFrameWidthMultiplier = buttonFrameWidthMultiplier + 1 -- increase the frame width multiplier
  451.             end
  452.         end
  453.     end
  454.     HandWaveButtonGridFrame:SetAlpha(SpellChatOptionsList.buttonBoxOpacity)
  455. end
  456.  
  457. local function setCurrentAddClassSpellButtonList() -- set the default list based on the current class
  458.     if currentClass == "DEATHKNIGHT" then
  459.         VariableList.currentAddClassNavigationButton = SpellChatNavigationPanelDeathKnightBtn
  460.         VariableList.currentAddClassSpellList = DeathKnightSpellList
  461.     elseif currentClass == "DEMONHUNTER" then
  462.         VariableList.currentAddClassNavigationButton = SpellChatNavigationPanelDemonHunterBtn
  463.         VariableList.currentAddClassSpellList = DemonHunterSpellList
  464.     elseif currentClass == "DRUID" then
  465.         VariableList.currentAddClassNavigationButton = SpellChatNavigationPanelDruidBtn
  466.         VariableList.currentAddClassSpellList = DruidSpellList
  467.     elseif currentClass == "HUNTER" then
  468.         VariableList.currentAddClassNavigationButton = SpellChatNavigationPanelHunterBtn
  469.         VariableList.currentAddClassSpellList = HunterSpellList
  470.     elseif currentClass == "MAGE" then
  471.         VariableList.currentAddClassNavigationButton = SpellChatNavigationPanelMageBtn
  472.         VariableList.currentAddClassSpellList = MageSpellList
  473.     elseif currentClass == "MONK" then
  474.         VariableList.currentAddClassNavigationButton = SpellChatNavigationPanelMonkBtn
  475.         VariableList.currentAddClassSpellList = MonkSpellList
  476.     elseif currentClass == "PALADIN" then
  477.         VariableList.currentAddClassNavigationButton = SpellChatNavigationPanelPaladinBtn
  478.         VariableList.currentAddClassSpellList = PaladinSpellList
  479.     elseif currentClass == "PRIEST" then
  480.         VariableList.currentAddClassNavigationButton = SpellChatNavigationPanelPriestBtn
  481.         VariableList.currentAddClassSpellList = PriestSpellList
  482.     elseif currentClass == "ROGUE" then
  483.         VariableList.currentAddClassNavigationButton = SpellChatNavigationPanelRogueBtn
  484.         VariableList.currentAddClassSpellList = RogueSpellList
  485.     elseif currentClass == "SHAMAN" then
  486.         VariableList.currentAddClassNavigationButton = SpellChatNavigationPanelShamanBtn
  487.         VariableList.currentAddClassSpellList = ShamanSpellList
  488.     elseif currentClass == "WARLOCK" then
  489.         VariableList.currentAddClassNavigationButton = SpellChatNavigationPanelWarlockBtn
  490.         VariableList.currentAddClassSpellList = WarlockSpellList
  491.     elseif currentClass == "WARRIOR" then
  492.         VariableList.currentAddClassNavigationButton = SpellChatNavigationPanelWarriorBtn
  493.         VariableList.currentAddClassSpellList = WarriorSpellList
  494.     end
  495. end
  496.  
  497. local function closeAllFrames()
  498.     DeathKnightSpellChatFrame:Hide()
  499.     DemonHunterSpellChatFrame:Hide()
  500.     DruidSpellChatFrame:Hide()
  501.     HandWaveFrame:Hide()
  502.     HunterSpellChatFrame:Hide()
  503.     ItemsSpellChatFrame:Hide()
  504.     MageSpellChatFrame:Hide()
  505.     MonkSpellChatFrame:Hide()
  506.     PaladinSpellChatFrame:Hide()
  507.     PriestSpellChatFrame:Hide()
  508.     RogueSpellChatFrame:Hide()
  509.     ShamanSpellChatFrame:Hide()
  510.     SpellChatFrame1:Hide()
  511.     SpellChatFrame2:Hide()
  512.     WarlockSpellChatFrame:Hide()
  513.     WarriorSpellChatFrame:Hide()
  514.     SpellChatInterfaceFrame.SpellChatBtn1:SetNormalTexture(ImageList.spellChatButton)
  515.     SpellChatInterfaceFrame.SpellChatBtn2:SetNormalTexture(ImageList.spellChatButton)
  516.     SpellChatNavigationPanel.DeathKnightBtn:SetNormalTexture(ImageList.deathKnightButton)
  517.     SpellChatNavigationPanel.DemonHunterBtn:SetNormalTexture(ImageList.demonHunterButton)
  518.     SpellChatNavigationPanel.DruidBtn:SetNormalTexture(ImageList.druidButton)
  519.     SpellChatNavigationPanel.HandWaveBtn:SetNormalTexture(ImageList.handButton)
  520.     SpellChatNavigationPanel.HunterBtn:SetNormalTexture(ImageList.hunterButton)
  521.     SpellChatNavigationPanel.ItemBtn:SetNormalTexture(ImageList.itemButton)
  522.     SpellChatNavigationPanel.MageBtn:SetNormalTexture(ImageList.mageButton)
  523.     SpellChatNavigationPanel.MonkBtn:SetNormalTexture(ImageList.monkButton)
  524.     SpellChatNavigationPanel.PaladinBtn:SetNormalTexture(ImageList.paladinButton)
  525.     SpellChatNavigationPanel.PriestBtn:SetNormalTexture(ImageList.priestButton)
  526.     SpellChatNavigationPanel.RogueBtn:SetNormalTexture(ImageList.rogueButton)
  527.     SpellChatNavigationPanel.ShamanBtn:SetNormalTexture(ImageList.shamanButton)
  528.     SpellChatNavigationPanel.WarlockBtn:SetNormalTexture(ImageList.warlockButton)
  529.     SpellChatNavigationPanel.WarriorBtn:SetNormalTexture(ImageList.warriorButton)
  530. end
  531.  
  532. local function printErrorMessages(errorMessageType)
  533.     if SpellChatOptionsList.errorMessagesEnabled then
  534.         if errorMessageType == "errorNotAnItem" then
  535.             print(TextList.errorNotAnItem)
  536.         elseif errorMessageType == "errorNotASpell" then
  537.             print(TextList.errorNotASpell)
  538.         elseif errorMessageType == "errorNoOnuseAction" then
  539.             print(TextList.errorNoOnuseAction)
  540.         elseif errorMessageType == "errorAlreadyListed" then
  541.             print(TextList.errorAlreadyListed)
  542.         elseif errorMessageType == "errorNotInAGuild" then
  543.             print(TextList.errorNotInAGuild)
  544.         elseif errorMessageType == "errorNotInAGroup" then
  545.             print(TextList.errorNotInAGroup)
  546.         elseif errorMessageType == "errorNoPhrases" then
  547.             print(TextList.errorNoPhrases)
  548.         elseif errorMessageType == "errorTradeChatNotAvailable" then
  549.             print(TextList.errorTradeChatNotAvailable)
  550.         end
  551.     end
  552. end
  553.  
  554. -- ===========================         update class spell list functions          ===========================
  555. local function updateDeathKnightSpellList()
  556.     FauxScrollFrame_Update(
  557.         DeathKnightSpellScrollFrame,
  558.         #DeathKnightSpellList,
  559.         NumberList.spellItemScrollButtonNumber,
  560.         NumberList.spellItemScrollButtonHeight
  561.     )
  562.     for index = 1, NumberList.spellItemScrollButtonNumber do
  563.         offset = index + FauxScrollFrame_GetOffset(DeathKnightSpellScrollFrame)
  564.         button = DeathKnightSpellScrollFrame.buttons[index]
  565.         button.index = offset
  566.         if offset <= #DeathKnightSpellList then
  567.             button:SetText(DeathKnightSpellList[offset].spellLink)
  568.             button:Show()
  569.         else
  570.             button:Hide()
  571.         end
  572.     end
  573. end
  574. local function updateDeathKnightSpellChatList()
  575.     currentClassSpellList = {}
  576.     for k, v in pairs(DeathKnightSpellList) do
  577.         if v.spellID == VariableList.currentClassSpellID then
  578.             currentClassSpellList = v.spellChatList
  579.         end
  580.     end
  581.     FauxScrollFrame_Update(
  582.         DeathKnightChatScrollFrame,
  583.         #currentClassSpellList,
  584.         NumberList.spellItemChatScrollButtonNumber,
  585.         NumberList.spellItemChatScrollButtonHeight
  586.     )
  587.     for index = 1, NumberList.spellItemChatScrollButtonNumber do
  588.         offset = index + FauxScrollFrame_GetOffset(DeathKnightChatScrollFrame)
  589.         button = DeathKnightChatScrollFrame.buttons[index]
  590.         button.index = offset
  591.         if offset <= #currentClassSpellList then
  592.             button:SetText(currentClassSpellList[offset])
  593.             button:Show()
  594.         else
  595.             button:Hide()
  596.         end
  597.     end
  598. end
  599.  
  600. local function updateDemonHunterSpellList()
  601.     FauxScrollFrame_Update(
  602.         DemonHunterSpellScrollFrame,
  603.         #DemonHunterSpellList,
  604.         NumberList.spellItemScrollButtonNumber,
  605.         NumberList.spellItemScrollButtonHeight
  606.     )
  607.     for index = 1, NumberList.spellItemScrollButtonNumber do
  608.         offset = index + FauxScrollFrame_GetOffset(DemonHunterSpellScrollFrame)
  609.         button = DemonHunterSpellScrollFrame.buttons[index]
  610.         button.index = offset
  611.         if offset <= #DemonHunterSpellList then
  612.             button:SetText(DemonHunterSpellList[offset].spellLink)
  613.             button:Show()
  614.         else
  615.             button:Hide()
  616.         end
  617.     end
  618. end
  619. local function updateDemonHunterSpellChatList()
  620.     currentClassSpellList = {}
  621.     for k, v in pairs(DemonHunterSpellList) do
  622.         if v.spellID == VariableList.currentClassSpellID then
  623.             currentClassSpellList = v.spellChatList
  624.         end
  625.     end
  626.     FauxScrollFrame_Update(
  627.         DemonHunterChatScrollFrame,
  628.         #currentClassSpellList,
  629.         NumberList.spellItemChatScrollButtonNumber,
  630.         NumberList.spellItemChatScrollButtonHeight
  631.     )
  632.     for index = 1, NumberList.spellItemChatScrollButtonNumber do
  633.         offset = index + FauxScrollFrame_GetOffset(DemonHunterChatScrollFrame)
  634.         button = DemonHunterChatScrollFrame.buttons[index]
  635.         button.index = offset
  636.         if offset <= #currentClassSpellList then
  637.             button:SetText(currentClassSpellList[offset])
  638.             button:Show()
  639.         else
  640.             button:Hide()
  641.         end
  642.     end
  643. end
  644.  
  645. local function updateDruidSpellList()
  646.     FauxScrollFrame_Update(
  647.         DruidSpellScrollFrame,
  648.         #DruidSpellList,
  649.         NumberList.spellItemScrollButtonNumber,
  650.         NumberList.spellItemScrollButtonHeight
  651.     )
  652.     for index = 1, NumberList.spellItemScrollButtonNumber do
  653.         offset = index + FauxScrollFrame_GetOffset(DruidSpellScrollFrame)
  654.         button = DruidSpellScrollFrame.buttons[index]
  655.         button.index = offset
  656.         if offset <= #DruidSpellList then
  657.             button:SetText(DruidSpellList[offset].spellLink)
  658.             button:Show()
  659.         else
  660.             button:Hide()
  661.         end
  662.     end
  663. end
  664. local function updateDruidSpellChatList()
  665.     currentClassSpellList = {}
  666.     for k, v in pairs(DruidSpellList) do
  667.         if v.spellID == VariableList.currentClassSpellID then
  668.             currentClassSpellList = v.spellChatList
  669.         end
  670.     end
  671.     FauxScrollFrame_Update(
  672.         DruidChatScrollFrame,
  673.         #currentClassSpellList,
  674.         NumberList.spellItemChatScrollButtonNumber,
  675.         NumberList.spellItemChatScrollButtonHeight
  676.     )
  677.     for index = 1, NumberList.spellItemChatScrollButtonNumber do
  678.         offset = index + FauxScrollFrame_GetOffset(DruidChatScrollFrame)
  679.         button = DruidChatScrollFrame.buttons[index]
  680.         button.index = offset
  681.         if offset <= #currentClassSpellList then
  682.             button:SetText(currentClassSpellList[offset])
  683.             button:Show()
  684.         else
  685.             button:Hide()
  686.         end
  687.     end
  688. end
  689.  
  690. local function updateHunterSpellList()
  691.     FauxScrollFrame_Update(
  692.         HunterSpellScrollFrame,
  693.         #HunterSpellList,
  694.         NumberList.spellItemScrollButtonNumber,
  695.         NumberList.spellItemScrollButtonHeight
  696.     )
  697.     for index = 1, NumberList.spellItemScrollButtonNumber do
  698.         offset = index + FauxScrollFrame_GetOffset(HunterSpellScrollFrame)
  699.         button = HunterSpellScrollFrame.buttons[index]
  700.         button.index = offset
  701.         if offset <= #HunterSpellList then
  702.             button:SetText(HunterSpellList[offset].spellLink)
  703.             button:Show()
  704.         else
  705.             button:Hide()
  706.         end
  707.     end
  708. end
  709. local function updateHunterSpellChatList()
  710.     currentClassSpellList = {}
  711.     for k, v in pairs(HunterSpellList) do
  712.         if v.spellID == VariableList.currentClassSpellID then
  713.             currentClassSpellList = v.spellChatList
  714.         end
  715.     end
  716.     FauxScrollFrame_Update(
  717.         HunterChatScrollFrame,
  718.         #currentClassSpellList,
  719.         NumberList.spellItemChatScrollButtonNumber,
  720.         NumberList.spellItemChatScrollButtonHeight
  721.     )
  722.     for index = 1, NumberList.spellItemChatScrollButtonNumber do
  723.         offset = index + FauxScrollFrame_GetOffset(HunterChatScrollFrame)
  724.         button = HunterChatScrollFrame.buttons[index]
  725.         button.index = offset
  726.         if offset <= #currentClassSpellList then
  727.             button:SetText(currentClassSpellList[offset])
  728.             button:Show()
  729.         else
  730.             button:Hide()
  731.         end
  732.     end
  733. end
  734.  
  735. local function updateMageSpellList()
  736.     FauxScrollFrame_Update(
  737.         MageSpellScrollFrame,
  738.         #MageSpellList,
  739.         NumberList.spellItemScrollButtonNumber,
  740.         NumberList.spellItemScrollButtonHeight
  741.     )
  742.     for index = 1, NumberList.spellItemScrollButtonNumber do
  743.         offset = index + FauxScrollFrame_GetOffset(MageSpellScrollFrame)
  744.         button = MageSpellScrollFrame.buttons[index]
  745.         button.index = offset
  746.         if offset <= #MageSpellList then
  747.             button:SetText(MageSpellList[offset].spellLink)
  748.             button:Show()
  749.         else
  750.             button:Hide()
  751.         end
  752.     end
  753. end
  754. local function updateMageSpellChatList()
  755.     currentClassSpellList = {}
  756.     for k, v in pairs(MageSpellList) do
  757.         if v.spellID == VariableList.currentClassSpellID then
  758.             currentClassSpellList = v.spellChatList
  759.         end
  760.     end
  761.     FauxScrollFrame_Update(
  762.         MageChatScrollFrame,
  763.         #currentClassSpellList,
  764.         NumberList.spellItemChatScrollButtonNumber,
  765.         NumberList.spellItemChatScrollButtonHeight
  766.     )
  767.     for index = 1, NumberList.spellItemChatScrollButtonNumber do
  768.         offset = index + FauxScrollFrame_GetOffset(MageChatScrollFrame)
  769.         button = MageChatScrollFrame.buttons[index]
  770.         button.index = offset
  771.         if offset <= #currentClassSpellList then
  772.             button:SetText(currentClassSpellList[offset])
  773.             button:Show()
  774.         else
  775.             button:Hide()
  776.         end
  777.     end
  778. end
  779.  
  780. local function updateMonkSpellList()
  781.     FauxScrollFrame_Update(
  782.         MonkSpellScrollFrame,
  783.         #MonkSpellList,
  784.         NumberList.spellItemScrollButtonNumber,
  785.         NumberList.spellItemScrollButtonHeight
  786.     )
  787.     for index = 1, NumberList.spellItemScrollButtonNumber do
  788.         offset = index + FauxScrollFrame_GetOffset(MonkSpellScrollFrame)
  789.         button = MonkSpellScrollFrame.buttons[index]
  790.         button.index = offset
  791.         if offset <= #MonkSpellList then
  792.             button:SetText(MonkSpellList[offset].spellLink)
  793.             button:Show()
  794.         else
  795.             button:Hide()
  796.         end
  797.     end
  798. end
  799. local function updateMonkSpellChatList()
  800.     currentClassSpellList = {}
  801.     for k, v in pairs(MonkSpellList) do
  802.         if v.spellID == VariableList.currentClassSpellID then
  803.             currentClassSpellList = v.spellChatList
  804.         end
  805.     end
  806.     FauxScrollFrame_Update(
  807.         MonkChatScrollFrame,
  808.         #currentClassSpellList,
  809.         NumberList.spellItemChatScrollButtonNumber,
  810.         NumberList.spellItemChatScrollButtonHeight
  811.     )
  812.     for index = 1, NumberList.spellItemChatScrollButtonNumber do
  813.         offset = index + FauxScrollFrame_GetOffset(MonkChatScrollFrame)
  814.         button = MonkChatScrollFrame.buttons[index]
  815.         button.index = offset
  816.         if offset <= #currentClassSpellList then
  817.             button:SetText(currentClassSpellList[offset])
  818.             button:Show()
  819.         else
  820.             button:Hide()
  821.         end
  822.     end
  823. end
  824.  
  825. local function updatePaladinSpellList()
  826.     FauxScrollFrame_Update(
  827.         PaladinSpellScrollFrame,
  828.         #PaladinSpellList,
  829.         NumberList.spellItemScrollButtonNumber,
  830.         NumberList.spellItemScrollButtonHeight
  831.     )
  832.     for index = 1, NumberList.spellItemScrollButtonNumber do
  833.         offset = index + FauxScrollFrame_GetOffset(PaladinSpellScrollFrame)
  834.         button = PaladinSpellScrollFrame.buttons[index]
  835.         button.index = offset
  836.         if offset <= #PaladinSpellList then
  837.             button:SetText(PaladinSpellList[offset].spellLink)
  838.             button:Show()
  839.         else
  840.             button:Hide()
  841.         end
  842.     end
  843. end
  844. local function updatePaladinSpellChatList()
  845.     currentClassSpellList = {}
  846.     for k, v in pairs(PaladinSpellList) do
  847.         if v.spellID == VariableList.currentClassSpellID then
  848.             currentClassSpellList = v.spellChatList
  849.         end
  850.     end
  851.     FauxScrollFrame_Update(
  852.         PaladinChatScrollFrame,
  853.         #currentClassSpellList,
  854.         NumberList.spellItemChatScrollButtonNumber,
  855.         NumberList.spellItemChatScrollButtonHeight
  856.     )
  857.     for index = 1, NumberList.spellItemChatScrollButtonNumber do
  858.         offset = index + FauxScrollFrame_GetOffset(PaladinChatScrollFrame)
  859.         button = PaladinChatScrollFrame.buttons[index]
  860.         button.index = offset
  861.         if offset <= #currentClassSpellList then
  862.             button:SetText(currentClassSpellList[offset])
  863.             button:Show()
  864.         else
  865.             button:Hide()
  866.         end
  867.     end
  868. end
  869.  
  870. local function updatePriestSpellList()
  871.     FauxScrollFrame_Update(
  872.         PriestSpellScrollFrame,
  873.         #PriestSpellList,
  874.         NumberList.spellItemScrollButtonNumber,
  875.         NumberList.spellItemScrollButtonHeight
  876.     )
  877.     for index = 1, NumberList.spellItemScrollButtonNumber do
  878.         offset = index + FauxScrollFrame_GetOffset(PriestSpellScrollFrame)
  879.         button = PriestSpellScrollFrame.buttons[index]
  880.         button.index = offset
  881.         if offset <= #PriestSpellList then
  882.             button:SetText(PriestSpellList[offset].spellLink)
  883.             button:Show()
  884.         else
  885.             button:Hide()
  886.         end
  887.     end
  888. end
  889. local function updatePriestSpellChatList()
  890.     currentClassSpellList = {}
  891.     for k, v in pairs(PriestSpellList) do
  892.         if v.spellID == VariableList.currentClassSpellID then
  893.             currentClassSpellList = v.spellChatList
  894.         end
  895.     end
  896.     FauxScrollFrame_Update(
  897.         PriestChatScrollFrame,
  898.         #currentClassSpellList,
  899.         NumberList.spellItemChatScrollButtonNumber,
  900.         NumberList.spellItemChatScrollButtonHeight
  901.     )
  902.     for index = 1, NumberList.spellItemChatScrollButtonNumber do
  903.         offset = index + FauxScrollFrame_GetOffset(PriestChatScrollFrame)
  904.         button = PriestChatScrollFrame.buttons[index]
  905.         button.index = offset
  906.         if offset <= #currentClassSpellList then
  907.             button:SetText(currentClassSpellList[offset])
  908.             button:Show()
  909.         else
  910.             button:Hide()
  911.         end
  912.     end
  913. end
  914.  
  915. local function updateRogueSpellList()
  916.     FauxScrollFrame_Update(
  917.         RogueSpellScrollFrame,
  918.         #RogueSpellList,
  919.         NumberList.spellItemScrollButtonNumber,
  920.         NumberList.spellItemScrollButtonHeight
  921.     )
  922.     for index = 1, NumberList.spellItemScrollButtonNumber do
  923.         offset = index + FauxScrollFrame_GetOffset(RogueSpellScrollFrame)
  924.         button = RogueSpellScrollFrame.buttons[index]
  925.         button.index = offset
  926.         if offset <= #RogueSpellList then
  927.             button:SetText(RogueSpellList[offset].spellLink)
  928.             button:Show()
  929.         else
  930.             button:Hide()
  931.         end
  932.     end
  933. end
  934. local function updateRogueSpellChatList()
  935.     currentClassSpellList = {}
  936.     for k, v in pairs(RogueSpellList) do
  937.         if v.spellID == VariableList.currentClassSpellID then
  938.             currentClassSpellList = v.spellChatList
  939.         end
  940.     end
  941.     FauxScrollFrame_Update(
  942.         RogueChatScrollFrame,
  943.         #currentClassSpellList,
  944.         NumberList.spellItemChatScrollButtonNumber,
  945.         NumberList.spellItemChatScrollButtonHeight
  946.     )
  947.     for index = 1, NumberList.spellItemChatScrollButtonNumber do
  948.         offset = index + FauxScrollFrame_GetOffset(RogueChatScrollFrame)
  949.         button = RogueChatScrollFrame.buttons[index]
  950.         button.index = offset
  951.         if offset <= #currentClassSpellList then
  952.             button:SetText(currentClassSpellList[offset])
  953.             button:Show()
  954.         else
  955.             button:Hide()
  956.         end
  957.     end
  958. end
  959.  
  960. local function updateShamanSpellList()
  961.     FauxScrollFrame_Update(
  962.         ShamanSpellScrollFrame,
  963.         #ShamanSpellList,
  964.         NumberList.spellItemScrollButtonNumber,
  965.         NumberList.spellItemScrollButtonHeight
  966.     )
  967.     for index = 1, NumberList.spellItemScrollButtonNumber do
  968.         offset = index + FauxScrollFrame_GetOffset(ShamanSpellScrollFrame)
  969.         button = ShamanSpellScrollFrame.buttons[index]
  970.         button.index = offset
  971.         if offset <= #ShamanSpellList then
  972.             button:SetText(ShamanSpellList[offset].spellLink)
  973.             button:Show()
  974.         else
  975.             button:Hide()
  976.         end
  977.     end
  978. end
  979. local function updateShamanSpellChatList()
  980.     currentClassSpellList = {}
  981.     for k, v in pairs(ShamanSpellList) do
  982.         if v.spellID == VariableList.currentClassSpellID then
  983.             currentClassSpellList = v.spellChatList
  984.         end
  985.     end
  986.     FauxScrollFrame_Update(
  987.         ShamanChatScrollFrame,
  988.         #currentClassSpellList,
  989.         NumberList.spellItemChatScrollButtonNumber,
  990.         NumberList.spellItemChatScrollButtonHeight
  991.     )
  992.     for index = 1, NumberList.spellItemChatScrollButtonNumber do
  993.         offset = index + FauxScrollFrame_GetOffset(ShamanChatScrollFrame)
  994.         button = ShamanChatScrollFrame.buttons[index]
  995.         button.index = offset
  996.         if offset <= #currentClassSpellList then
  997.             button:SetText(currentClassSpellList[offset])
  998.             button:Show()
  999.         else
  1000.             button:Hide()
  1001.         end
  1002.     end
  1003. end
  1004.  
  1005. local function updateWarlockSpellList()
  1006.     FauxScrollFrame_Update(
  1007.         WarlockSpellScrollFrame,
  1008.         #WarlockSpellList,
  1009.         NumberList.spellItemScrollButtonNumber,
  1010.         NumberList.spellItemScrollButtonHeight
  1011.     )
  1012.     for index = 1, NumberList.spellItemScrollButtonNumber do
  1013.         offset = index + FauxScrollFrame_GetOffset(WarlockSpellScrollFrame)
  1014.         button = WarlockSpellScrollFrame.buttons[index]
  1015.         button.index = offset
  1016.         if offset <= #WarlockSpellList then
  1017.             button:SetText(WarlockSpellList[offset].spellLink)
  1018.             button:Show()
  1019.         else
  1020.             button:Hide()
  1021.         end
  1022.     end
  1023. end
  1024. local function updateWarlockSpellChatList()
  1025.     currentClassSpellList = {}
  1026.     for k, v in pairs(WarlockSpellList) do
  1027.         if v.spellID == VariableList.currentClassSpellID then
  1028.             currentClassSpellList = v.spellChatList
  1029.         end
  1030.     end
  1031.     FauxScrollFrame_Update(
  1032.         WarlockChatScrollFrame,
  1033.         #currentClassSpellList,
  1034.         NumberList.spellItemChatScrollButtonNumber,
  1035.         NumberList.spellItemChatScrollButtonHeight
  1036.     )
  1037.     for index = 1, NumberList.spellItemChatScrollButtonNumber do
  1038.         offset = index + FauxScrollFrame_GetOffset(WarlockChatScrollFrame)
  1039.         button = WarlockChatScrollFrame.buttons[index]
  1040.         button.index = offset
  1041.         if offset <= #currentClassSpellList then
  1042.             button:SetText(currentClassSpellList[offset])
  1043.             button:Show()
  1044.         else
  1045.             button:Hide()
  1046.         end
  1047.     end
  1048. end
  1049.  
  1050. local function updateWarriorSpellList()
  1051.     FauxScrollFrame_Update(
  1052.         WarriorSpellScrollFrame,
  1053.         #WarriorSpellList,
  1054.         NumberList.spellItemScrollButtonNumber,
  1055.         NumberList.spellItemScrollButtonHeight
  1056.     )
  1057.     for index = 1, NumberList.spellItemScrollButtonNumber do
  1058.         offset = index + FauxScrollFrame_GetOffset(WarriorSpellScrollFrame)
  1059.         button = WarriorSpellScrollFrame.buttons[index]
  1060.         button.index = offset
  1061.         if offset <= #WarriorSpellList then
  1062.             button:SetText(WarriorSpellList[offset].spellLink)
  1063.             button:Show()
  1064.         else
  1065.             button:Hide()
  1066.         end
  1067.     end
  1068. end
  1069. local function updateWarriorSpellChatList()
  1070.     currentClassSpellList = {}
  1071.     for k, v in pairs(WarriorSpellList) do
  1072.         if v.spellID == VariableList.currentClassSpellID then
  1073.             currentClassSpellList = v.spellChatList
  1074.         end
  1075.     end
  1076.     FauxScrollFrame_Update(
  1077.         WarriorChatScrollFrame,
  1078.         #currentClassSpellList,
  1079.         NumberList.spellItemChatScrollButtonNumber,
  1080.         NumberList.spellItemChatScrollButtonHeight
  1081.     )
  1082.     for index = 1, NumberList.spellItemChatScrollButtonNumber do
  1083.         offset = index + FauxScrollFrame_GetOffset(WarriorChatScrollFrame)
  1084.         button = WarriorChatScrollFrame.buttons[index]
  1085.         button.index = offset
  1086.         if offset <= #currentClassSpellList then
  1087.             button:SetText(currentClassSpellList[offset])
  1088.             button:Show()
  1089.         else
  1090.             button:Hide()
  1091.         end
  1092.     end
  1093. end
  1094.  
  1095. local function updateItemsSpellList()
  1096.     FauxScrollFrame_Update(
  1097.         ItemsSpellScrollFrame,
  1098.         #SpellChatItemList,
  1099.         NumberList.spellItemScrollButtonNumber,
  1100.         NumberList.spellItemScrollButtonHeight
  1101.     )
  1102.     for index = 1, NumberList.spellItemScrollButtonNumber do
  1103.         offset = index + FauxScrollFrame_GetOffset(ItemsSpellScrollFrame)
  1104.         button = ItemsSpellScrollFrame.buttons[index]
  1105.         button.index = offset
  1106.         if offset <= #SpellChatItemList then
  1107.             button:SetText(SpellChatItemList[offset].itemLink)
  1108.             button:Show()
  1109.         else
  1110.             button:Hide()
  1111.         end
  1112.     end
  1113. end
  1114. local function updateItemsSpellChatList()
  1115.     currentItemList = {}
  1116.     for k, v in pairs(SpellChatItemList) do
  1117.         if v.itemID == VariableList.currentItemID then
  1118.             currentItemList = v.itemChatList
  1119.         end
  1120.     end
  1121.     FauxScrollFrame_Update(
  1122.         ItemsChatScrollFrame,
  1123.         #currentItemList,
  1124.         NumberList.spellItemChatScrollButtonNumber,
  1125.         NumberList.spellItemChatScrollButtonHeight
  1126.     )
  1127.     for index = 1, NumberList.spellItemChatScrollButtonNumber do
  1128.         offset = index + FauxScrollFrame_GetOffset(ItemsChatScrollFrame)
  1129.         button = ItemsChatScrollFrame.buttons[index]
  1130.         button.index = offset
  1131.         if offset <= #currentItemList then
  1132.             button:SetText(currentItemList[offset])
  1133.             button:Show()
  1134.         else
  1135.             button:Hide()
  1136.         end
  1137.     end
  1138. end
  1139.  
  1140. local function updateCurrentHandWaveList()
  1141.     FauxScrollFrame_Update(
  1142.         HandWaveChatScrollFrame,
  1143.         #VariableList.currentHandWaveChatList,
  1144.         NumberList.handWaveScrollButtonNumber,
  1145.         NumberList.handWaveScrollButtonHeight
  1146.     )
  1147.     for index = 1, NumberList.handWaveScrollButtonNumber do
  1148.         offset = index + FauxScrollFrame_GetOffset(HandWaveChatScrollFrame)
  1149.         button = HandWaveChatScrollFrame.buttons[index]
  1150.         button.index = offset
  1151.         if offset <= #VariableList.currentHandWaveChatList then
  1152.             button:SetText(VariableList.currentHandWaveChatList[offset])
  1153.             button:Show()
  1154.         else
  1155.             button:Hide()
  1156.         end
  1157.     end
  1158. end
  1159.  
  1160. local function updateListBasedOnOpenFrame()
  1161.     if DeathKnightSpellChatFrame:IsVisible() then
  1162.         updateDeathKnightSpellList()
  1163.     elseif DemonHunterSpellChatFrame:IsVisible() then
  1164.         updateDemonHunterSpellList()
  1165.     elseif DruidSpellChatFrame:IsVisible() then
  1166.         updateDruidSpellList()
  1167.     elseif HunterSpellChatFrame:IsVisible() then
  1168.         updateHunterSpellList()
  1169.     elseif MageSpellChatFrame:IsVisible() then
  1170.         updateMageSpellList()
  1171.     elseif MonkSpellChatFrame:IsVisible() then
  1172.         updateMonkSpellList()
  1173.     elseif PaladinSpellChatFrame:IsVisible() then
  1174.         updatePaladinSpellList()
  1175.     elseif PriestSpellChatFrame:IsVisible() then
  1176.         updatePriestSpellList()
  1177.     elseif RogueSpellChatFrame:IsVisible() then
  1178.         updateRogueSpellList()
  1179.     elseif ShamanSpellChatFrame:IsVisible() then
  1180.         updateShamanSpellList()
  1181.     elseif WarlockSpellChatFrame:IsVisible() then
  1182.         updateWarlockSpellList()
  1183.     elseif WarriorSpellChatFrame:IsVisible() then
  1184.         updateWarriorSpellList()
  1185.     elseif ItemsSpellChatFrame:IsVisible() then
  1186.         updateItemsSpellList()
  1187.     elseif HandWaveFrameGuildHello:IsVisible() then
  1188.         updateItemsSpellChatList()
  1189.     elseif HandWaveFrameGuildGoodbye:IsVisible() then
  1190.         updateItemsSpellChatList()
  1191.     elseif HandWaveFrameGroupClear:IsVisible() then
  1192.         updateItemsSpellChatList()
  1193.     elseif HandWaveFrameGroupGoodbye:IsVisible() then
  1194.         updateItemsSpellChatList()
  1195.     end
  1196. end
  1197.  
  1198. -- ===========================         button navigation          ===========================
  1199. local function toggleButton(buttonName)
  1200.     closeAllFrames()
  1201.     if buttonName == SpellChatNavigationPanelDeathKnightBtn then
  1202.         updateDeathKnightSpellList()
  1203.         updateDeathKnightSpellChatList()
  1204.         SpellChatNavigationPanel.DeathKnightBtn:SetNormalTexture(ImageList.deathKnightButtonH)
  1205.         DeathKnightSpellChatFrame.AddPhraseTextBox:SetText("")
  1206.         DeathKnightSpellChatFrame:Show()
  1207.         VariableList.currentAddPhraseTextBox = DeathKnightSpellChatFrameAddPhraseTextBox
  1208.     elseif buttonName == SpellChatNavigationPanelDemonHunterBtn then
  1209.         updateDemonHunterSpellList()
  1210.         updateDemonHunterSpellChatList()
  1211.         SpellChatNavigationPanel.DemonHunterBtn:SetNormalTexture(ImageList.demonHunterButtonH)
  1212.         DemonHunterSpellChatFrame.AddPhraseTextBox:SetText("")
  1213.         DemonHunterSpellChatFrame:Show()
  1214.         VariableList.currentAddPhraseTextBox = DemonHunterSpellChatFrameAddPhraseTextBox
  1215.     elseif buttonName == SpellChatNavigationPanelDruidBtn then
  1216.         updateDruidSpellList()
  1217.         updateDruidSpellChatList()
  1218.         SpellChatNavigationPanel.DruidBtn:SetNormalTexture(ImageList.druidButtonH)
  1219.         DruidSpellChatFrame.AddPhraseTextBox:SetText("")
  1220.         DruidSpellChatFrame:Show()
  1221.         VariableList.currentAddPhraseTextBox = DruidSpellChatFrameAddPhraseTextBox
  1222.     elseif buttonName == SpellChatNavigationPanelHunterBtn then
  1223.         updateHunterSpellList()
  1224.         updateHunterSpellChatList()
  1225.         SpellChatNavigationPanel.HunterBtn:SetNormalTexture(ImageList.hunterButtonH)
  1226.         HunterSpellChatFrame.AddPhraseTextBox:SetText("")
  1227.         HunterSpellChatFrame:Show()
  1228.         VariableList.currentAddPhraseTextBox = HunterSpellChatFrameAddPhraseTextBox
  1229.     elseif buttonName == SpellChatNavigationPanelMageBtn then
  1230.         updateMageSpellList()
  1231.         updateMageSpellChatList()
  1232.         SpellChatNavigationPanel.MageBtn:SetNormalTexture(ImageList.mageButtonH)
  1233.         MageSpellChatFrame.AddPhraseTextBox:SetText("")
  1234.         MageSpellChatFrame:Show()
  1235.         VariableList.currentAddPhraseTextBox = MageSpellChatFrameAddPhraseTextBox
  1236.     elseif buttonName == SpellChatNavigationPanelMonkBtn then
  1237.         updateMonkSpellList()
  1238.         updateMonkSpellChatList()
  1239.         SpellChatNavigationPanel.MonkBtn:SetNormalTexture(ImageList.monkButtonH)
  1240.         MonkSpellChatFrame.AddPhraseTextBox:SetText("")
  1241.         MonkSpellChatFrame:Show()
  1242.         VariableList.currentAddPhraseTextBox = MonkSpellChatFrameAddPhraseTextBox
  1243.     elseif buttonName == SpellChatNavigationPanelPaladinBtn then
  1244.         updatePaladinSpellList()
  1245.         updatePaladinSpellChatList()
  1246.         SpellChatNavigationPanel.PaladinBtn:SetNormalTexture(ImageList.paladinButtonH)
  1247.         PaladinSpellChatFrame.AddPhraseTextBox:SetText("")
  1248.         PaladinSpellChatFrame:Show()
  1249.         VariableList.currentAddPhraseTextBox = PaladinSpellChatFrameAddPhraseTextBox
  1250.     elseif buttonName == SpellChatNavigationPanelPriestBtn then
  1251.         updatePriestSpellList()
  1252.         updatePriestSpellChatList()
  1253.         SpellChatNavigationPanel.PriestBtn:SetNormalTexture(ImageList.priestButtonH)
  1254.         PriestSpellChatFrame.AddPhraseTextBox:SetText("")
  1255.         PriestSpellChatFrame:Show()
  1256.         VariableList.currentAddPhraseTextBox = PriestSpellChatFrameAddPhraseTextBox
  1257.     elseif buttonName == SpellChatNavigationPanelRogueBtn then
  1258.         updateRogueSpellList()
  1259.         updateRogueSpellChatList()
  1260.         SpellChatNavigationPanel.RogueBtn:SetNormalTexture(ImageList.rogueButtonH)
  1261.         RogueSpellChatFrame.AddPhraseTextBox:SetText("")
  1262.         RogueSpellChatFrame:Show()
  1263.         VariableList.currentAddPhraseTextBox = RogueSpellChatFrameAddPhraseTextBox
  1264.     elseif buttonName == SpellChatNavigationPanelShamanBtn then
  1265.         updateShamanSpellList()
  1266.         updateShamanSpellChatList()
  1267.         SpellChatNavigationPanel.ShamanBtn:SetNormalTexture(ImageList.shamanButtonH)
  1268.         ShamanSpellChatFrame.AddPhraseTextBox:SetText("")
  1269.         ShamanSpellChatFrame:Show()
  1270.         VariableList.currentAddPhraseTextBox = ShamanSpellChatFrameAddPhraseTextBox
  1271.     elseif buttonName == SpellChatNavigationPanelWarlockBtn then
  1272.         updateWarlockSpellList()
  1273.         updateWarlockSpellChatList()
  1274.         SpellChatNavigationPanel.WarlockBtn:SetNormalTexture(ImageList.warlockButtonH)
  1275.         WarlockSpellChatFrame.AddPhraseTextBox:SetText("")
  1276.         VariableList.currentAddPhraseTextBox = WarlockSpellChatFrameAddPhraseTextBox
  1277.         WarlockSpellChatFrame:Show()
  1278.     elseif buttonName == SpellChatNavigationPanelWarriorBtn then
  1279.         updateWarriorSpellList()
  1280.         updateWarriorSpellChatList()
  1281.         SpellChatNavigationPanel.WarriorBtn:SetNormalTexture(ImageList.warriorButtonH)
  1282.         WarriorSpellChatFrame.AddPhraseTextBox:SetText("")
  1283.         WarriorSpellChatFrame:Show()
  1284.         VariableList.currentAddPhraseTextBox = WarriorSpellChatFrameAddPhraseTextBox
  1285.     elseif buttonName == SpellChatNavigationPanelItemBtn then
  1286.         updateItemsSpellList()
  1287.         updateItemsSpellChatList()
  1288.         SpellChatNavigationPanel.ItemBtn:SetNormalTexture(ImageList.itemButtonH)
  1289.         ItemsSpellChatFrame.AddPhraseTextBox:SetText("")
  1290.         ItemsSpellChatFrame:Show()
  1291.         VariableList.currentAddPhraseTextBox = ItemsSpellChatFrameAddPhraseTextBox
  1292.     elseif buttonName == SpellChatNavigationPanelHandWaveBtn then
  1293.         HandWaveFrame.AddPhraseTextBox:SetText("")
  1294.         updateCurrentHandWaveList()
  1295.         SpellChatNavigationPanel.HandWaveBtn:SetNormalTexture(ImageList.handButtonH)
  1296.         HandWaveFrame:Show()
  1297.         VariableList.currentAddPhraseTextBox = HandWaveFrameAddPhraseTextBox
  1298.     elseif buttonName == SpellChatInterfaceFrameSpellChatBtn1 then
  1299.         SpellChatInterfaceFrame.SpellChatBtn1:SetNormalTexture(ImageList.spellChatButtonH)
  1300.         SpellChatFrame1:Show()
  1301.         VariableList.currentAddPhraseTextBox = nil
  1302.     elseif buttonName == SpellChatInterfaceFrameSpellChatBtn2 then
  1303.         SpellChatInterfaceFrame.SpellChatBtn2:SetNormalTexture(ImageList.spellChatButtonH)
  1304.         SpellChatFrame2:Show()
  1305.         VariableList.currentAddPhraseTextBox = nil
  1306.     end
  1307. end
  1308.  
  1309. local function addSpellToClassSpellList(addSpellID, addSpellLink)
  1310.     tempSpellChatList = {
  1311.         spellLink = addSpellLink,
  1312.         spellID = addSpellID,
  1313.         percentage = 100,
  1314.         isEnabled = true,
  1315.         spellChatList = {}
  1316.     }
  1317.     table.insert(VariableList.currentAddClassSpellList, 1, tempSpellChatList)
  1318. end
  1319.  
  1320. local function getCursorLinkForCurrentPhrase(cursorType, cursorArg1, cursorArg2, cursorArg3)
  1321.     if cursorType == "spell" then
  1322.         spellLink = GetSpellLink(arg3)
  1323.         return spellLink
  1324.     elseif cursorType == "item" then
  1325.         return arg2
  1326.     elseif cursorType == "mount" then
  1327.         _, mountSpellID = C_MountJournal.GetMountInfoByID(arg1)
  1328.         mountLink = GetSpellLink(mountSpellID)
  1329.         return mountLink
  1330.     elseif cursorType == "battlepet" then
  1331.         petLink = C_PetJournal.GetBattlePetLink(arg1)
  1332.         return petLink
  1333.     else
  1334.         printErrorMessages("errorCannotAddLink")
  1335.     end
  1336. end
  1337.  
  1338. local function addChatStringToClassSpellList(addString)
  1339.     for k, v in pairs(VariableList.currentClassSpellList) do
  1340.         if v.spellID == VariableList.currentClassSpellID then
  1341.             table.insert(v.spellChatList, 1, addString)
  1342.         end
  1343.     end
  1344. end
  1345.  
  1346. local function checkIfSpellIsAlreadyListed(checkSpellID)
  1347.     for k, v in pairs(VariableList.currentAddClassSpellList) do
  1348.         if v.spellID == checkSpellID then
  1349.             return true
  1350.         end
  1351.     end
  1352. end
  1353.  
  1354. local function addChatStringToItemChatList(addString)
  1355.     for k, v in pairs(SpellChatItemList) do
  1356.         if v.itemID == VariableList.currentItemID then
  1357.             table.insert(v.itemChatList, 1, addString)
  1358.         end
  1359.     end
  1360. end
  1361.  
  1362. local function checkIfItemIsAlreadyListed(checkItemID)
  1363.     for k, v in pairs(SpellChatItemList) do
  1364.         if v.itemID == checkItemID then
  1365.             return true
  1366.         end
  1367.     end
  1368. end
  1369.  
  1370. local function addItemToItemList(addItemType, addItemID, addItemLink, addItemSpellID)
  1371.     tempItemList = {
  1372.         itemType = addItemType,
  1373.         itemLink = addItemLink,
  1374.         itemID = addItemID,
  1375.         itemSpellID = addItemSpellID,
  1376.         percentage = 100,
  1377.         isEnabled = true,
  1378.         itemChatList = {}
  1379.     }
  1380.     table.insert(SpellChatItemList, 1, tempItemList)
  1381. end
  1382.  
  1383. local function masterAddItemsToList(convertItemType, convertArg1, convertArg2) -- cursor information provides different returns based on the type
  1384.     if cursorType == "item" then -- test cursor type
  1385.         _, itemSpellID = GetItemSpell(arg1)
  1386.         if not itemSpellID then
  1387.             printErrorMessages("errorNoOnuseAction")
  1388.         elseif checkIfItemIsAlreadyListed(arg1) then
  1389.             printErrorMessages("errorAlreadyListed")
  1390.         else
  1391.             addItemToItemList(cursorType, arg1, arg2, itemSpellID)
  1392.         end
  1393.     elseif cursorType == "mount" then
  1394.         mountName, mountSpellID, _, _, _, _, _, _, _, _, _, mountID = C_MountJournal.GetMountInfoByID(arg1)
  1395.         mountLink = GetSpellLink(mountSpellID)
  1396.         if checkIfItemIsAlreadyListed(mountID) then
  1397.             printErrorMessages("errorAlreadyListed")
  1398.         else
  1399.             addItemToItemList(cursorType, mountID, mountLink, mountSpellID)
  1400.         end
  1401.     elseif cursorType == "battlepet" then
  1402.         petLink = C_PetJournal.GetBattlePetLink(arg1)
  1403.         speciesID = C_PetJournal.GetPetInfoByPetID(arg1)
  1404.         if checkIfItemIsAlreadyListed(arg1) then
  1405.             printErrorMessages("errorAlreadyListed")
  1406.         else
  1407.             addItemToItemList(cursorType, arg1, petLink, speciesID)
  1408.         end
  1409.     else
  1410.         printErrorMessages("errorNotAnItem")
  1411.     end
  1412. end
  1413.  
  1414. local function checkIfSuccessfulCastSpellIDIsListed(checkSpellID) -- check to see if the successful spell cast is on the spell/item list
  1415.     for k, v in pairs(VariableList.currentAddClassSpellList) do
  1416.         if v.spellID == checkSpellID then
  1417.             return true
  1418.         end
  1419.     end
  1420.     for k, v in pairs(SpellChatItemList) do
  1421.         if v.itemSpellID == checkSpellID then
  1422.             return true
  1423.         end
  1424.     end
  1425. end
  1426.  
  1427. local function loadSpellHeader() -- fill the header based on the selected spell
  1428.     if VariableList.currentClassSpellList == DeathKnightSpellList then
  1429.         DeathKnightSpellChatFrame.TitleText:SetText(VariableList.currentClassSpellLink)
  1430.         DeathKnightSpellChatFrame.PercentageTextBox:SetNumber(VariableList.currentClassSpellPercentage)
  1431.         DeathKnightSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  1432.         DeathKnightSpellChatFrame.AddPhraseTextBox:SetFocus(true)
  1433.     elseif VariableList.currentClassSpellList == DemonHunterSpellList then
  1434.         DemonHunterSpellChatFrame.TitleText:SetText(VariableList.currentClassSpellLink)
  1435.         DemonHunterSpellChatFrame.PercentageTextBox:SetNumber(VariableList.currentClassSpellPercentage)
  1436.         DemonHunterSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  1437.         DemonHunterSpellChatFrame.AddPhraseTextBox:SetFocus(true)
  1438.     elseif VariableList.currentClassSpellList == DruidSpellList then
  1439.         DruidSpellChatFrame.TitleText:SetText(VariableList.currentClassSpellLink)
  1440.         DruidSpellChatFrame.PercentageTextBox:SetNumber(VariableList.currentClassSpellPercentage)
  1441.         DruidSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  1442.         DruidSpellChatFrame.AddPhraseTextBox:SetFocus(true)
  1443.     elseif VariableList.currentClassSpellList == HunterSpellList then
  1444.         HunterSpellChatFrame.TitleText:SetText(VariableList.currentClassSpellLink)
  1445.         HunterSpellChatFrame.PercentageTextBox:SetNumber(VariableList.currentClassSpellPercentage)
  1446.         HunterSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  1447.         HunterSpellChatFrame.AddPhraseTextBox:SetFocus(true)
  1448.     elseif VariableList.currentClassSpellList == MageSpellList then
  1449.         MageSpellChatFrame.TitleText:SetText(VariableList.currentClassSpellLink)
  1450.         MageSpellChatFrame.PercentageTextBox:SetNumber(VariableList.currentClassSpellPercentage)
  1451.         MageSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  1452.         MageSpellChatFrame.AddPhraseTextBox:SetFocus(true)
  1453.     elseif VariableList.currentClassSpellList == MonkSpellList then
  1454.         MonkSpellChatFrame.TitleText:SetText(VariableList.currentClassSpellLink)
  1455.         MonkSpellChatFrame.PercentageTextBox:SetNumber(VariableList.currentClassSpellPercentage)
  1456.         MonkSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  1457.         MonkSpellChatFrame.AddPhraseTextBox:SetFocus(true)
  1458.     elseif VariableList.currentClassSpellList == PaladinSpellList then
  1459.         PaladinSpellChatFrame.TitleText:SetText(VariableList.currentClassSpellLink)
  1460.         PaladinSpellChatFrame.PercentageTextBox:SetNumber(VariableList.currentClassSpellPercentage)
  1461.         PaladinSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  1462.         PaladinSpellChatFrame.AddPhraseTextBox:SetFocus(true)
  1463.     elseif VariableList.currentClassSpellList == PriestSpellList then
  1464.         PriestSpellChatFrame.TitleText:SetText(VariableList.currentClassSpellLink)
  1465.         PriestSpellChatFrame.PercentageTextBox:SetNumber(VariableList.currentClassSpellPercentage)
  1466.         PriestSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  1467.         PriestSpellChatFrame.AddPhraseTextBox:SetFocus(true)
  1468.     elseif VariableList.currentClassSpellList == RogueSpellList then
  1469.         RogueSpellChatFrame.TitleText:SetText(VariableList.currentClassSpellLink)
  1470.         RogueSpellChatFrame.PercentageTextBox:SetNumber(VariableList.currentClassSpellPercentage)
  1471.         RogueSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  1472.         RogueSpellChatFrame.AddPhraseTextBox:SetFocus(true)
  1473.     elseif VariableList.currentClassSpellList == ShamanSpellList then
  1474.         ShamanSpellChatFrame.TitleText:SetText(VariableList.currentClassSpellLink)
  1475.         ShamanSpellChatFrame.PercentageTextBox:SetNumber(VariableList.currentClassSpellPercentage)
  1476.         ShamanSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  1477.         ShamanSpellChatFrame.AddPhraseTextBox:SetFocus(true)
  1478.     elseif VariableList.currentClassSpellList == WarlockSpellList then
  1479.         WarlockSpellChatFrame.TitleText:SetText(VariableList.currentClassSpellLink)
  1480.         WarlockSpellChatFrame.PercentageTextBox:SetNumber(VariableList.currentClassSpellPercentage)
  1481.         WarlockSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  1482.         WarlockSpellChatFrame.AddPhraseTextBox:SetFocus(true)
  1483.     elseif VariableList.currentClassSpellList == WarriorSpellList then
  1484.         WarriorSpellChatFrame.TitleText:SetText(VariableList.currentClassSpellLink)
  1485.         WarriorSpellChatFrame.PercentageTextBox:SetNumber(VariableList.currentClassSpellPercentage)
  1486.         WarriorSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  1487.         WarriorSpellChatFrame.AddPhraseTextBox:SetFocus(true)
  1488.     end
  1489. end
  1490.  
  1491. local function loadItemHeader() -- fill the header based on the selected item
  1492.     ItemsSpellChatFrame.TitleText:SetText(VariableList.currentItemLink)
  1493.     ItemsSpellChatFrame.PercentageTextBox:SetNumber(VariableList.currentItemPercentage)
  1494.     ItemsSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentItemEnabled)
  1495.     ItemsSpellChatFrame.AddPhraseTextBox:SetFocus(true)
  1496. end
  1497.  
  1498. local function clearCurrentClassSpell() -- delete the currently selected spell including any associated chats
  1499.     for k, v in pairs(VariableList.currentClassSpellList) do
  1500.         if v.spellID == VariableList.currentClassSpellID then
  1501.             table.remove(VariableList.currentClassSpellList, k)
  1502.         end
  1503.     end
  1504.     if VariableList.currentClassSpellList == DeathKnightSpellList then
  1505.         DeathKnightSpellChatFrame.TitleText:SetText("")
  1506.         DeathKnightSpellChatFrame.PercentageTextBox:SetText("")
  1507.         DeathKnightSpellChatFrame.EnableCheckbox:SetChecked(false)
  1508.     elseif VariableList.currentClassSpellList == DemonHunterSpellList then
  1509.         DemonHunterSpellChatFrame.TitleText:SetText("")
  1510.         DemonHunterSpellChatFrame.PercentageTextBox:SetText("")
  1511.         DemonHunterSpellChatFrame.EnableCheckbox:SetChecked(false)
  1512.     elseif VariableList.currentClassSpellList == DruidSpellList then
  1513.         DruidSpellChatFrame.TitleText:SetText("")
  1514.         DruidSpellChatFrame.PercentageTextBox:SetText("")
  1515.         DruidSpellChatFrame.EnableCheckbox:SetChecked(false)
  1516.     elseif VariableList.currentClassSpellList == HunterSpellList then
  1517.         HunterSpellChatFrame.TitleText:SetText("")
  1518.         HunterSpellChatFrame.PercentageTextBox:SetText("")
  1519.         HunterSpellChatFrame.EnableCheckbox:SetChecked(false)
  1520.     elseif VariableList.currentClassSpellList == MageSpellList then
  1521.         MageSpellChatFrame.TitleText:SetText("")
  1522.         MageSpellChatFrame.PercentageTextBox:SetText("")
  1523.         MageSpellChatFrame.EnableCheckbox:SetChecked(false)
  1524.     elseif VariableList.currentClassSpellList == MonkSpellList then
  1525.         MonkSpellChatFrame.TitleText:SetText("")
  1526.         MonkSpellChatFrame.PercentageTextBox:SetText("")
  1527.         MonkSpellChatFrame.EnableCheckbox:SetChecked(false)
  1528.     elseif VariableList.currentClassSpellList == PaladinSpellList then
  1529.         PaladinSpellChatFrame.TitleText:SetText("")
  1530.         PaladinSpellChatFrame.PercentageTextBox:SetText("")
  1531.         PaladinSpellChatFrame.EnableCheckbox:SetChecked(false)
  1532.     elseif VariableList.currentClassSpellList == PriestSpellList then
  1533.         PriestSpellChatFrame.TitleText:SetText("")
  1534.         PriestSpellChatFrame.PercentageTextBox:SetText("")
  1535.         PriestSpellChatFrame.EnableCheckbox:SetChecked(false)
  1536.     elseif VariableList.currentClassSpellList == RogueSpellList then
  1537.         RogueSpellChatFrame.TitleText:SetText("")
  1538.         RogueSpellChatFrame.PercentageTextBox:SetText("")
  1539.         RogueSpellChatFrame.EnableCheckbox:SetChecked(false)
  1540.     elseif VariableList.currentClassSpellList == ShamanSpellList then
  1541.         ShamanSpellChatFrame.TitleText:SetText("")
  1542.         ShamanSpellChatFrame.PercentageTextBox:SetText("")
  1543.         ShamanSpellChatFrame.EnableCheckbox:SetChecked(false)
  1544.     elseif VariableList.currentClassSpellList == WarlockSpellList then
  1545.         WarlockSpellChatFrame.TitleText:SetText("")
  1546.         WarlockSpellChatFrame.PercentageTextBox:SetText("")
  1547.         WarlockSpellChatFrame.EnableCheckbox:SetChecked(false)
  1548.     elseif VariableList.currentClassSpellList == WarriorSpellList then
  1549.         WarriorSpellChatFrame.TitleText:SetText("")
  1550.         WarriorSpellChatFrame.PercentageTextBox:SetText("")
  1551.         WarriorSpellChatFrame.EnableCheckbox:SetChecked(false)
  1552.     end
  1553. end
  1554.  
  1555. local function clearCurrentItem() -- delete the currently selected item including any associated chats
  1556.     for k, v in pairs(SpellChatItemList) do
  1557.         if v.itemID == VariableList.currentItemID then
  1558.             table.remove(SpellChatItemList, k)
  1559.         end
  1560.     end
  1561.     ItemsSpellChatFrame.TitleText:SetText("")
  1562.     ItemsSpellChatFrame.PercentageTextBox:SetText("")
  1563.     ItemsSpellChatFrame.EnableCheckbox:SetChecked(false)
  1564. end
  1565.  
  1566. local function clearCurrentClassSpellChat() -- clears all chats from the currently selected spell
  1567.     for k, v in pairs(VariableList.currentClassSpellList) do
  1568.         if v.spellID == VariableList.currentClassSpellID then
  1569.             for a, b in pairs(v.spellChatList) do
  1570.                 if b == VariableList.currentClassSpellPhrase then
  1571.                     table.remove(v.spellChatList, a)
  1572.                 end
  1573.             end
  1574.         end
  1575.     end
  1576. end
  1577.  
  1578. local function clearCurrentItemSpellChat() -- clears all chats from the currently selected item
  1579.     for k, v in pairs(SpellChatItemList) do
  1580.         if v.itemID == VariableList.currentItemID then
  1581.             for a, b in pairs(v.itemChatList) do
  1582.                 if b == VariableList.currentItemPhrase then
  1583.                     table.remove(v.itemChatList, a)
  1584.                 end
  1585.             end
  1586.         end
  1587.     end
  1588. end
  1589.  
  1590. local function clearCurrentHandWaveChatPhrase() -- clear all chats from the currently selected hand chats
  1591.     for k, v in pairs(VariableList.currentHandWaveChatList) do
  1592.         if v == VariableList.currentHandWaveChatPhrase then
  1593.             table.remove(VariableList.currentHandWaveChatList, k)
  1594.         end
  1595.     end
  1596. end
  1597.  
  1598. local function updateSpellPercentage(updatePercentageNumber)
  1599.     if updatePercentageNumber >= 101 then -- if the entered number is too high
  1600.         updatePercentageNumber = 100
  1601.     elseif updatePercentageNumber <= 9 then -- if the entered number is too low
  1602.         updatePercentageNumber = 10
  1603.     end
  1604.     for k, v in pairs(VariableList.currentClassSpellList) do
  1605.         if v.spellID == VariableList.currentClassSpellID then
  1606.             v.percentage = updatePercentageNumber
  1607.         end
  1608.     end
  1609.     if VariableList.currentClassSpellList == DeathKnightSpellList then
  1610.         DeathKnightSpellChatFrame.PercentageTextBox:SetNumber(updatePercentageNumber)
  1611.     elseif updateClassList == DemonHunterSpellList then
  1612.         DemonHunterSpellChatFrame.PercentageTextBox:SetNumber(updatePercentageNumber)
  1613.     elseif updateClassList == DruidSpellList then
  1614.         DruidSpellChatFrame.PercentageTextBox:SetNumber(updatePercentageNumber)
  1615.     elseif updateClassList == HunterSpellList then
  1616.         HunterSpellChatFrame.PercentageTextBox:SetNumber(updatePercentageNumber)
  1617.     elseif updateClassList == MageSpellList then
  1618.         MageSpellChatFrame.PercentageTextBox:SetNumber(updatePercentageNumber)
  1619.     elseif updateClassList == MonkSpellList then
  1620.         MonkSpellChatFrame.PercentageTextBox:SetNumber(updatePercentageNumber)
  1621.     elseif updateClassList == PaladinSpellList then
  1622.         PaladinSpellChatFrame.PercentageTextBox:SetNumber(updatePercentageNumber)
  1623.     elseif updateClassList == PriestSpellList then
  1624.         PriestSpellChatFrame.PercentageTextBox:SetNumber(updatePercentageNumber)
  1625.     elseif updateClassList == RogueSpellList then
  1626.         RogueSpellChatFrame.PercentageTextBox:SetNumber(updatePercentageNumber)
  1627.     elseif updateClassList == ShamanSpellList then
  1628.         ShamanSpellChatFrame.PercentageTextBox:SetNumber(updatePercentageNumber)
  1629.     elseif updateClassList == WarlockSpellList then
  1630.         WarlockSpellChatFrame.PercentageTextBox:SetNumber(updatePercentageNumber)
  1631.     elseif updateClassList == WarriorSpellList then
  1632.         WarriorSpellChatFrame.PercentageTextBox:SetNumber(updatePercentageNumber)
  1633.     end
  1634. end
  1635.  
  1636. local function updateItemPercentage(updatePercentageNumber)
  1637.     if updatePercentageNumber >= 101 then -- if the entered number is too high
  1638.         updatePercentageNumber = 100
  1639.     elseif updatePercentageNumber <= 9 then -- if the entered number is too low
  1640.         updatePercentageNumber = 10
  1641.     end
  1642.     for k, v in pairs(SpellChatItemList) do
  1643.         if v.itemID == VariableList.currentItemID then
  1644.             v.percentage = updatePercentageNumber
  1645.         end
  1646.     end
  1647.     ItemsSpellChatFrame.PercentageTextBox:SetNumber(updatePercentageNumber)
  1648. end
  1649.  
  1650. local function updateScalePercentage(updateScaleNumber, updateScaleType)
  1651.     if updateScaleNumber >= 301 then -- if the entered number is too high
  1652.         updateScaleNumber = 300
  1653.     elseif updateScaleNumber <= 49 then -- if the entered number is too low
  1654.         updateScaleNumber = 50
  1655.     end
  1656.     saveScaleNumber = updateScaleNumber / 100
  1657.     if updateScaleType == "SpellChatFrameScaleTextBox" then
  1658.         SpellChatInterfaceFrame:SetScale(saveScaleNumber)
  1659.         SpellChatOptionsList.spellChatFrameScale = saveScaleNumber
  1660.         SpellChatFrame1.SpellChatFrameScaleTextBox:SetNumber(updateScaleNumber)
  1661.     elseif updateScaleType == "MagicButtonScaleTextBox" then
  1662.         spellChatMagicButton:SetScale(saveScaleNumber)
  1663.         SpellChatOptionsList.magicButtonScale = saveScaleNumber
  1664.         SpellChatFrame1.MagicButtonScaleTextBox:SetNumber(updateScaleNumber)
  1665.     elseif updateScaleType == "ButtonGridScaleTextBox" then
  1666.         HandWaveButtonGridFrame:SetScale(saveScaleNumber)
  1667.         SpellChatOptionsList.buttonBoxScale = saveScaleNumber
  1668.         SpellChatFrame1.ButtonGridScaleTextBox:SetText(updateScaleNumber)
  1669.     end
  1670. end
  1671.  
  1672. local function updateOpacityPercentage(updateOpacityNumber, updateOpacityType)
  1673.     if updateOpacityNumber >= 101 then -- if the entered number is too high
  1674.         updateOpacityNumber = 100
  1675.     elseif updateOpacityNumber <= 24 then -- if the entered number is too low
  1676.         updateOpacityNumber = 25
  1677.     end
  1678.     saveOpacityNumber = updateOpacityNumber / 100
  1679.     if updateOpacityType == "MagicButtonOpacityTextBox" then
  1680.         spellChatMagicButton:SetAlpha(saveOpacityNumber)
  1681.         SpellChatOptionsList.magicButtonOpacity = saveOpacityNumber
  1682.         SpellChatFrame1.MagicButtonOpacityTextBox:SetNumber(updateOpacityNumber)
  1683.     elseif updateOpacityType == "ButtonGridOpacityTextBox" then
  1684.         HandWaveButtonGridFrame:SetAlpha(saveOpacityNumber)
  1685.         SpellChatOptionsList.buttonBoxOpacity = saveOpacityNumber
  1686.         SpellChatFrame1.ButtonGridOpacityTextBox:SetNumber(updateOpacityNumber)
  1687.     end
  1688. end
  1689.  
  1690. local function updateSpellEnabled()
  1691.     for k, v in pairs(VariableList.currentClassSpellList) do
  1692.         if v.currentItemID == VariableList.currentItemID then
  1693.             v.isEnabled = VariableList.currentItemEnabled
  1694.         end
  1695.     end
  1696. end
  1697.  
  1698. local function updateItemEnabled()
  1699.     for k, v in pairs(SpellChatItemList) do
  1700.         if v.itemID == VariableList.currentItemID then
  1701.             v.isEnabled = VariableList.currentItemEnabled
  1702.         end
  1703.     end
  1704. end
  1705.  
  1706. local function clearCurrentChatList()
  1707.     for k, v in pairs(VariableList.currentClassSpellList) do
  1708.         if v.spellID == VariableList.currentClassSpellID then
  1709.             wipe(v.spellChatList)
  1710.         end
  1711.     end
  1712. end
  1713.  
  1714. local function clearCurrentItemChatList()
  1715.     for k, v in pairs(SpellChatItemList) do
  1716.         if v.itemID == VariableList.currentItemID then
  1717.             wipe(v.itemChatList)
  1718.         end
  1719.     end
  1720. end
  1721.  
  1722. local function randomPercentageTest(percentage)
  1723.     randomNumber = math.random(1, 100)
  1724.     if percentage >= randomNumber then
  1725.         return true
  1726.     end
  1727. end
  1728.  
  1729. local function sendSpellChatPhraseToGroupChat(chatPhrase) -- send the phrase to the correct chat channel
  1730.     isInInstance = IsInInstance()
  1731.     if IsInLFGDungeon() or isInInstance then
  1732.         SendChatMessage(chatPhrase, "INSTANCE_CHAT")
  1733.         ChatEdit_ChooseBoxForSend():SetAttribute("chatType", "INSTANCE_CHAT") -- set sticky channel
  1734.     elseif IsInRaid() then
  1735.         SendChatMessage(chatPhrase, "RAID")
  1736.         ChatEdit_ChooseBoxForSend():SetAttribute("chatType", "RAID") -- set sticky channel
  1737.     elseif IsInGroup() then
  1738.         SendChatMessage(chatPhrase, "PARTY")
  1739.         ChatEdit_ChooseBoxForSend():SetAttribute("chatType", "PARTY") -- set sticky channel
  1740.     end
  1741. end
  1742.  
  1743. local function spellChatMainSpellPhraseFunction(spellID)
  1744.     if IsInRaid() or IsInGroup() then -- must be in a group
  1745.         for k, v in pairs(VariableList.currentAddClassSpellList) do -- take spellID and test against each list
  1746.             if v.spellID == spellID then -- if a match is found
  1747.                 if randomPercentageTest(v.percentage) then -- test random number against spell percentage
  1748.                     if #v.spellChatList > 0 then -- if no chat list stop
  1749.                         randomNumber = math.random(1, #v.spellChatList) -- generate random number based on chat list size
  1750.                         sendSpellChatPhraseToGroupChat(v.spellChatList[randomNumber]) -- get the phrase at the random entry and send to print
  1751.                         return -- return out of function
  1752.                     end
  1753.                 end
  1754.             end
  1755.         end
  1756.         for k, v in pairs(SpellChatItemList) do
  1757.             if v.itemSpellID == spellID then
  1758.                 if randomPercentageTest(v.percentage) then
  1759.                     if #v.itemChatList > 0 then
  1760.                         randomNumber = math.random(1, #v.itemChatList)
  1761.                         sendSpellChatPhraseToGroupChat(v.itemChatList[randomNumber])
  1762.                         return
  1763.                     end
  1764.                 end
  1765.             end
  1766.         end
  1767.     end
  1768.     printErrorMessages("errorNotInAGroup")
  1769. end
  1770.  
  1771. local function groupChatMainPhraseFunction(chatType) -- send phrase to correct chat channel
  1772.     if chatType == "guildHello" then
  1773.         randomNumber = math.random(1, #SpellChatGuildHelloList)
  1774.         SendChatMessage(SpellChatGuildHelloList[randomNumber], "GUILD")
  1775.         ChatEdit_ChooseBoxForSend():SetAttribute("chatType", "GUILD") -- set sticky channel
  1776.     elseif chatType == "guildGoodbye" then
  1777.         if #SpellChatGuildGoodbyeList > 0 then
  1778.             randomNumber = math.random(1, #SpellChatGuildGoodbyeList)
  1779.             SendChatMessage(SpellChatGuildGoodbyeList[randomNumber], "GUILD")
  1780.             ChatEdit_ChooseBoxForSend():SetAttribute("chatType", "GUILD") -- set sticky channel
  1781.         end
  1782.     elseif chatType == "groupHello" then
  1783.         if #SpellChatGroupHelloList > 0 then
  1784.             randomNumber = math.random(1, #SpellChatGroupHelloList)
  1785.             sendSpellChatPhraseToGroupChat(SpellChatGroupHelloList[randomNumber])
  1786.         end
  1787.     elseif chatType == "groupGoodbye" then
  1788.         if #SpellChatGroupGoodbyeList > 0 then
  1789.             randomNumber = math.random(1, #SpellChatGroupGoodbyeList)
  1790.             sendSpellChatPhraseToGroupChat(SpellChatGroupGoodbyeList[randomNumber])
  1791.         end
  1792.     elseif chatType == "generalChat1" then
  1793.         --        ChatEdit_ChooseBoxForSend():SetAttribute("chatType", "1. General - Garrison") -- cannot auto set sticky channel  -- debug
  1794.         randomNumber = math.random(1, #SpellChatGeneral1List)
  1795.         SendChatMessage(SpellChatGeneral1List[randomNumber], "CHANNEL", nil, 1)
  1796.     elseif chatType == "generalChat2" then
  1797.         randomNumber = math.random(1, #SpellChatGeneral2List)
  1798.         SendChatMessage(SpellChatGeneral2List[randomNumber], "CHANNEL", nil, 1)
  1799.     elseif chatType == "tradeChat1" then
  1800.         randomNumber = math.random(1, #SpellChatTrade1List)
  1801.         SendChatMessage(SpellChatTrade1List[randomNumber], "CHANNEL", nil, 2)
  1802.     elseif chatType == "tradeChat2" then
  1803.         randomNumber = math.random(1, #SpellChatTrade2List)
  1804.         SendChatMessage(SpellChatTrade2List[randomNumber], "CHANNEL", nil, 2)
  1805.     elseif chatType == "lfgChat1" then
  1806.         randomNumber = math.random(1, #SpellChatLFG1List)
  1807.         SendChatMessage(SpellChatLFG1List[randomNumber], "CHANNEL", nil, 4)
  1808.     elseif chatType == "lfgChat2" then
  1809.         randomNumber = math.random(1, #SpellChatLFG2List)
  1810.         SendChatMessage(SpellChatLFG2List[randomNumber], "CHANNEL", nil, 4)
  1811.     end
  1812. end
  1813.  
  1814. -- ===================================================================================================
  1815. -- ===================================================================================================
  1816. -- ===========================         global functions for keybinds       ===========================
  1817. -- ===================================================================================================
  1818. -- ===================================================================================================
  1819.  
  1820. -- ===========================         run guild hello function          ===========================
  1821. function SPCTRUNGUILDHELLOCHATFUNCTION()
  1822.     if #SpellChatGuildHelloList > 0 then
  1823.         if IsInGuild() then
  1824.             groupChatMainPhraseFunction("guildHello")
  1825.         else
  1826.             printErrorMessages("errorNotInAGuild")
  1827.         end
  1828.     else
  1829.         printErrorMessages("errorNoPhrases")
  1830.     end
  1831. end
  1832.  
  1833. -- ===========================         run guild goodbye function          ===========================
  1834. function SPCTRUNGUILDGOODBYECHATFUNCTION()
  1835.     if #SpellChatGuildGoodbyeList > 0 then
  1836.         if IsInGuild() then
  1837.             groupChatMainPhraseFunction("guildGoodbye")
  1838.         else
  1839.             printErrorMessages("errorNotInAGuild")
  1840.         end
  1841.     else
  1842.         printErrorMessages("errorNoPhrases")
  1843.     end
  1844. end
  1845.  
  1846. -- ===========================         run group hello function          ===========================
  1847. function SPCTRUNGROUPHELLOCHATFUNCTION()
  1848.     if #SpellChatGroupHelloList > 0 then
  1849.         if IsInRaid() or IsInGroup() then
  1850.             groupChatMainPhraseFunction("groupHello")
  1851.         else
  1852.             printErrorMessages("errorNotInAGroup")
  1853.         end
  1854.     else
  1855.         printErrorMessages("errorNoPhrases")
  1856.     end
  1857. end
  1858.  
  1859. -- ===========================         run group goodbye function          ===========================
  1860. function SPCTRUNGROUPGOODBYECHATFUNCTION()
  1861.     if #SpellChatGroupGoodbyeList > 0 then
  1862.         if IsInRaid() or IsInGroup() then
  1863.             groupChatMainPhraseFunction("groupGoodbye")
  1864.         else
  1865.             printErrorMessages("errorNotInAGroup")
  1866.         end
  1867.     else
  1868.         printErrorMessages("errorNoPhrases")
  1869.     end
  1870. end
  1871.  
  1872. -- ===========================         run general 1 function          ===========================
  1873. function SPCTRUNGENERALCHANNELCHAT1FUNCTION()
  1874.     if #SpellChatGeneral1List > 0 then
  1875.         groupChatMainPhraseFunction("generalChat1")
  1876.     else
  1877.         printErrorMessages("errorNoPhrases")
  1878.     end
  1879. end
  1880.  
  1881. -- ===========================         run general 2 function          ===========================
  1882. function SPCTRUNGENERALCHANNELCHAT2FUNCTION()
  1883.     if #SpellChatGeneral2List > 0 then
  1884.         groupChatMainPhraseFunction("generalChat2")
  1885.     else
  1886.         printErrorMessages("errorNoPhrases")
  1887.     end
  1888. end
  1889.  
  1890. -- ===========================         run trade 1 function          ===========================
  1891. function SPCTRUNTRADECHANNELCHAT1FUNCTION()
  1892.     if #SpellChatTrade1List > 0 then
  1893.         groupChatMainPhraseFunction("tradeChat1")
  1894.     else
  1895.         printErrorMessages("errorNoPhrases")
  1896.     end
  1897. end
  1898.  
  1899. -- ===========================         run trade 2 function          ===========================
  1900. function SPCTRUNTRADECHANNELCHAT2FUNCTION()
  1901.     if #SpellChatTrade2List > 0 then
  1902.         groupChatMainPhraseFunction("tradeChat2")
  1903.     else
  1904.         printErrorMessages("errorNoPhrases")
  1905.     end
  1906. end
  1907.  
  1908. -- ===========================         run lfg 1 function          ===========================
  1909. function SPCTRUNLFGCHANNELCHAT1FUNCTION()
  1910.     if #SpellChatLFG1List > 0 then
  1911.         groupChatMainPhraseFunction("lfgChat1")
  1912.     else
  1913.         printErrorMessages("errorNoPhrases")
  1914.     end
  1915. end
  1916.  
  1917. -- ===========================         run lfg 2 function          ===========================
  1918. function SPCTRUNLFGCHANNELCHAT2FUNCTION()
  1919.     if #SpellChatLFG2List > 0 then
  1920.         groupChatMainPhraseFunction("lfgChat2")
  1921.     else
  1922.         printErrorMessages("errorNoPhrases")
  1923.     end
  1924. end
  1925.  
  1926. -- ===========================         toggle spellchat interface frame          ===========================
  1927. function SPCTTOGGLESPELLCHATINTERFACEFRAME()
  1928.     if SpellChatInterfaceFrame:IsShown() then
  1929.         SpellChatInterfaceFrame:Hide()
  1930.     else
  1931.         SpellChatInterfaceFrame:Show()
  1932.     end
  1933. end
  1934.  
  1935. -- ===========================         reset spellchat UI layout          ===========================
  1936. function SPCTRESETSPELLCHATUILAYOUT()
  1937.     SpellChatInterfaceFrame:ClearAllPoints()
  1938.     SpellChatOptionsList.spellChatFrameScale = 1
  1939.     SpellChatInterfaceFrame:SetScale(1)
  1940.     SpellChatFrame1.SpellChatFrameScaleTextBox:SetNumber(100)
  1941.     SpellChatInterfaceFrame:SetPoint("CENTER")
  1942.     spellChatMagicButton:ClearAllPoints()
  1943.     SpellChatOptionsList.magicButtonScale = 1
  1944.     spellChatMagicButton:SetScale(1)
  1945.     SpellChatFrame1.MagicButtonScaleTextBox:SetNumber(100)
  1946.     SpellChatOptionsList.magicButtonOpacity = 1
  1947.     spellChatMagicButton:SetAlpha(1)
  1948.     SpellChatFrame1.MagicButtonOpacityTextBox:SetNumber(100)
  1949.     spellChatMagicButton:SetPoint("BOTTOMRIGHT", SpellChatInterfaceFrame, "TOPRIGHT")
  1950.     HandWaveButtonGridFrame:ClearAllPoints()
  1951.     SpellChatOptionsList.buttonBoxScale = 1
  1952.     HandWaveButtonGridFrame:SetScale(1)
  1953.     SpellChatFrame1.ButtonGridScaleTextBox:SetText(100)
  1954.     SpellChatOptionsList.buttonBoxOpacity = 1
  1955.     HandWaveButtonGridFrame:SetAlpha(1)
  1956.     SpellChatFrame1.ButtonGridOpacityTextBox:SetText(100)
  1957.     HandWaveButtonGridFrame:SetPoint("TOPLEFT", SpellChatInterfaceFrame, "TOPRIGHT")
  1958.     if not SpellChatInterfaceFrame:IsVisible() then
  1959.         SpellChatInterfaceFrame:Show()
  1960.     end
  1961. end
  1962.  
  1963. -- ===================================================================================================
  1964. -- ===================================================================================================
  1965. -- ===========================         slash commands          ===========================
  1966. -- ===================================================================================================
  1967. -- ===================================================================================================
  1968.  
  1969. -- ===========================         clear all lists          ===========================
  1970. SLASH_CLEARALLSPELLITEMLISTS1 = "/SPCTC"
  1971. function SlashCmdList.CLEARALLSPELLITEMLISTS(msg, editbox)
  1972.     wipe(DeathKnightSpellList)
  1973.     wipe(DemonHunterSpellList)
  1974.     wipe(DruidSpellList)
  1975.     wipe(HunterSpellList)
  1976.     wipe(MageSpellList)
  1977.     wipe(MonkSpellList)
  1978.     wipe(PaladinSpellList)
  1979.     wipe(PriestSpellList)
  1980.     wipe(RogueSpellList)
  1981.     wipe(ShamanSpellList)
  1982.     wipe(WarlockSpellList)
  1983.     wipe(WarriorSpellList)
  1984.     wipe(SpellChatGuildHelloList)
  1985.     wipe(SpellChatGuildGoodbyeList)
  1986.     wipe(SpellChatGroupHelloList)
  1987.     wipe(SpellChatGroupGoodbyeList)
  1988.     wipe(SpellChatGeneral1List)
  1989.     wipe(SpellChatGeneral2List)
  1990.     wipe(SpellChatTrade1List)
  1991.     wipe(SpellChatTrade2List)
  1992.     wipe(SpellChatLFG1List)
  1993.     wipe(SpellChatLFG2List)
  1994.     wipe(SpellChatItemList)
  1995.     if SpellChatInterfaceFrame:IsVisible() then
  1996.         updateListBasedOnOpenFrame()
  1997.     end
  1998.     if VariableList.currentHandWaveChatList then
  1999.         VariableList.currentHandWaveChatList = SpellChatGuildHelloList
  2000.         updateCurrentHandWaveList()
  2001.     end
  2002.     print(TextList.clearAllListsText)
  2003. end
  2004. -- ===========================         run guild hello function          ===========================
  2005. SLASH_SPCTRUNGUILDHELLOCHATFUNCTION1 = "/SPCGDH"
  2006. function SlashCmdList.SPCTRUNGUILDHELLOCHATFUNCTION(msg, editbox)
  2007.     SPCTRUNGUILDHELLOCHATFUNCTION()
  2008. end
  2009.  
  2010. -- ===========================         run guild goodbye function          ===========================
  2011. SLASH_SPCTRUNGUILDGOODBYECHATFUNCTION1 = "/SPCGDG"
  2012. function SlashCmdList.SPCTRUNGUILDGOODBYECHATFUNCTION(msg, editbox)
  2013.     SPCTRUNGUILDGOODBYECHATFUNCTION()
  2014. end
  2015.  
  2016. -- ===========================         run group hello function          ===========================
  2017. SLASH_SPCTRUNGROUPHELLOCHATFUNCTION1 = "/SPCGPH"
  2018. function SlashCmdList.SPCTRUNGROUPHELLOCHATFUNCTION(msg, editbox)
  2019.     SPCTRUNGROUPHELLOCHATFUNCTION()
  2020. end
  2021.  
  2022. -- ===========================         run group goodbye function          ===========================
  2023. SLASH_SPCTRUNGROUPGOODBYECHATFUNCTION1 = "/SPCGPG"
  2024. function SlashCmdList.SPCTRUNGROUPGOODBYECHATFUNCTION(msg, editbox)
  2025.     SPCTRUNGROUPGOODBYECHATFUNCTION()
  2026. end
  2027.  
  2028. -- ===========================         run general chat 1 function          ===========================
  2029. SLASH_SPCTRUNGENERALCHANNELCHAT1FUNCTION1 = "/SPCG1"
  2030. function SlashCmdList.SPCTRUNGENERALCHANNELCHAT1FUNCTION(msg, editbox)
  2031.     SPCTRUNGENERALCHANNELCHAT1FUNCTION()
  2032. end
  2033.  
  2034. -- ===========================         run general chat 2 function          ===========================
  2035. SPCTRUNGENERALCHANNELCHAT2FUNCTION1 = "/SPCG2"
  2036. function SlashCmdList.SPCTRUNGENERALCHANNELCHAT2FUNCTION(msg, editbox)
  2037.     SPCTRUNGENERALCHANNELCHAT2FUNCTION()
  2038. end
  2039.  
  2040. -- ===========================         run trade chat 1 function          ===========================
  2041. SPCTRUNTRADECHANNELCHAT1FUNCTION1 = "/SPCT1"
  2042. function SlashCmdList.SPCTRUNTRADECHANNELCHAT1FUNCTION(msg, editbox)
  2043.     SPCTRUNTRADECHANNELCHAT1FUNCTION()
  2044. end
  2045.  
  2046. -- ===========================         run trade chat 2 function          ===========================
  2047. SPCTRUNTRADECHANNELCHAT2FUNCTION1 = "/SPCT2"
  2048. function SlashCmdList.SPCTRUNTRADECHANNELCHAT2FUNCTION(msg, editbox)
  2049.     SPCTRUNTRADECHANNELCHAT2FUNCTION()
  2050. end
  2051.  
  2052. -- ===========================         run lfg chat 1 function          ===========================
  2053. SPCTRUNLFGCHANNELCHAT1FUNCTION1 = "/SPCL1"
  2054. function SlashCmdList.SPCTRUNLFGCHANNELCHAT1FUNCTION(msg, editbox)
  2055.     SPCTRUNLFGCHANNELCHAT1FUNCTION()
  2056. end
  2057.  
  2058. -- ===========================         run lfg chat 2 function          ===========================
  2059. SPCTRUNLFGCHANNELCHAT2FUNCTION1 = "/SPCL2"
  2060. function SlashCmdList.SPCTRUNLFGCHANNELCHAT2FUNCTION(msg, editbox)
  2061.     SPCTRUNLFGCHANNELCHAT2FUNCTION()
  2062. end
  2063.  
  2064. -- ===========================         toggle spellchat interface frame          ===========================
  2065. SLASH_SPCTTOGGLESPELLCHATINTERFACEFRAME1 = "/SPC"
  2066. function SlashCmdList.SPCTTOGGLESPELLCHATINTERFACEFRAME(msg, editbox)
  2067.     SPCTTOGGLESPELLCHATINTERFACEFRAME()
  2068. end
  2069.  
  2070. -- ===========================         reset frame and buttons scales and positions          ===========================
  2071. SLASH_SPCTRESETSPELLCHATUILAYOUT1 = "/SPCPOS"
  2072. function SlashCmdList.SPCTRESETSPELLCHATUILAYOUT(msg, editbox)
  2073.     SPCTRESETSPELLCHATUILAYOUT()
  2074. end
  2075.  
  2076. -- ===========================         reset settings to their defaults          ===========================
  2077. SLASH_SPCTRESETSPELLCHATSETTINGS1 = "/SPCDS"
  2078. function SlashCmdList.SPCTRESETSPELLCHATSETTINGS(msg, editbox)
  2079.     SpellChatOptionsList = nil
  2080.     ReloadUI()
  2081. end
  2082.  
  2083. -- ===================================================================================================
  2084. -- ===================================================================================================
  2085. -- ===========================         Frames          ===========================
  2086. -- ===================================================================================================
  2087. -- ===================================================================================================
  2088.  
  2089. local SpellChatInterfaceFrame = CreateFrame("Frame", "SpellChatInterfaceFrame", UIParent, "BasicFrameTemplateWithInset")
  2090. SpellChatInterfaceFrame:SetSize(NumberList.spellChatMainFrameWidth, NumberList.spellChatMainFrameHeight)
  2091. SpellChatInterfaceFrame:SetScale(1)
  2092. SpellChatInterfaceFrame:ClearAllPoints()
  2093. SpellChatInterfaceFrame:ClearAllPoints()
  2094. SpellChatInterfaceFrame:SetPoint("CENTER")
  2095. SpellChatInterfaceFrame:EnableMouse(true)
  2096. SpellChatInterfaceFrame:SetMovable(true)
  2097. SpellChatInterfaceFrame:SetClampedToScreen(true)
  2098. SpellChatInterfaceFrame:RegisterForDrag("RightButton", "LeftButton")
  2099. SpellChatInterfaceFrame:SetScript("OnDragStart", SpellChatInterfaceFrame.StartMoving)
  2100. SpellChatInterfaceFrame:SetScript("OnDragStop", SpellChatInterfaceFrame.StopMovingOrSizing)
  2101. SpellChatInterfaceFrame:SetToplevel(true)
  2102. SpellChatInterfaceFrame:SetScript(
  2103.     "OnEvent",
  2104.     function(self, event, ...)
  2105.         if event == "PLAYER_LOGIN" then
  2106.             print(TextList.addonLoaded) -- load message
  2107.             initialiseLists()
  2108.             setCheckBoxesAndScales()
  2109.             setCurrentAddClassSpellButtonList()
  2110.             toggleButton(SpellChatInterfaceFrameSpellChatBtn1)
  2111.             handWaveGridFrameButtonLayout()
  2112.             if SpellChatOptionsList.buttonBoxIsHidden then
  2113.                 HandWaveButtonGridFrame:Hide()
  2114.             end
  2115.         elseif event == "UNIT_SPELLCAST_SUCCEEDED" then
  2116.             unit, aa, spellID = ... -- get the casting unit and spellID
  2117.  
  2118.             --            print(" Unit - ", unit, " \naa - ", aa, "\nSpellID -",spellID) -- debug --
  2119.  
  2120.             if SpellChatOptionsList.spellChatEnabled then -- if addon enabled
  2121.                 if unit == "player" and checkIfSuccessfulCastSpellIDIsListed(spellID) then -- if the casting unit is player and the spell is listed
  2122.                     spellChatMainSpellPhraseFunction(spellID) -- print message to current group chat
  2123.                 end
  2124.             end
  2125.         elseif event == "ADDON_LOADED" then
  2126.             local arg1 = ...
  2127.             if arg1 == "Blizzard_AchievementUI" then -- if achievement journal
  2128.                 hooksecurefunc(
  2129.                     "AchievementButton_OnClick", -- hook the achievementbutton_onclick function
  2130.                     function(self)
  2131.                         if IsAltKeyDown() then
  2132.                             if not VariableList.currentAddPhraseTextBox then -- make sure we have a text box
  2133.                                 return
  2134.                             else
  2135.                                 VariableList.currentAddPhraseTextBox:Insert(GetAchievementLink(self.id)) -- insert link into current text box
  2136.                             end
  2137.                         end
  2138.                     end
  2139.                 )
  2140.             elseif arg1 == "Blizzard_EncounterJournal" then -- if adventure journal
  2141.                 hooksecurefunc(
  2142.                     "EncounterJournal_Loot_OnClick", -- hook the item onclick item function
  2143.                     function(self)
  2144.                         if IsAltKeyDown() then
  2145.                             if not VariableList.currentAddPhraseTextBox then -- make sure we have a text box
  2146.                                 return
  2147.                             else
  2148.                                 VariableList.currentAddPhraseTextBox:Insert(self.link) -- insert link into current text box
  2149.                             end
  2150.                         end
  2151.                     end
  2152.                 )
  2153.                 hooksecurefunc(
  2154.                     "EncounterJournalBossButton_OnClick", -- hook the onclick boss function
  2155.                     function(self)
  2156.                         if IsAltKeyDown() then
  2157.                             if not VariableList.currentAddPhraseTextBox then -- make sure we have a text box
  2158.                                 return
  2159.                             else
  2160.                                 VariableList.currentAddPhraseTextBox:Insert(self.link) -- insert link into current text box
  2161.                             end
  2162.                         end
  2163.                     end
  2164.                 )
  2165.                 hooksecurefunc(
  2166.                     "EncounterJournal_OnClick", -- hook the onclick boss abilities function
  2167.                     function(self)
  2168.                         if IsAltKeyDown() then
  2169.                             if not VariableList.currentAddPhraseTextBox then -- make sure we have a text box
  2170.                                 return
  2171.                             else
  2172.                                 VariableList.currentAddPhraseTextBox:Insert(self.link) -- insert link into current text box
  2173.                             end
  2174.                         end
  2175.                     end
  2176.                 )
  2177.             elseif arg1 == "Blizzard_Collections" then -- for all collections
  2178.                 hooksecurefunc(
  2179.                     "HeirloomsJournalSpellButton_OnClick", -- for heirloom collection
  2180.                     function(self) -- hook the heirloomsjournalspellbutton_onclick function
  2181.                         if IsAltKeyDown() then
  2182.                             if not VariableList.currentAddPhraseTextBox then -- make sure we have a text box
  2183.                                 return
  2184.                             else
  2185.                                 VariableList.currentAddPhraseTextBox:Insert(C_Heirloom.GetHeirloomLink(self.itemID)) -- insert link into current text box
  2186.                             end
  2187.                         end
  2188.                     end
  2189.                 )
  2190.                 hooksecurefunc(
  2191.                     "ToySpellButton_OnModifiedClick", -- for toy collection
  2192.                     function(self)
  2193.                         if IsAltKeyDown() then
  2194.                             if not VariableList.currentAddPhraseTextBox then -- make sure we have a text box
  2195.                                 return
  2196.                             else
  2197.                                 VariableList.currentAddPhraseTextBox:Insert(C_ToyBox.GetToyLink(self.itemID)) -- insert link into current text box
  2198.                             end
  2199.                         end
  2200.                     end
  2201.                 )
  2202.                 local petIndex = 0 -- for pet collection
  2203.                 while true do
  2204.                     petIndex = petIndex + 1
  2205.                     local buttonName = "PetJournalListScrollFrameButton" .. petIndex -- loop through the displayed pet buttons
  2206.                     local button = _G[buttonName]
  2207.                     if not button then
  2208.                         break
  2209.                     end
  2210.                     button:HookScript(
  2211.                         "OnClick",
  2212.                         function(self) -- add a hook to each displayed pet button
  2213.                             if IsAltKeyDown() then
  2214.                                 if not VariableList.currentAddPhraseTextBox then -- make sure we have a text box
  2215.                                     return
  2216.                                 else
  2217.                                     local _, _, _, _, _, _, _, speciesName = C_PetJournal.GetPetInfoByIndex(self.index)
  2218.                                     local speciesId, petGUID = C_PetJournal.FindPetIDByName(speciesName)
  2219.                                     if petGUID then
  2220.                                         VariableList.currentAddPhraseTextBox:Insert(
  2221.                                             C_PetJournal.GetBattlePetLink(petGUID)
  2222.                                         ) -- insert link into current text box
  2223.                                     else
  2224.                                         local fakePetLink =
  2225.                                             ColourList.spellChatPetMountLink ..
  2226.                                             "\124Hbattlepet:" ..
  2227.                                                 self.speciesID ..
  2228.                                                     ":1:5:1:::BattlePet--:\124h[" .. speciesName .. "]\124h\124r" -- build fake link as unknown pets have no GUID as their stats and rarities can differ
  2229.                                         VariableList.currentAddPhraseTextBox:Insert(fakePetLink) -- insert fake link into current text box
  2230.                                     end
  2231.                                 end
  2232.                             end
  2233.                         end
  2234.                     )
  2235.                 end
  2236.                 local mountIndex = 0 -- for mount collection
  2237.                 while true do
  2238.                     mountIndex = mountIndex + 1
  2239.                     local buttonName = "MountJournalListScrollFrameButton" .. mountIndex -- loop through the displayed pet buttons
  2240.                     local button = _G[buttonName]
  2241.                     if not button then
  2242.                         break
  2243.                     end
  2244.                     button:HookScript(
  2245.                         "OnClick",
  2246.                         function(self) -- add a hook to each displayed mount button
  2247.                             if IsAltKeyDown() then
  2248.                                 if not VariableList.currentAddPhraseTextBox then -- make sure we have a text box
  2249.                                     return
  2250.                                 else
  2251.                                     VariableList.currentAddPhraseTextBox:Insert(GetSpellLink(self.spellID)) -- insert link into current text box
  2252.                                 end
  2253.                             end
  2254.                         end
  2255.                     )
  2256.                 end
  2257.             end
  2258.         end
  2259.     end
  2260. )
  2261. SpellChatInterfaceFrame:RegisterEvent("PLAYER_LOGIN") -- fires on login or reload
  2262. SpellChatInterfaceFrame:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED") -- fires when spell cast is successful
  2263. -- SpellChatInterfaceFrame:RegisterEvent("UNIT_SPELLCAST_SENT") -- fires when a spell is cast regardless of the success of the cast -- debug --
  2264. SpellChatInterfaceFrame:RegisterEvent("ADDON_LOADED") -- fires when an addon, (including blizz addons), is loaded
  2265. SpellChatInterfaceFrame:Hide()
  2266.  
  2267. SpellChatInterfaceFrame.Banner = CreateFrame("Frame", "SpellChatInterfaceFrameBanner", SpellChatInterfaceFrame)
  2268. SpellChatInterfaceFrame.Banner:SetSize(NumberList.bannerBoxSize, NumberList.bannerBoxSize)
  2269. SpellChatInterfaceFrame.Banner:SetScale(NumberList.bannerScale)
  2270. SpellChatInterfaceFrame.Banner:SetPoint("TOP", 0, -50)
  2271. SpellChatInterfaceFrame.Banner.Texture = SpellChatInterfaceFrame.Banner:CreateTexture(nil, "BACKGROUND")
  2272. SpellChatInterfaceFrame.Banner.Texture:SetPoint("TOP", 0, NumberList.bannerGap)
  2273. SpellChatInterfaceFrame.Banner.Texture:SetTexture(ImageList.spellChatBanner)
  2274.  
  2275. SpellChatInterfaceFrame.SpellChatBtn1 =
  2276.     CreateFrame("Button", "SpellChatInterfaceFrameSpellChatBtn1", SpellChatInterfaceFrame)
  2277. SpellChatInterfaceFrame.SpellChatBtn1:SetPoint(
  2278.     "CENTER",
  2279.     SpellChatInterfaceFrame,
  2280.     "TOPLEFT",
  2281.     NumberList.navSpellChatButtonGapX,
  2282.     -NumberList.navSpellChatButtonGapY
  2283. )
  2284. SpellChatInterfaceFrame.SpellChatBtn1:SetSize(NumberList.navSpellChatButtonSize, NumberList.navSpellChatButtonSize)
  2285. SpellChatInterfaceFrame.SpellChatBtn1:SetNormalTexture(ImageList.spellChatButton)
  2286. SpellChatInterfaceFrame.SpellChatBtn1:SetHighlightTexture(ImageList.spellChatButtonH, "BLEND")
  2287. SpellChatInterfaceFrame.SpellChatBtn1:SetScript(
  2288.     "OnClick",
  2289.     function()
  2290.         toggleButton(SpellChatInterfaceFrameSpellChatBtn1)
  2291.     end
  2292. )
  2293.  
  2294. SpellChatInterfaceFrame.SpellChatBtn2 =
  2295.     CreateFrame("Button", "SpellChatInterfaceFrameSpellChatBtn2", SpellChatInterfaceFrame)
  2296. SpellChatInterfaceFrame.SpellChatBtn2:SetPoint(
  2297.     "CENTER",
  2298.     SpellChatInterfaceFrame,
  2299.     "TOPRIGHT",
  2300.     -NumberList.navSpellChatButtonGapX,
  2301.     -NumberList.navSpellChatButtonGapY
  2302. )
  2303. SpellChatInterfaceFrame.SpellChatBtn2:SetSize(NumberList.navSpellChatButtonSize, NumberList.navSpellChatButtonSize)
  2304. SpellChatInterfaceFrame.SpellChatBtn2:SetNormalTexture(ImageList.spellChatButton)
  2305. SpellChatInterfaceFrame.SpellChatBtn2:SetHighlightTexture(ImageList.spellChatButtonH, "BLEND")
  2306. SpellChatInterfaceFrame.SpellChatBtn2:SetScript(
  2307.     "OnClick",
  2308.     function()
  2309.         toggleButton(SpellChatInterfaceFrameSpellChatBtn2)
  2310.     end
  2311. )
  2312.  
  2313. -- ===================================================================================================
  2314. -- ===================================================================================================
  2315. -- ===========================         navigation panel          ===========================
  2316. -- ===================================================================================================
  2317. -- ===================================================================================================
  2318.  
  2319. local SpellChatNavigationPanel = CreateFrame("Frame", "SpellChatNavigationPanel", SpellChatInterfaceFrame)
  2320. SpellChatNavigationPanel:SetSize(600, 50)
  2321. SpellChatNavigationPanel:SetPoint("TOP", SpellChatInterfaceFrame, "BOTTOM", 0, 500)
  2322.  
  2323. SpellChatNavigationPanel.HunterBtn = CreateFrame("Button", "SpellChatNavigationPanelHunterBtn", SpellChatInterfaceFrame)
  2324. SpellChatNavigationPanel.HunterBtn:SetPoint("TOP", SpellChatInterfaceFrame.Banner, "TOP", 0, -105)
  2325. SpellChatNavigationPanel.HunterBtn:SetSize(NumberList.navButtonSize, NumberList.navButtonSize)
  2326. SpellChatNavigationPanel.HunterBtn:SetNormalTexture(ImageList.hunterButton)
  2327. SpellChatNavigationPanel.HunterBtn:SetHighlightTexture(ImageList.hunterButtonH, "BLEND")
  2328. SpellChatNavigationPanel.HunterBtn:SetScript(
  2329.     "OnClick",
  2330.     function()
  2331.         toggleButton(SpellChatNavigationPanelHunterBtn)
  2332.     end
  2333. )
  2334.  
  2335. SpellChatNavigationPanel.DruidBtn = CreateFrame("Button", "SpellChatNavigationPanelDruidBtn", SpellChatNavigationPanel)
  2336. SpellChatNavigationPanel.DruidBtn:SetPoint(
  2337.     "CENTER",
  2338.     SpellChatNavigationPanelHunterBtn,
  2339.     "CENTER",
  2340.     -NumberList.navButtonGapW,
  2341.     0
  2342. )
  2343. SpellChatNavigationPanel.DruidBtn:SetSize(NumberList.navButtonSize, NumberList.navButtonSize)
  2344. SpellChatNavigationPanel.DruidBtn:SetNormalTexture(ImageList.druidButton)
  2345. SpellChatNavigationPanel.DruidBtn:SetHighlightTexture(ImageList.druidButtonH, "BLEND")
  2346. SpellChatNavigationPanel.DruidBtn:SetScript(
  2347.     "OnClick",
  2348.     function()
  2349.         toggleButton(SpellChatNavigationPanelDruidBtn)
  2350.     end
  2351. )
  2352.  
  2353. SpellChatNavigationPanel.DemonHunterBtn =
  2354.     CreateFrame("Button", "SpellChatNavigationPanelDemonHunterBtn", SpellChatNavigationPanel)
  2355. SpellChatNavigationPanel.DemonHunterBtn:SetPoint(
  2356.     "CENTER",
  2357.     SpellChatNavigationPanelDruidBtn,
  2358.     "CENTER",
  2359.     -NumberList.navButtonGapW,
  2360.     0
  2361. )
  2362. SpellChatNavigationPanel.DemonHunterBtn:SetSize(NumberList.navButtonSize, NumberList.navButtonSize)
  2363. SpellChatNavigationPanel.DemonHunterBtn:SetNormalTexture(ImageList.demonHunterButton)
  2364. SpellChatNavigationPanel.DemonHunterBtn:SetHighlightTexture(ImageList.demonHunterButtonH, "BLEND")
  2365. SpellChatNavigationPanel.DemonHunterBtn:SetScript(
  2366.     "OnClick",
  2367.     function()
  2368.         toggleButton(SpellChatNavigationPanelDemonHunterBtn)
  2369.     end
  2370. )
  2371.  
  2372. SpellChatNavigationPanel.DeathKnightBtn =
  2373.     CreateFrame("Button", "SpellChatNavigationPanelDeathKnightBtn", SpellChatNavigationPanel)
  2374. SpellChatNavigationPanel.DeathKnightBtn:SetPoint(
  2375.     "CENTER",
  2376.     SpellChatNavigationPanelDemonHunterBtn,
  2377.     "CENTER",
  2378.     -NumberList.navButtonGapW,
  2379.     0
  2380. )
  2381. SpellChatNavigationPanel.DeathKnightBtn:SetSize(NumberList.navButtonSize, NumberList.navButtonSize)
  2382. SpellChatNavigationPanel.DeathKnightBtn:SetNormalTexture(ImageList.deathKnightButton)
  2383. SpellChatNavigationPanel.DeathKnightBtn:SetHighlightTexture(ImageList.deathKnightButtonH, "BLEND")
  2384. SpellChatNavigationPanel.DeathKnightBtn:SetScript(
  2385.     "OnClick",
  2386.     function()
  2387.         toggleButton(SpellChatNavigationPanelDeathKnightBtn)
  2388.     end
  2389. )
  2390.  
  2391. SpellChatNavigationPanel.MageBtn = CreateFrame("Button", "SpellChatNavigationPanelMageBtn", SpellChatNavigationPanel)
  2392. SpellChatNavigationPanel.MageBtn:SetPoint(
  2393.     "CENTER",
  2394.     SpellChatNavigationPanelHunterBtn,
  2395.     "CENTER",
  2396.     NumberList.navButtonGapW,
  2397.     0
  2398. )
  2399. SpellChatNavigationPanel.MageBtn:SetSize(NumberList.navButtonSize, NumberList.navButtonSize)
  2400. SpellChatNavigationPanel.MageBtn:SetNormalTexture(ImageList.mageButton)
  2401. SpellChatNavigationPanel.MageBtn:SetHighlightTexture(ImageList.mageButtonH, "BLEND")
  2402. SpellChatNavigationPanel.MageBtn:SetScript(
  2403.     "OnClick",
  2404.     function()
  2405.         toggleButton(SpellChatNavigationPanelMageBtn)
  2406.     end
  2407. )
  2408.  
  2409. SpellChatNavigationPanel.MonkBtn = CreateFrame("Button", "SpellChatNavigationPanelMonkBtn", SpellChatNavigationPanel)
  2410. SpellChatNavigationPanel.MonkBtn:SetPoint(
  2411.     "CENTER",
  2412.     SpellChatNavigationPanelMageBtn,
  2413.     "CENTER",
  2414.     NumberList.navButtonGapW,
  2415.     0
  2416. )
  2417. SpellChatNavigationPanel.MonkBtn:SetSize(NumberList.navButtonSize, NumberList.navButtonSize)
  2418. SpellChatNavigationPanel.MonkBtn:SetNormalTexture(ImageList.monkButton)
  2419. SpellChatNavigationPanel.MonkBtn:SetHighlightTexture(ImageList.monkButtonH, "BLEND")
  2420. SpellChatNavigationPanel.MonkBtn:SetScript(
  2421.     "OnClick",
  2422.     function()
  2423.         toggleButton(SpellChatNavigationPanelMonkBtn)
  2424.     end
  2425. )
  2426.  
  2427. SpellChatNavigationPanel.HandWaveBtn =
  2428.     CreateFrame("Button", "SpellChatNavigationPanelHandWaveBtn", SpellChatNavigationPanel)
  2429. SpellChatNavigationPanel.HandWaveBtn:SetPoint(
  2430.     "CENTER",
  2431.     SpellChatNavigationPanelMonkBtn,
  2432.     "CENTER",
  2433.     NumberList.navButtonGapW,
  2434.     0
  2435. )
  2436. SpellChatNavigationPanel.HandWaveBtn:SetSize(NumberList.navButtonSize, NumberList.navButtonSize)
  2437. SpellChatNavigationPanel.HandWaveBtn:SetNormalTexture(ImageList.handButton)
  2438. SpellChatNavigationPanel.HandWaveBtn:SetHighlightTexture(ImageList.handButtonH, "BLEND")
  2439. SpellChatNavigationPanel.HandWaveBtn:SetScript(
  2440.     "OnClick",
  2441.     function()
  2442.         toggleButton(SpellChatNavigationPanelHandWaveBtn)
  2443.     end
  2444. )
  2445.  
  2446. SpellChatNavigationPanel.ShamanBtn =
  2447.     CreateFrame("Button", "SpellChatNavigationPanelShamanBtn", SpellChatNavigationPanel)
  2448. SpellChatNavigationPanel.ShamanBtn:SetPoint(
  2449.     "CENTER",
  2450.     SpellChatNavigationPanelHunterBtn,
  2451.     "CENTER",
  2452.     0,
  2453.     -NumberList.navButtonGapW,
  2454.     0
  2455. )
  2456. SpellChatNavigationPanel.ShamanBtn:SetSize(NumberList.navButtonSize, NumberList.navButtonSize)
  2457. SpellChatNavigationPanel.ShamanBtn:SetNormalTexture(ImageList.shamanButton)
  2458. SpellChatNavigationPanel.ShamanBtn:SetHighlightTexture(ImageList.shamanButtonH, "BLEND")
  2459. SpellChatNavigationPanel.ShamanBtn:SetScript(
  2460.     "OnClick",
  2461.     function()
  2462.         toggleButton(SpellChatNavigationPanelShamanBtn)
  2463.     end
  2464. )
  2465.  
  2466. SpellChatNavigationPanel.RogueBtn = CreateFrame("Button", "SpellChatNavigationPanelRogueBtn", SpellChatNavigationPanel)
  2467. SpellChatNavigationPanel.RogueBtn:SetPoint(
  2468.     "CENTER",
  2469.     SpellChatNavigationPanelShamanBtn,
  2470.     "CENTER",
  2471.     -NumberList.navButtonGapW,
  2472.     0
  2473. )
  2474. SpellChatNavigationPanel.RogueBtn:SetSize(NumberList.navButtonSize, NumberList.navButtonSize)
  2475. SpellChatNavigationPanel.RogueBtn:SetNormalTexture(ImageList.rogueButton)
  2476. SpellChatNavigationPanel.RogueBtn:SetHighlightTexture(ImageList.rogueButtonH, "BLEND")
  2477. SpellChatNavigationPanel.RogueBtn:SetScript(
  2478.     "OnClick",
  2479.     function()
  2480.         toggleButton(SpellChatNavigationPanelRogueBtn)
  2481.     end
  2482. )
  2483.  
  2484. SpellChatNavigationPanel.PriestBtn =
  2485.     CreateFrame("Button", "SpellChatNavigationPanelPriestBtn", SpellChatNavigationPanel)
  2486. SpellChatNavigationPanel.PriestBtn:SetPoint(
  2487.     "CENTER",
  2488.     SpellChatNavigationPanelRogueBtn,
  2489.     "CENTER",
  2490.     -NumberList.navButtonGapW,
  2491.     0
  2492. )
  2493. SpellChatNavigationPanel.PriestBtn:SetSize(NumberList.navButtonSize, NumberList.navButtonSize)
  2494. SpellChatNavigationPanel.PriestBtn:SetNormalTexture(ImageList.priestButton)
  2495. SpellChatNavigationPanel.PriestBtn:SetHighlightTexture(ImageList.priestButtonH, "BLEND")
  2496. SpellChatNavigationPanel.PriestBtn:SetScript(
  2497.     "OnClick",
  2498.     function()
  2499.         toggleButton(SpellChatNavigationPanelPriestBtn)
  2500.     end
  2501. )
  2502.  
  2503. SpellChatNavigationPanel.PaladinBtn =
  2504.     CreateFrame("Button", "SpellChatNavigationPanelPaladinBtn", SpellChatNavigationPanel)
  2505. SpellChatNavigationPanel.PaladinBtn:SetPoint(
  2506.     "CENTER",
  2507.     SpellChatNavigationPanelPriestBtn,
  2508.     "CENTER",
  2509.     -NumberList.navButtonGapW,
  2510.     0
  2511. )
  2512. SpellChatNavigationPanel.PaladinBtn:SetSize(NumberList.navButtonSize, NumberList.navButtonSize)
  2513. SpellChatNavigationPanel.PaladinBtn:SetNormalTexture(ImageList.paladinButton)
  2514. SpellChatNavigationPanel.PaladinBtn:SetHighlightTexture(ImageList.paladinButtonH, "BLEND")
  2515. SpellChatNavigationPanel.PaladinBtn:SetScript(
  2516.     "OnClick",
  2517.     function()
  2518.         toggleButton(SpellChatNavigationPanelPaladinBtn)
  2519.     end
  2520. )
  2521.  
  2522. SpellChatNavigationPanel.WarlockBtn =
  2523.     CreateFrame("Button", "SpellChatNavigationPanelWarlockBtn", SpellChatNavigationPanel)
  2524. SpellChatNavigationPanel.WarlockBtn:SetPoint(
  2525.     "CENTER",
  2526.     SpellChatNavigationPanelShamanBtn,
  2527.     "CENTER",
  2528.     NumberList.navButtonGapW,
  2529.     0
  2530. )
  2531. SpellChatNavigationPanel.WarlockBtn:SetSize(NumberList.navButtonSize, NumberList.navButtonSize)
  2532. SpellChatNavigationPanel.WarlockBtn:SetNormalTexture(ImageList.warlockButton)
  2533. SpellChatNavigationPanel.WarlockBtn:SetHighlightTexture(ImageList.warlockButtonH, "BLEND")
  2534. SpellChatNavigationPanel.WarlockBtn:SetScript(
  2535.     "OnClick",
  2536.     function()
  2537.         toggleButton(SpellChatNavigationPanelWarlockBtn)
  2538.     end
  2539. )
  2540.  
  2541. SpellChatNavigationPanel.WarriorBtn =
  2542.     CreateFrame("Button", "SpellChatNavigationPanelWarriorBtn", SpellChatNavigationPanel)
  2543. SpellChatNavigationPanel.WarriorBtn:SetPoint(
  2544.     "CENTER",
  2545.     SpellChatNavigationPanelWarlockBtn,
  2546.     "CENTER",
  2547.     NumberList.navButtonGapW,
  2548.     0
  2549. )
  2550. SpellChatNavigationPanel.WarriorBtn:SetSize(NumberList.navButtonSize, NumberList.navButtonSize)
  2551. SpellChatNavigationPanel.WarriorBtn:SetNormalTexture(ImageList.warriorButton)
  2552. SpellChatNavigationPanel.WarriorBtn:SetHighlightTexture(ImageList.warriorButtonH, "BLEND")
  2553. SpellChatNavigationPanel.WarriorBtn:SetScript(
  2554.     "OnClick",
  2555.     function()
  2556.         toggleButton(SpellChatNavigationPanelWarriorBtn)
  2557.     end
  2558. )
  2559.  
  2560. SpellChatNavigationPanel.ItemBtn = CreateFrame("Button", "SpellChatNavigationPanelItemBtn", SpellChatNavigationPanel)
  2561. SpellChatNavigationPanel.ItemBtn:SetPoint(
  2562.     "CENTER",
  2563.     SpellChatNavigationPanelWarriorBtn,
  2564.     "CENTER",
  2565.     NumberList.navButtonGapW,
  2566.     0
  2567. )
  2568. SpellChatNavigationPanel.ItemBtn:SetSize(NumberList.navButtonSize, NumberList.navButtonSize)
  2569. SpellChatNavigationPanel.ItemBtn:SetNormalTexture(ImageList.itemButton)
  2570. SpellChatNavigationPanel.ItemBtn:SetHighlightTexture(ImageList.itemButtonH, "BLEND")
  2571. SpellChatNavigationPanel.ItemBtn:SetScript(
  2572.     "OnClick",
  2573.     function()
  2574.         toggleButton(SpellChatNavigationPanelItemBtn)
  2575.     end
  2576. )
  2577.  
  2578. -- ===================================================================================================
  2579. -- ===================================================================================================
  2580. -- ===========================         SpellChat1 frame         ===========================
  2581. -- ===================================================================================================
  2582. -- ===================================================================================================
  2583.  
  2584. local SpellChatFrame1 = CreateFrame("Frame", "SpellChatFrame1", SpellChatInterfaceFrame, "BackdropTemplate")
  2585. SpellChatFrame1:SetSize(NumberList.classFrameWidth, NumberList.classFrameHeight)
  2586. SpellChatFrame1:SetPoint("BOTTOM", SpellChatInterfaceFrame, "BOTTOM", 0, NumberList.spellChatFrameBottomGap)
  2587. SpellChatFrame1:SetBackdrop(
  2588.     {
  2589.         bgFile = nil,
  2590.         insets = {
  2591.             left = NumberList.insetSize,
  2592.             right = NumberList.insetSize,
  2593.             top = NumberList.insetSize,
  2594.             bottom = NumberList.insetSize
  2595.         },
  2596.         tileSize = nil,
  2597.         tile = false,
  2598.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  2599.         edgeSize = NumberList.edgeSize
  2600.     }
  2601. )
  2602. SpellChatFrame1:SetBackdropBorderColor(unpack(ColourList.spellChatEdge))
  2603.  
  2604. SpellChatFrame1.EnableSpellChatCheckBox =
  2605.     CreateFrame("CheckButton", "SpellChatFrameEnableSpellChatCheckBox", SpellChatFrame1, "UICheckButtonTemplate")
  2606. SpellChatFrame1.EnableSpellChatCheckBox:SetSize(NumberList.enableCheckBoxSize, NumberList.enableCheckBoxSize)
  2607. SpellChatFrame1.EnableSpellChatCheckBox:SetPoint(
  2608.     "TOPLEFT",
  2609.     SpellChatFrame1,
  2610.     "TOPLEFT",
  2611.     NumberList.checkBoxBigGap,
  2612.     -NumberList.checkBoxBigGap
  2613. )
  2614. SpellChatFrame1.EnableSpellChatCheckBox.text:SetFontObject(TextList.checkBoxFontObject)
  2615. SpellChatFrame1.EnableSpellChatCheckBox.text:SetText(TextList.spellChatEnableText)
  2616. SpellChatFrame1.EnableSpellChatCheckBox:SetScript(
  2617.     "OnClick",
  2618.     function()
  2619.         if SpellChatOptionsList.spellChatEnabled then
  2620.             SpellChatOptionsList.spellChatEnabled = false
  2621.             SpellChatFrame1.EnableSpellChatButtonCheckBox:SetEnabled(false)
  2622.             SpellChatFrame1.EnableSpellChatSixButtonCheckBox:SetEnabled(false)
  2623.             SpellChatFrame1.ErrorMessagesCheckBox:SetEnabled(false)
  2624.         else
  2625.             SpellChatOptionsList.spellChatEnabled = true
  2626.             SpellChatFrame1.EnableSpellChatButtonCheckBox:SetEnabled(true)
  2627.             SpellChatFrame1.EnableSpellChatSixButtonCheckBox:SetEnabled(true)
  2628.             SpellChatFrame1.ErrorMessagesCheckBox:SetEnabled(true)
  2629.         end
  2630.     end
  2631. )
  2632.  
  2633. SpellChatFrame1.EnableSpellChatButtonCheckBox =
  2634.     CreateFrame("CheckButton", "SpellChatFrameEnableSpellChatButtonCheckBox", SpellChatFrame1, "UICheckButtonTemplate")
  2635. SpellChatFrame1.EnableSpellChatButtonCheckBox:SetSize(NumberList.enableCheckBoxSize, NumberList.enableCheckBoxSize)
  2636. SpellChatFrame1.EnableSpellChatButtonCheckBox:SetPoint(
  2637.     "TOP",
  2638.     SpellChatFrameEnableSpellChatCheckBox,
  2639.     "BOTTOM",
  2640.     0,
  2641.     -NumberList.checkBoxGap
  2642. )
  2643. SpellChatFrame1.EnableSpellChatButtonCheckBox.text:SetFontObject(TextList.checkBoxFontObject)
  2644. SpellChatFrame1.EnableSpellChatButtonCheckBox.text:SetText(TextList.spellChatButtonText)
  2645. SpellChatFrame1.EnableSpellChatButtonCheckBox:SetScript(
  2646.     "OnClick",
  2647.     function()
  2648.         if SpellChatOptionsList.magicButtonEnabled then
  2649.             SpellChatOptionsList.magicButtonEnabled = false
  2650.             spellChatMagicButton:Hide()
  2651.         else
  2652.             SpellChatOptionsList.magicButtonEnabled = true
  2653.             spellChatMagicButton:Show()
  2654.         end
  2655.     end
  2656. )
  2657.  
  2658. SpellChatFrame1.EnableSpellChatSixButtonCheckBox =
  2659.     CreateFrame(
  2660.     "CheckButton",
  2661.     "SpellChatFrameEnableSpellChatSixButtonCheckBox",
  2662.     SpellChatFrame1,
  2663.     "UICheckButtonTemplate"
  2664. )
  2665. SpellChatFrame1.EnableSpellChatSixButtonCheckBox:SetSize(NumberList.enableCheckBoxSize, NumberList.enableCheckBoxSize)
  2666. SpellChatFrame1.EnableSpellChatSixButtonCheckBox:SetPoint(
  2667.     "TOP",
  2668.     SpellChatFrameEnableSpellChatButtonCheckBox,
  2669.     "BOTTOM",
  2670.     0,
  2671.     -NumberList.checkBoxGap
  2672. )
  2673. SpellChatFrame1.EnableSpellChatSixButtonCheckBox.text:SetFontObject(TextList.checkBoxFontObject)
  2674. SpellChatFrame1.EnableSpellChatSixButtonCheckBox.text:SetText(TextList.sixButtonEnableText)
  2675. SpellChatFrame1.EnableSpellChatSixButtonCheckBox:SetScript(
  2676.     "OnClick",
  2677.     function()
  2678.         if SpellChatOptionsList.buttonBoxEnabled then
  2679.             SpellChatOptionsList.buttonBoxEnabled = false
  2680.             HandWaveButtonGridFrame:Hide()
  2681.         else
  2682.             SpellChatOptionsList.buttonBoxEnabled = true
  2683.             HandWaveButtonGridFrame:Show()
  2684.         end
  2685.     end
  2686. )
  2687.  
  2688. SpellChatFrame1.GuildChatButtonsCheckBox =
  2689.     CreateFrame("CheckButton", "SpellChatFrame1GuildChatButtonsCheckBox", SpellChatFrame1, "UICheckButtonTemplate")
  2690. SpellChatFrame1.GuildChatButtonsCheckBox:SetSize(NumberList.enableCheckBoxSmallSize, NumberList.enableCheckBoxSmallSize)
  2691. SpellChatFrame1.GuildChatButtonsCheckBox:SetPoint(
  2692.     "TOP",
  2693.     SpellChatFrameEnableSpellChatSixButtonCheckBox,
  2694.     "BOTTOM",
  2695.     15,
  2696.     -NumberList.checkBoxSmallGap
  2697. )
  2698. SpellChatFrame1.GuildChatButtonsCheckBox.text:SetFontObject(TextList.checkBoxSmallFontObject)
  2699. SpellChatFrame1.GuildChatButtonsCheckBox.text:SetText(TextList.guildButtonsToggleText)
  2700. SpellChatFrame1.GuildChatButtonsCheckBox:SetScript(
  2701.     "OnClick",
  2702.     function()
  2703.         if SpellChatHandButtonList[1].guildButtons then
  2704.             SpellChatHandButtonList[1].guildButtons = false
  2705.         else
  2706.             SpellChatHandButtonList[1].guildButtons = true
  2707.         end
  2708.         handWaveGridFrameButtonLayout()
  2709.     end
  2710. )
  2711.  
  2712. SpellChatFrame1.GroupChatButtonsCheckBox =
  2713.     CreateFrame("CheckButton", "SpellChatFrame1GroupChatButtonsCheckBox", SpellChatFrame1, "UICheckButtonTemplate")
  2714. SpellChatFrame1.GroupChatButtonsCheckBox:SetSize(NumberList.enableCheckBoxSmallSize, NumberList.enableCheckBoxSmallSize)
  2715. SpellChatFrame1.GroupChatButtonsCheckBox:SetPoint(
  2716.     "TOP",
  2717.     SpellChatFrame1GuildChatButtonsCheckBox,
  2718.     "BOTTOM",
  2719.     0,
  2720.     -NumberList.checkBoxSmallGap
  2721. )
  2722. SpellChatFrame1.GroupChatButtonsCheckBox.text:SetFontObject(TextList.checkBoxSmallFontObject)
  2723. SpellChatFrame1.GroupChatButtonsCheckBox.text:SetText(TextList.groupButtonsToggleText)
  2724. SpellChatFrame1.GroupChatButtonsCheckBox:SetScript(
  2725.     "OnClick",
  2726.     function()
  2727.         if SpellChatHandButtonList[2].groupButtons then
  2728.             SpellChatHandButtonList[2].groupButtons = false
  2729.         else
  2730.             SpellChatHandButtonList[2].groupButtons = true
  2731.         end
  2732.         handWaveGridFrameButtonLayout()
  2733.     end
  2734. )
  2735.  
  2736. SpellChatFrame1.GeneralChatButtonsCheckBox =
  2737.     CreateFrame("CheckButton", "SpellChatFrame1GeneralChatButtonsCheckBox", SpellChatFrame1, "UICheckButtonTemplate")
  2738. SpellChatFrame1.GeneralChatButtonsCheckBox:SetSize(
  2739.     NumberList.enableCheckBoxSmallSize,
  2740.     NumberList.enableCheckBoxSmallSize
  2741. )
  2742. SpellChatFrame1.GeneralChatButtonsCheckBox:SetPoint(
  2743.     "TOP",
  2744.     SpellChatFrame1GroupChatButtonsCheckBox,
  2745.     "BOTTOM",
  2746.     0,
  2747.     -NumberList.checkBoxSmallGap
  2748. )
  2749. SpellChatFrame1.GeneralChatButtonsCheckBox.text:SetFontObject(TextList.checkBoxSmallFontObject)
  2750. SpellChatFrame1.GeneralChatButtonsCheckBox.text:SetText(TextList.generalButtonsToggleText)
  2751. SpellChatFrame1.GeneralChatButtonsCheckBox:SetScript(
  2752.     "OnClick",
  2753.     function()
  2754.         if SpellChatHandButtonList[3].generalButtons then
  2755.             SpellChatHandButtonList[3].generalButtons = false
  2756.         else
  2757.             SpellChatHandButtonList[3].generalButtons = true
  2758.         end
  2759.         handWaveGridFrameButtonLayout()
  2760.     end
  2761. )
  2762.  
  2763. SpellChatFrame1.TradeChatButtonsCheckBox =
  2764.     CreateFrame("CheckButton", "SpellChatFrame1TradeChatButtonsCheckBox", SpellChatFrame1, "UICheckButtonTemplate")
  2765. SpellChatFrame1.TradeChatButtonsCheckBox:SetSize(NumberList.enableCheckBoxSmallSize, NumberList.enableCheckBoxSmallSize)
  2766. SpellChatFrame1.TradeChatButtonsCheckBox:SetPoint(
  2767.     "TOP",
  2768.     SpellChatFrame1GeneralChatButtonsCheckBox,
  2769.     "BOTTOM",
  2770.     0,
  2771.     -NumberList.checkBoxSmallGap
  2772. )
  2773. SpellChatFrame1.TradeChatButtonsCheckBox.text:SetFontObject(TextList.checkBoxSmallFontObject)
  2774. SpellChatFrame1.TradeChatButtonsCheckBox.text:SetText(TextList.tradeButtonsToggleText)
  2775. SpellChatFrame1.TradeChatButtonsCheckBox:SetScript(
  2776.     "OnClick",
  2777.     function()
  2778.         if SpellChatHandButtonList[4].tradeButtons then
  2779.             SpellChatHandButtonList[4].tradeButtons = false
  2780.         else
  2781.             SpellChatHandButtonList[4].tradeButtons = true
  2782.         end
  2783.         handWaveGridFrameButtonLayout()
  2784.     end
  2785. )
  2786.  
  2787. SpellChatFrame1.LFGChatButtonsCheckBox =
  2788.     CreateFrame("CheckButton", "SpellChatFrame1LFGChatButtonsCheckBox", SpellChatFrame1, "UICheckButtonTemplate")
  2789. SpellChatFrame1.LFGChatButtonsCheckBox:SetSize(NumberList.enableCheckBoxSmallSize, NumberList.enableCheckBoxSmallSize)
  2790. SpellChatFrame1.LFGChatButtonsCheckBox:SetPoint(
  2791.     "TOP",
  2792.     SpellChatFrame1TradeChatButtonsCheckBox,
  2793.     "BOTTOM",
  2794.     0,
  2795.     -NumberList.checkBoxSmallGap
  2796. )
  2797. SpellChatFrame1.LFGChatButtonsCheckBox.text:SetFontObject(TextList.checkBoxSmallFontObject)
  2798. SpellChatFrame1.LFGChatButtonsCheckBox.text:SetText(TextList.lfgButtonsToggleText)
  2799. SpellChatFrame1.LFGChatButtonsCheckBox:SetScript(
  2800.     "OnClick",
  2801.     function()
  2802.         if SpellChatHandButtonList[5].lfgButttons then
  2803.             SpellChatHandButtonList[5].lfgButttons = false
  2804.         else
  2805.             SpellChatHandButtonList[5].lfgButttons = true
  2806.         end
  2807.         handWaveGridFrameButtonLayout()
  2808.     end
  2809. )
  2810.  
  2811. SpellChatFrame1.ErrorMessagesCheckBox =
  2812.     CreateFrame("CheckButton", "SpellChatFrameErrorMessagesCheckBox", SpellChatFrame1, "UICheckButtonTemplate")
  2813. SpellChatFrame1.ErrorMessagesCheckBox:SetSize(NumberList.enableCheckBoxSize, NumberList.enableCheckBoxSize)
  2814.  
  2815. SpellChatFrame1.ErrorMessagesCheckBox:SetPoint(
  2816.     "TOP",
  2817.     SpellChatFrame1LFGChatButtonsCheckBox,
  2818.     "BOTTOM",
  2819.     -NumberList.checkBoxBigGap,
  2820.     -NumberList.checkBoxGap
  2821. )
  2822.  
  2823. SpellChatFrame1.ErrorMessagesCheckBox.text:SetFontObject(TextList.checkBoxFontObject)
  2824. SpellChatFrame1.ErrorMessagesCheckBox.text:SetText(TextList.allErrorMessagesText)
  2825. SpellChatFrame1.ErrorMessagesCheckBox:SetScript(
  2826.     "OnClick",
  2827.     function()
  2828.         if SpellChatOptionsList.errorMessagesEnabled then
  2829.             SpellChatOptionsList.errorMessagesEnabled = false
  2830.         else
  2831.             SpellChatOptionsList.errorMessagesEnabled = true
  2832.         end
  2833.     end
  2834. )
  2835.  
  2836. SpellChatFrame1.KeybindsButton =
  2837.     CreateFrame(
  2838.     "Button",
  2839.     "SpellChatFrameKeybindsButton",
  2840.     SpellChatFrame1,
  2841.     "BackdropTemplate",
  2842.     "UIMenuButtonStretchTemplate"
  2843. )
  2844. SpellChatFrame1.KeybindsButton:SetSize(NumberList.scrollFrameWidth * 1.1, NumberList.clearTargetListHeight)
  2845. SpellChatFrame1.KeybindsButton:SetPoint(
  2846.     "TOPRIGHT",
  2847.     SpellChatFrame1,
  2848.     "TOPRIGHT",
  2849.     -NumberList.checkBoxBigGap,
  2850.     -NumberList.checkBoxBigGap
  2851. )
  2852. SpellChatFrame1.KeybindsButton:SetBackdrop(
  2853.     {
  2854.         bgFile = nil,
  2855.         insets = nil,
  2856.         tileSize = nil,
  2857.         tile = nil,
  2858.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  2859.         edgeSize = NumberList.edgeSize
  2860.     }
  2861. )
  2862. SpellChatFrame1.KeybindsButton:SetBackdropBorderColor(unpack(ColourList.spellChatEdge))
  2863. SpellChatFrame1.KeybindsButton:SetNormalFontObject(TextList.buttonFontObject)
  2864. SpellChatFrame1.KeybindsButton:SetHighlightFontObject(TextList.buttonFontObject)
  2865. SpellChatFrame1.KeybindsButton:SetText(TextList.keybindButtonText)
  2866. SpellChatFrame1.KeybindsButton:SetScript(
  2867.     "OnClick",
  2868.     function()
  2869.         GameMenuButtonKeybindings:Click("RightButton")
  2870.         KeyBindingFrame:Show()
  2871.         for _, v in pairs(KeyBindingFrame.categoryList.buttons) do
  2872.             if v:GetText() == "Walkerbo's Addons" or v:GetText() == "WALKERBO'S ADDONS" then
  2873.                 v:Click()
  2874.             end
  2875.         end
  2876.     end
  2877. )
  2878.  
  2879. SpellChatFrame1.SpellChatFrameScaleTextBox =
  2880.     CreateFrame("EditBox", "SpellChatFrameSpellChatFrameScaleTextBox", SpellChatFrame1, "OptionsBoxTemplate")
  2881. SpellChatFrame1.SpellChatFrameScaleTextBox:SetPoint(
  2882.     "TOPLEFT",
  2883.     SpellChatFrameKeybindsButton,
  2884.     "BOTTOMLEFT",
  2885.     0,
  2886.     -NumberList.scaleTextBoxGap
  2887. )
  2888. SpellChatFrame1.SpellChatFrameScaleTextBox:SetFontObject(TextList.checkBoxSmallFontObject)
  2889. SpellChatFrame1.SpellChatFrameScaleTextBox:SetNumeric(true)
  2890. SpellChatFrame1.SpellChatFrameScaleTextBox:SetSize(
  2891.     NumberList.percentageTextBoxWidth,
  2892.     NumberList.percentageTextBoxHeight
  2893. )
  2894. SpellChatFrame1.SpellChatFrameScaleTextBox:SetMaxLetters(3)
  2895. SpellChatFrame1.SpellChatFrameScaleTextBox:SetAutoFocus()
  2896. SpellChatFrame1.SpellChatFrameScaleTextBox:SetText("")
  2897. SpellChatFrame1.SpellChatFrameScaleTextBox:SetJustifyH("CENTER")
  2898. SpellChatFrame1.SpellChatFrameScaleTextBox:SetScript(
  2899.     "OnEnterPressed",
  2900.     function(self)
  2901.         scaleNumber = tonumber(SpellChatFrame1.SpellChatFrameScaleTextBox:GetText())
  2902.         self:ClearFocus()
  2903.         updateScalePercentage(scaleNumber, "SpellChatFrameScaleTextBox")
  2904.     end
  2905. )
  2906.  
  2907. SpellChatFrame1.SpellChatFrameScaleText = SpellChatFrame1:CreateFontString("SpellChatFrameSpellChatFrameScaleText")
  2908. SpellChatFrame1.SpellChatFrameScaleText:SetPoint("LEFT", SpellChatFrameSpellChatFrameScaleTextBox, "RIGHT")
  2909. SpellChatFrame1.SpellChatFrameScaleText:SetFontObject(TextList.checkBoxSmallFontObject)
  2910. SpellChatFrame1.SpellChatFrameScaleText:SetText(TextList.spellChatUIScaleText)
  2911.  
  2912. SpellChatFrame1.MagicButtonScaleTextBox =
  2913.     CreateFrame("EditBox", "SpellChatFrameMagicButtonScaleTextBox", SpellChatFrame1, "OptionsBoxTemplate")
  2914. SpellChatFrame1.MagicButtonScaleTextBox:SetPoint(
  2915.     "TOPLEFT",
  2916.     SpellChatFrameSpellChatFrameScaleTextBox,
  2917.     "BOTTOMLEFT",
  2918.     0,
  2919.     -NumberList.scaleTextBoxGap
  2920. )
  2921. SpellChatFrame1.MagicButtonScaleTextBox:SetFontObject(TextList.checkBoxSmallFontObject)
  2922. SpellChatFrame1.MagicButtonScaleTextBox:SetNumeric(true)
  2923. SpellChatFrame1.MagicButtonScaleTextBox:SetSize(NumberList.percentageTextBoxWidth, NumberList.percentageTextBoxHeight)
  2924. SpellChatFrame1.MagicButtonScaleTextBox:SetMaxLetters(3)
  2925. SpellChatFrame1.MagicButtonScaleTextBox:SetAutoFocus()
  2926. SpellChatFrame1.MagicButtonScaleTextBox:SetText("")
  2927. SpellChatFrame1.MagicButtonScaleTextBox:SetJustifyH("CENTER")
  2928. SpellChatFrame1.MagicButtonScaleTextBox:SetScript(
  2929.     "OnEnterPressed",
  2930.     function(self)
  2931.         scaleNumber = tonumber(SpellChatFrame1.MagicButtonScaleTextBox:GetText())
  2932.         self:ClearFocus()
  2933.         updateScalePercentage(scaleNumber, "MagicButtonScaleTextBox")
  2934.     end
  2935. )
  2936.  
  2937. SpellChatFrame1.MagicButtonScaleText = SpellChatFrame1:CreateFontString("SpellChatFrameMagicButtonScaleText")
  2938. SpellChatFrame1.MagicButtonScaleText:SetPoint("LEFT", SpellChatFrameMagicButtonScaleTextBox, "RIGHT")
  2939. SpellChatFrame1.MagicButtonScaleText:SetFontObject(TextList.checkBoxSmallFontObject)
  2940. SpellChatFrame1.MagicButtonScaleText:SetText(TextList.spellChatButtonScaleText)
  2941.  
  2942. SpellChatFrame1.MagicButtonOpacityTextBox =
  2943.     CreateFrame("EditBox", "SpellChatFrameMagicButtonOpacityTextBox", SpellChatFrame1, "OptionsBoxTemplate")
  2944. SpellChatFrame1.MagicButtonOpacityTextBox:SetPoint(
  2945.     "TOPLEFT",
  2946.     SpellChatFrameMagicButtonScaleTextBox,
  2947.     "BOTTOMLEFT",
  2948.     0,
  2949.     -NumberList.scaleTextBoxGap
  2950. )
  2951. SpellChatFrame1.MagicButtonOpacityTextBox:SetFontObject(TextList.checkBoxSmallFontObject)
  2952. SpellChatFrame1.MagicButtonOpacityTextBox:SetNumeric(true)
  2953. SpellChatFrame1.MagicButtonOpacityTextBox:SetSize(NumberList.percentageTextBoxWidth, NumberList.percentageTextBoxHeight)
  2954. SpellChatFrame1.MagicButtonOpacityTextBox:SetMaxLetters(3)
  2955. SpellChatFrame1.MagicButtonOpacityTextBox:SetAutoFocus()
  2956. SpellChatFrame1.MagicButtonOpacityTextBox:SetText("")
  2957. SpellChatFrame1.MagicButtonOpacityTextBox:SetJustifyH("CENTER")
  2958. SpellChatFrame1.MagicButtonOpacityTextBox:SetScript(
  2959.     "OnEnterPressed",
  2960.     function(self)
  2961.         opacityNumber = tonumber(SpellChatFrame1.MagicButtonOpacityTextBox:GetText())
  2962.         self:ClearFocus()
  2963.         updateOpacityPercentage(opacityNumber, "MagicButtonOpacityTextBox")
  2964.     end
  2965. )
  2966.  
  2967. SpellChatFrame1.MagicButtonOpacityText = SpellChatFrame1:CreateFontString("SpellChatFrameMagicButtonOpacityText")
  2968. SpellChatFrame1.MagicButtonOpacityText:SetPoint("LEFT", SpellChatFrameMagicButtonOpacityTextBox, "RIGHT")
  2969. SpellChatFrame1.MagicButtonOpacityText:SetFontObject(TextList.checkBoxSmallFontObject)
  2970. SpellChatFrame1.MagicButtonOpacityText:SetText(TextList.spellChatButtonOpacityText)
  2971.  
  2972. SpellChatFrame1.ButtonGridScaleTextBox =
  2973.     CreateFrame("EditBox", "SpellChatFrameButtonGridScaleTextBox", SpellChatFrame1, "OptionsBoxTemplate")
  2974. SpellChatFrame1.ButtonGridScaleTextBox:SetPoint(
  2975.     "TOPLEFT",
  2976.     SpellChatFrameMagicButtonOpacityTextBox,
  2977.     "BOTTOMLEFT",
  2978.     0,
  2979.     -NumberList.scaleTextBoxGap
  2980. )
  2981. SpellChatFrame1.ButtonGridScaleTextBox:SetFontObject(TextList.checkBoxSmallFontObject)
  2982. SpellChatFrame1.ButtonGridScaleTextBox:SetNumeric(true)
  2983. SpellChatFrame1.ButtonGridScaleTextBox:SetSize(NumberList.percentageTextBoxWidth, NumberList.percentageTextBoxHeight)
  2984. SpellChatFrame1.ButtonGridScaleTextBox:SetMaxLetters(3)
  2985. SpellChatFrame1.ButtonGridScaleTextBox:SetAutoFocus()
  2986. SpellChatFrame1.ButtonGridScaleTextBox:SetText("")
  2987. SpellChatFrame1.ButtonGridScaleTextBox:SetJustifyH("CENTER")
  2988. SpellChatFrame1.ButtonGridScaleTextBox:SetScript(
  2989.     "OnEnterPressed",
  2990.     function(self)
  2991.         scaleNumber = tonumber(SpellChatFrame1.ButtonGridScaleTextBox:GetText())
  2992.         self:ClearFocus()
  2993.         updateScalePercentage(scaleNumber, "ButtonGridScaleTextBox")
  2994.     end
  2995. )
  2996.  
  2997. SpellChatFrame1.ButtonGridScaleText = SpellChatFrame1:CreateFontString("SpellChatFrameButtonGridScaleText")
  2998. SpellChatFrame1.ButtonGridScaleText:SetPoint("LEFT", SpellChatFrameButtonGridScaleTextBox, "RIGHT")
  2999. SpellChatFrame1.ButtonGridScaleText:SetFontObject(TextList.checkBoxSmallFontObject)
  3000. SpellChatFrame1.ButtonGridScaleText:SetText(TextList.spellChatButtonGridScaleText)
  3001.  
  3002. SpellChatFrame1.ButtonGridOpacityTextBox =
  3003.     CreateFrame("EditBox", "SpellChatFrameButtonGridOpacityTextBox", SpellChatFrame1, "OptionsBoxTemplate")
  3004. SpellChatFrame1.ButtonGridOpacityTextBox:SetPoint(
  3005.     "TOPLEFT",
  3006.     SpellChatFrameButtonGridScaleTextBox,
  3007.     "BOTTOMLEFT",
  3008.     0,
  3009.     -NumberList.scaleTextBoxGap
  3010. )
  3011. SpellChatFrame1.ButtonGridOpacityTextBox:SetFontObject(TextList.checkBoxSmallFontObject)
  3012. SpellChatFrame1.ButtonGridOpacityTextBox:SetNumeric(true)
  3013. SpellChatFrame1.ButtonGridOpacityTextBox:SetSize(NumberList.percentageTextBoxWidth, NumberList.percentageTextBoxHeight)
  3014. SpellChatFrame1.ButtonGridOpacityTextBox:SetMaxLetters(3)
  3015. SpellChatFrame1.ButtonGridOpacityTextBox:SetAutoFocus()
  3016. SpellChatFrame1.ButtonGridOpacityTextBox:SetText("")
  3017. SpellChatFrame1.ButtonGridOpacityTextBox:SetJustifyH("CENTER")
  3018. SpellChatFrame1.ButtonGridOpacityTextBox:SetScript(
  3019.     "OnEnterPressed",
  3020.     function(self)
  3021.         opacityNumber = tonumber(SpellChatFrame1.ButtonGridOpacityTextBox:GetText())
  3022.         self:ClearFocus()
  3023.         updateOpacityPercentage(opacityNumber, "ButtonGridOpacityTextBox")
  3024.     end
  3025. )
  3026.  
  3027. SpellChatFrame1.ButtonGridOpacityText = SpellChatFrame1:CreateFontString("SpellChatFrameButtonGridOpacityText")
  3028. SpellChatFrame1.ButtonGridOpacityText:SetPoint("LEFT", SpellChatFrameButtonGridOpacityTextBox, "RIGHT")
  3029. SpellChatFrame1.ButtonGridOpacityText:SetFontObject(TextList.checkBoxSmallFontObject)
  3030. SpellChatFrame1.ButtonGridOpacityText:SetText(TextList.spellChatButtonGridOpacityText)
  3031.  
  3032. -- ===================================================================================================
  3033. -- ===================================================================================================
  3034. -- ===========================         SpellChat2 frame         ===========================
  3035. -- ===================================================================================================
  3036. -- ===================================================================================================
  3037.  
  3038. local SpellChatFrame2 = CreateFrame("Frame", "SpellChatFrame2", SpellChatInterfaceFrame, "BackdropTemplate")
  3039. SpellChatFrame2:SetSize(NumberList.classFrameWidth, NumberList.classFrameHeight)
  3040. SpellChatFrame2:SetPoint("BOTTOM", SpellChatInterfaceFrame, "BOTTOM", 0, NumberList.spellChatFrameBottomGap)
  3041. SpellChatFrame2:SetBackdrop(
  3042.     {
  3043.         bgFile = nil,
  3044.         insets = {
  3045.             left = NumberList.insetSize,
  3046.             right = NumberList.insetSize,
  3047.             top = NumberList.insetSize,
  3048.             bottom = NumberList.insetSize
  3049.         },
  3050.         tileSize = nil,
  3051.         tile = false,
  3052.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  3053.         edgeSize = NumberList.edgeSize
  3054.     }
  3055. )
  3056. SpellChatFrame2:SetBackdropBorderColor(unpack(ColourList.spellChatEdge))
  3057.  
  3058. SpellChatFrame2.ClickInfoBox1 = CreateFrame("Frame", "SpellChatFrame2.ClickInfoBox1", SpellChatFrame2)
  3059. SpellChatFrame2.ClickInfoBox1:SetSize(NumberList.classFrameWidth, NumberList.slashCommandHeight * 2)
  3060. SpellChatFrame2.ClickInfoBox1:SetPoint(
  3061.     "TOPLEFT",
  3062.     SpellChatFrame2,
  3063.     "TOPLEFT",
  3064.     NumberList.checkBoxBigGap,
  3065.     -NumberList.checkBoxBigGap
  3066. )
  3067.  
  3068. SpellChatFrame2.ClickInfoBox1.Text = SpellChatFrame2.ClickInfoBox1:CreateFontString("SpellChatFrame2ClickInfoBox1Text")
  3069. SpellChatFrame2.ClickInfoBox1.Text:SetAllPoints(SpellChatFrame2.ClickInfoBox1)
  3070. SpellChatFrame2.ClickInfoBox1.Text:SetJustifyV("TOP")
  3071. SpellChatFrame2.ClickInfoBox1.Text:SetJustifyH("LEFT")
  3072. SpellChatFrame2.ClickInfoBox1.Text:SetFontObject(TextList.slashCommandFontObject)
  3073. SpellChatFrame2.ClickInfoBox1.Text:SetText(TextList.buttonClickText)
  3074.  
  3075. SpellChatFrame2.SlashCommandsBox1 = CreateFrame("Frame", "SpellChatFrameSlashCommandsBox1", SpellChatFrame2)
  3076. SpellChatFrame2.SlashCommandsBox1:SetSize(NumberList.slashCommandWidth, NumberList.slashCommandHeight)
  3077. SpellChatFrame2.SlashCommandsBox1:SetPoint(
  3078.     "BOTTOMLEFT",
  3079.     SpellChatFrame2,
  3080.     "BOTTOMLEFT",
  3081.     NumberList.checkBoxBigGap,
  3082.     NumberList.checkBoxBigGap
  3083. )
  3084.  
  3085. SpellChatFrame2.SlashCommandsBox1.Text =
  3086.     SpellChatFrame2.SlashCommandsBox1:CreateFontString("SpellChatFrameSlashCommandsBox1Text")
  3087. SpellChatFrame2.SlashCommandsBox1.Text:SetAllPoints(SpellChatFrameSlashCommandsBox1)
  3088. SpellChatFrame2.SlashCommandsBox1.Text:SetJustifyV("BOTTOM")
  3089. SpellChatFrame2.SlashCommandsBox1.Text:SetJustifyH("LEFT")
  3090. SpellChatFrame2.SlashCommandsBox1.Text:SetFontObject(TextList.slashCommandFontObject)
  3091. SpellChatFrame2.SlashCommandsBox1.Text:SetText(TextList.slashCommandText1)
  3092.  
  3093. SpellChatFrame2.SlashCommandsBox2 = CreateFrame("Frame", "SpellChatFrameSlashCommandsBox2", SpellChatFrame2)
  3094. SpellChatFrame2.SlashCommandsBox2:SetSize(NumberList.slashCommandWidth, NumberList.slashCommandHeight)
  3095. SpellChatFrame2.SlashCommandsBox2:SetPoint("LEFT", SpellChatFrameSlashCommandsBox1, "RIGHT")
  3096.  
  3097. SpellChatFrame2.SlashCommandsBox2.Text =
  3098.     SpellChatFrame2.SlashCommandsBox2:CreateFontString("SpellChatFrameSlashCommandsBox2Text")
  3099. SpellChatFrame2.SlashCommandsBox2.Text:SetAllPoints(SpellChatFrameSlashCommandsBox2)
  3100. SpellChatFrame2.SlashCommandsBox2.Text:SetJustifyV("BOTTOM")
  3101. SpellChatFrame2.SlashCommandsBox2.Text:SetJustifyH("LEFT")
  3102. SpellChatFrame2.SlashCommandsBox2.Text:SetFontObject(TextList.slashCommandFontObject)
  3103. SpellChatFrame2.SlashCommandsBox2.Text:SetText(TextList.slashCommandText2)
  3104.  
  3105. -- ===================================================================================================
  3106. -- ===================================================================================================
  3107. -- ===========================         DeathKnight class frame          ===========================
  3108. -- ===================================================================================================
  3109. -- ===================================================================================================
  3110.  
  3111. local DeathKnightSpellChatFrame =
  3112.     CreateFrame("Frame", "DeathKnightSpellChatFrame", SpellChatInterfaceFrame, "BackdropTemplate")
  3113. DeathKnightSpellChatFrame:SetSize(NumberList.classFrameWidth, NumberList.classFrameHeight)
  3114. DeathKnightSpellChatFrame:SetPoint("BOTTOM", SpellChatInterfaceFrame, "BOTTOM", 0, NumberList.spellChatFrameBottomGap)
  3115. DeathKnightSpellChatFrame:SetBackdrop(
  3116.     {
  3117.         bgFile = nil,
  3118.         insets = {
  3119.             left = NumberList.insetSize,
  3120.             right = NumberList.insetSize,
  3121.             top = NumberList.insetSize,
  3122.             bottom = NumberList.insetSize
  3123.         },
  3124.         tileSize = nil,
  3125.         tile = false,
  3126.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  3127.         edgeSize = NumberList.edgeSize
  3128.     }
  3129. )
  3130. DeathKnightSpellChatFrame:SetBackdropBorderColor(unpack(ColourList.deathKnightEdge))
  3131.  
  3132. DeathKnightSpellChatFrame.AddSpellButton =
  3133.     CreateFrame(
  3134.     "Button",
  3135.     "DeathKnightSpellChatFrameAddSpellButton",
  3136.     DeathKnightSpellChatFrame,
  3137.     "BackdropTemplate",
  3138.     "UIMenuButtonStretchTemplate"
  3139. )
  3140. DeathKnightSpellChatFrame.AddSpellButton:SetSize(NumberList.scrollFrameWidth, NumberList.chatHeaderHeight)
  3141. DeathKnightSpellChatFrame.AddSpellButton:SetPoint("TOPLEFT", DeathKnightSpellChatFrame, "TOPLEFT", 9, -10)
  3142. DeathKnightSpellChatFrame.AddSpellButton:SetBackdrop(
  3143.     {
  3144.         bgFile = nil,
  3145.         insets = nil,
  3146.         tileSize = nil,
  3147.         tile = true,
  3148.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  3149.         edgeSize = NumberList.edgeSize
  3150.     }
  3151. )
  3152. DeathKnightSpellChatFrame.AddSpellButton:SetBackdropBorderColor(unpack(ColourList.deathKnightEdge))
  3153. DeathKnightSpellChatFrame.AddSpellButton:SetNormalFontObject(TextList.buttonFontObject)
  3154. DeathKnightSpellChatFrame.AddSpellButton:SetHighlightFontObject(TextList.buttonFontObject)
  3155. DeathKnightSpellChatFrame.AddSpellButton:SetText(TextList.addSpellButtonText)
  3156. DeathKnightSpellChatFrame.AddSpellButton:SetScript(
  3157.     "OnReceiveDrag",
  3158.     function()
  3159.         toggleButton(VariableList.currentAddClassNavigationButton)
  3160.         if GetCursorInfo() then
  3161.             cursorType, _, _, spellID = GetCursorInfo()
  3162.             if cursorType ~= "spell" then
  3163.                 printErrorMessages("errorNotASpell")
  3164.             elseif checkIfSpellIsAlreadyListed(spellID) then
  3165.                 printErrorMessages("errorAlreadyListed")
  3166.             else
  3167.                 spellLink = GetSpellLink(spellID)
  3168.                 addSpellToClassSpellList(spellID, spellLink)
  3169.                 updateListBasedOnOpenFrame()
  3170.             end
  3171.             ClearCursor()
  3172.         end
  3173.     end
  3174. )
  3175. DeathKnightSpellChatFrame.AddSpellButton:SetScript(
  3176.     "OnClick",
  3177.     function()
  3178.         toggleButton(VariableList.currentAddClassNavigationButton)
  3179.         if GetCursorInfo() then
  3180.             cursorType, _, _, spellID = GetCursorInfo()
  3181.             if cursorType ~= "spell" then
  3182.                 printErrorMessages("errorNotASpell")
  3183.             elseif checkIfSpellIsAlreadyListed(spellID) then
  3184.                 printErrorMessages("errorAlreadyListed")
  3185.             else
  3186.                 spellLink = GetSpellLink(spellID)
  3187.                 addSpellToClassSpellList(spellID, spellLink)
  3188.                 updateListBasedOnOpenFrame()
  3189.             end
  3190.             ClearCursor()
  3191.         end
  3192.     end
  3193. )
  3194.  
  3195. local DeathKnightSpellScrollParent =
  3196.     CreateFrame(
  3197.     "Button",
  3198.     "DeathKnightSpellScrollParent",
  3199.     DeathKnightSpellChatFrame,
  3200.     "BackdropTemplate",
  3201.     "TooltipBorderedFrameTemplate"
  3202. )
  3203. DeathKnightSpellScrollParent:SetBackdrop(
  3204.     {
  3205.         bgFile = nil,
  3206.         insets = nil,
  3207.         tileSize = nil,
  3208.         tile = false,
  3209.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  3210.         edgeSize = NumberList.edgeSize
  3211.     }
  3212. )
  3213. DeathKnightSpellScrollParent:SetBackdropBorderColor(unpack(ColourList.deathKnightEdge))
  3214. DeathKnightSpellScrollParent:SetSize(NumberList.scrollFrameWidth, NumberList.scrollFrameHeight)
  3215. DeathKnightSpellScrollParent:SetPoint("TOP", DeathKnightSpellChatFrameAddSpellButton, "BOTTOM", 0, -5)
  3216.  
  3217. local DeathKnightSpellScrollFrame =
  3218.     CreateFrame("ScrollFrame", "DeathKnightSpellScrollFrame", DeathKnightSpellScrollParent, "FauxScrollFrameTemplate")
  3219. DeathKnightSpellScrollFrame:SetPoint("TOPLEFT", 0, -8)
  3220. DeathKnightSpellScrollFrame:SetPoint("BOTTOMRIGHT", -30, 8)
  3221. DeathKnightSpellScrollFrame:SetScript(
  3222.     "OnVerticalScroll",
  3223.     function(self, offset)
  3224.         FauxScrollFrame_OnVerticalScroll(
  3225.             self,
  3226.             offset,
  3227.             NumberList.spellItemScrollButtonHeight,
  3228.             updateDeathKnightSpellList
  3229.         )
  3230.     end
  3231. )
  3232.  
  3233. DeathKnightSpellScrollFrame.buttons = {}
  3234. for index = 1, NumberList.spellItemScrollButtonNumber do
  3235.     DeathKnightSpellScrollFrame.buttons[index] =
  3236.         CreateFrame("Button", "$parentbtn" .. index, DeathKnightSpellScrollParent, "OptionsListButtonTemplate")
  3237.     local button = DeathKnightSpellScrollFrame.buttons[index]
  3238.     button:SetNormalFontObject(TextList.checkBoxSmallFontObject)
  3239.     button:SetHighlightFontObject(TextList.checkBoxSmallFontObject)
  3240.     button:SetSize(NumberList.scrollFrameWidth, NumberList.phraseTextButtonHeight)
  3241.     button:SetPoint("TOPLEFT", 8, -(index - 1) * NumberList.phraseTextButtonHeight - 8)
  3242.     button:SetScript(
  3243.         "OnClick",
  3244.         function(self)
  3245.             VariableList.currentClassSpellList = DeathKnightSpellList
  3246.             VariableList.currentClassSpellLink = DeathKnightSpellList[self.index].spellLink
  3247.             VariableList.currentClassSpellID = DeathKnightSpellList[self.index].spellID
  3248.             VariableList.currentClassSpellPercentage = DeathKnightSpellList[self.index].percentage
  3249.             VariableList.currentClassSpellEnabled = DeathKnightSpellList[self.index].isEnabled
  3250.             loadSpellHeader()
  3251.             updateDeathKnightSpellChatList()
  3252.         end
  3253.     )
  3254.     button:SetScript(
  3255.         "OnEnter",
  3256.         function(self)
  3257.             GameTooltip:SetOwner(self, "ANCHOR_TOP", 0, 15)
  3258.             GameTooltip:SetHyperlink(DeathKnightSpellList[self.index].spellLink)
  3259.             GameTooltip:Show()
  3260.         end
  3261.     )
  3262. end
  3263.  
  3264. DeathKnightSpellChatFrame.ClearSpellListButton =
  3265.     CreateFrame(
  3266.     "Button",
  3267.     "DeathKnightClearSpellListButton",
  3268.     DeathKnightSpellChatFrame,
  3269.     "BackdropTemplate",
  3270.     "UIMenuButtonStretchTemplate"
  3271. )
  3272. DeathKnightSpellChatFrame.ClearSpellListButton:SetSize(NumberList.scrollFrameWidth, NumberList.clearTargetListHeight)
  3273. DeathKnightSpellChatFrame.ClearSpellListButton:SetPoint("TOP", DeathKnightSpellScrollParent, "BOTTOM", 0, -4)
  3274. DeathKnightSpellChatFrame.ClearSpellListButton:SetBackdrop(
  3275.     {
  3276.         bgFile = nil,
  3277.         insets = nil,
  3278.         tileSize = nil,
  3279.         tile = true,
  3280.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  3281.         edgeSize = NumberList.edgeSize
  3282.     }
  3283. )
  3284. DeathKnightSpellChatFrame.ClearSpellListButton:SetBackdropBorderColor(unpack(ColourList.deathKnightEdge))
  3285. DeathKnightSpellChatFrame.ClearSpellListButton:SetNormalFontObject(TextList.buttonFontObject)
  3286. DeathKnightSpellChatFrame.ClearSpellListButton:SetHighlightFontObject(TextList.buttonFontObject)
  3287. DeathKnightSpellChatFrame.ClearSpellListButton:SetText(TextList.clearSpellListButtonText)
  3288. DeathKnightSpellChatFrame.ClearSpellListButton:RegisterForClicks("RightButtonUp")
  3289. DeathKnightSpellChatFrame.ClearSpellListButton:SetScript(
  3290.     "OnClick",
  3291.     function()
  3292.         wipe(DeathKnightSpellList)
  3293.         clearCurrentClassSpell()
  3294.         updateDeathKnightSpellList()
  3295.         updateDeathKnightSpellChatList()
  3296.         DeathKnightSpellChatFrame.AddPhraseTextBox:SetText("")
  3297.         DeathKnightSpellChatFrame.AddPhraseTextBox:ClearFocus()
  3298.     end
  3299. )
  3300.  
  3301. DeathKnightSpellChatFrame.ChatParent =
  3302.     CreateFrame("Frame", "DeathKnightSpellChatFrameChatParent", DeathKnightSpellChatFrame)
  3303. DeathKnightSpellChatFrame.ChatParent:SetSize(NumberList.scrollSpellFrameWidth, NumberList.scrollSpellFrameHight)
  3304. DeathKnightSpellChatFrame.ChatParent:SetPoint("TOPRIGHT", DeathKnightSpellChatFrame, "TOPRIGHT", -9, -10)
  3305. DeathKnightSpellChatFrame.ChatHeader =
  3306.     CreateFrame("Frame", "DeathKnightSpellChatFrameChatHeader", DeathKnightSpellChatFrameChatParent, "BackdropTemplate")
  3307. DeathKnightSpellChatFrame.ChatHeader:SetBackdrop(
  3308.     {
  3309.         bgFile = nil,
  3310.         insets = nil,
  3311.         tileSize = nil,
  3312.         tile = false,
  3313.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  3314.         edgeSize = NumberList.edgeSize
  3315.     }
  3316. )
  3317. DeathKnightSpellChatFrame.ChatHeader:SetBackdropBorderColor(unpack(ColourList.deathKnightEdge))
  3318. DeathKnightSpellChatFrame.ChatHeader:SetSize(NumberList.scrollSpellFrameWidth, NumberList.chatHeaderHeight)
  3319. DeathKnightSpellChatFrame.ChatHeader:SetPoint("TOP", DeathKnightSpellChatFrameChatParent)
  3320. DeathKnightSpellChatFrame.TitleText = DeathKnightSpellChatFrame:CreateFontString("MyTestFrameTitleText")
  3321. DeathKnightSpellChatFrame.TitleText:SetPoint("TOPLEFT", DeathKnightSpellChatFrameChatHeader, "TOPLEFT", 10, -10)
  3322. DeathKnightSpellChatFrame.TitleText:SetFontObject(TextList.checkBoxFontObject)
  3323. DeathKnightSpellChatFrame.TitleText:SetText("")
  3324.  
  3325. DeathKnightSpellChatFrame.DeleteSpellButton =
  3326.     CreateFrame("Button", "DeathKnightSpellChatFrameDeleteSpellButton", DeathKnightSpellChatFrameChatHeader)
  3327. DeathKnightSpellChatFrame.DeleteSpellButton:SetPoint("RIGHT", DeathKnightSpellChatFrameChatHeader, "RIGHT", -10, 0)
  3328. DeathKnightSpellChatFrame.DeleteSpellButton:SetSize(NumberList.navButtonSize / 1.5, NumberList.navButtonSize / 1.5)
  3329. DeathKnightSpellChatFrame.DeleteSpellButton:SetNormalTexture(ImageList.removeSpellItemButton)
  3330. DeathKnightSpellChatFrame.DeleteSpellButton:SetHighlightTexture(ImageList.removeSpellItemButtonH, "BLEND")
  3331. DeathKnightSpellChatFrame.DeleteSpellButton:SetScript(
  3332.     "OnClick",
  3333.     function()
  3334.         clearCurrentClassSpell()
  3335.         updateDeathKnightSpellList()
  3336.         updateDeathKnightSpellChatList()
  3337.         DeathKnightSpellChatFrame.AddPhraseTextBox:SetText("")
  3338.         DeathKnightSpellChatFrame.AddPhraseTextBox:ClearFocus()
  3339.     end
  3340. )
  3341.  
  3342. DeathKnightSpellChatFrame.PercentageTextBox =
  3343.     CreateFrame(
  3344.     "EditBox",
  3345.     "DeathKnightSpellChatFramePercentageTextBox",
  3346.     DeathKnightSpellChatFrameChatHeader,
  3347.     "OptionsBoxTemplate"
  3348. )
  3349. DeathKnightSpellChatFrame.PercentageTextBox:SetPoint(
  3350.     "BOTTOMLEFT",
  3351.     DeathKnightSpellChatFrameChatHeader,
  3352.     "BOTTOMLEFT",
  3353.     10,
  3354.     5
  3355. )
  3356. DeathKnightSpellChatFrame.PercentageTextBox:SetFontObject(TextList.checkBoxSmallFontObject)
  3357. DeathKnightSpellChatFrame.PercentageTextBox:SetNumeric(true)
  3358. DeathKnightSpellChatFrame.PercentageTextBox:SetSize(
  3359.     NumberList.percentageTextBoxWidth,
  3360.     NumberList.percentageTextBoxHeight
  3361. )
  3362. DeathKnightSpellChatFrame.PercentageTextBox:SetMaxLetters(3)
  3363. DeathKnightSpellChatFrame.PercentageTextBox:SetAutoFocus()
  3364. DeathKnightSpellChatFrame.PercentageTextBox:SetText("")
  3365. DeathKnightSpellChatFrame.PercentageTextBox:SetJustifyH("CENTER")
  3366. DeathKnightSpellChatFrame.PercentageTextBox:SetScript(
  3367.     "OnEnterPressed",
  3368.     function(self)
  3369.         percentageNumber = tonumber(DeathKnightSpellChatFrame.PercentageTextBox:GetText())
  3370.         self:ClearFocus()
  3371.         updateSpellPercentage(percentageNumber)
  3372.     end
  3373. )
  3374.  
  3375. DeathKnightSpellChatFrame.PercentageText =
  3376.     DeathKnightSpellChatFrame:CreateFontString("DeathKnightSpellChatFramePercentageText")
  3377. DeathKnightSpellChatFrame.PercentageText:SetPoint("LEFT", DeathKnightSpellChatFramePercentageTextBox, "RIGHT")
  3378. DeathKnightSpellChatFrame.PercentageText:SetFontObject(TextList.checkBoxSmallFontObject)
  3379. DeathKnightSpellChatFrame.PercentageText:SetText(TextList.chatFrequencyText)
  3380.  
  3381. DeathKnightSpellChatFrame.EnableCheckbox =
  3382.     CreateFrame(
  3383.     "CheckButton",
  3384.     "DeathKnightSpellChatFrameEnableCheckbox",
  3385.     DeathKnightSpellChatFrameChatHeader,
  3386.     "UICheckButtonTemplate"
  3387. )
  3388. DeathKnightSpellChatFrame.EnableCheckbox:ClearAllPoints()
  3389. DeathKnightSpellChatFrame.EnableCheckbox:SetPoint(
  3390.     "LEFT",
  3391.     DeathKnightSpellChatFramePercentageText,
  3392.     "RIGHT",
  3393.     NumberList.enableCheckBoxSize,
  3394.     NumberList.checkEnableBottomGap
  3395. )
  3396. DeathKnightSpellChatFrame.EnableCheckbox:SetSize(NumberList.enableCheckBoxSize, NumberList.enableCheckBoxSize)
  3397. DeathKnightSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  3398. DeathKnightSpellChatFrame.EnableCheckbox.text:SetText(TextList.enableSpellChatsText)
  3399. DeathKnightSpellChatFrame.EnableCheckbox.text:SetFontObject(TextList.checkBoxSmallFontObject)
  3400. DeathKnightSpellChatFrame.EnableCheckbox:SetScript(
  3401.     "OnClick",
  3402.     function(self)
  3403.         if VariableList.currentClassSpellEnabled then
  3404.             VariableList.currentClassSpellEnabled = false
  3405.             updateSpellEnabled()
  3406.         elseif not VariableList.currentClassSpellEnabled then
  3407.             VariableList.currentClassSpellEnabled = true
  3408.             updateSpellEnabled()
  3409.         end
  3410.     end
  3411. )
  3412.  
  3413. DeathKnightSpellChatFrame.AddChatHeader =
  3414.     CreateFrame(
  3415.     "Frame",
  3416.     "DeathKnightSpellChatFrameAddChatHeader",
  3417.     DeathKnightSpellChatFrameChatParent,
  3418.     "BackdropTemplate"
  3419. )
  3420. DeathKnightSpellChatFrame.AddChatHeader:SetBackdrop(
  3421.     {
  3422.         bgFile = nil,
  3423.         insets = nil,
  3424.         tileSize = nil,
  3425.         tile = false,
  3426.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  3427.         edgeSize = NumberList.edgeSize
  3428.     }
  3429. )
  3430. DeathKnightSpellChatFrame.AddChatHeader:SetBackdropBorderColor(unpack(ColourList.deathKnightEdge))
  3431. DeathKnightSpellChatFrame.AddChatHeader:SetSize(NumberList.scrollSpellFrameWidth, 31)
  3432. DeathKnightSpellChatFrame.AddChatHeader:SetPoint("TOP", DeathKnightSpellChatFrameChatHeader, "BOTTOM", 0, -5)
  3433.  
  3434. DeathKnightSpellChatFrame.AddPhraseTextBox =
  3435.     CreateFrame("EditBox", "DeathKnightSpellChatFrameAddPhraseTextBox", DeathKnightSpellChatFrameAddChatHeader)
  3436. DeathKnightSpellChatFrame.AddPhraseTextBox:SetPoint("LEFT", DeathKnightSpellChatFrameAddChatHeader, "LEFT", 10, 0)
  3437. DeathKnightSpellChatFrame.AddPhraseTextBox:SetFontObject(TextList.checkBoxSmallFontObject)
  3438. DeathKnightSpellChatFrame.AddPhraseTextBox:SetSize(NumberList.scrollSpellFrameWidth - 40, 25)
  3439. DeathKnightSpellChatFrame.AddPhraseTextBox:SetMaxLetters(100)
  3440. DeathKnightSpellChatFrame.AddPhraseTextBox:SetAutoFocus(false)
  3441. DeathKnightSpellChatFrame.AddPhraseTextBox:SetJustifyH("LEFT")
  3442. DeathKnightSpellChatFrame.AddPhraseTextBox:SetScript(
  3443.     "OnReceiveDrag",
  3444.     function()
  3445.         if GetCursorInfo() then
  3446.             cursorType, arg1, arg2, arg3 = GetCursorInfo()
  3447.             cursorLink = getCursorLinkForCurrentPhrase(cursorType, arg1, arg2, arg3)
  3448.             if cursorLink ~= nil then
  3449.                 DeathKnightSpellChatFrame.AddPhraseTextBox:Insert(cursorLink .. " ")
  3450.                 DeathKnightSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  3451.             else
  3452.                 DeathKnightSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  3453.             end
  3454.         end
  3455.         ClearCursor()
  3456.     end
  3457. )
  3458. DeathKnightSpellChatFrame.AddPhraseTextBox:SetScript(
  3459.     "OnMouseDown",
  3460.     function()
  3461.         if GetCursorInfo() then
  3462.             cursorType, arg1, arg2, arg3 = GetCursorInfo()
  3463.             cursorLink = getCursorLinkForCurrentPhrase(cursorType, arg1, arg2, arg3)
  3464.             if cursorLink ~= nil then
  3465.                 DeathKnightSpellChatFrame.AddPhraseTextBox:Insert(cursorLink .. " ")
  3466.                 DeathKnightSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  3467.             else
  3468.                 DeathKnightSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  3469.             end
  3470.         end
  3471.         ClearCursor()
  3472.     end
  3473. )
  3474. DeathKnightSpellChatFrame.AddPhraseTextBox:SetScript(
  3475.     "OnEnterPressed",
  3476.     function()
  3477.         chatPhrase = DeathKnightSpellChatFrame.AddPhraseTextBox:GetText()
  3478.         if chatPhrase ~= "" then
  3479.             addChatStringToClassSpellList(chatPhrase)
  3480.             updateDeathKnightSpellChatList()
  3481.             DeathKnightSpellChatFrame.AddPhraseTextBox:SetText("")
  3482.         end
  3483.     end
  3484. )
  3485.  
  3486. local DeathKnightChatScrollParent =
  3487.     CreateFrame("Frame", "DeathKnightChatScrollParent", DeathKnightSpellChatFrameChatParent, "BackdropTemplate")
  3488. DeathKnightChatScrollParent:SetBackdrop(
  3489.     {
  3490.         bgFile = nil,
  3491.         insets = nil,
  3492.         tileSize = nil,
  3493.         tile = false,
  3494.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  3495.         edgeSize = NumberList.edgeSize
  3496.     }
  3497. )
  3498. DeathKnightChatScrollParent:SetBackdropBorderColor(unpack(ColourList.deathKnightEdge))
  3499. DeathKnightChatScrollParent:SetSize(NumberList.scrollSpellFrameWidth, NumberList.chatScrollParentHeight)
  3500. DeathKnightChatScrollParent:SetPoint("TOP", DeathKnightSpellChatFrameAddChatHeader, "BOTTOM", 0, -5)
  3501.  
  3502. local DeathKnightChatScrollFrame =
  3503.     CreateFrame("ScrollFrame", "DeathKnightChatScrollFrame", DeathKnightChatScrollParent, "FauxScrollFrameTemplate")
  3504. DeathKnightChatScrollFrame:SetPoint("TOPLEFT", 0, -8)
  3505. DeathKnightChatScrollFrame:SetPoint("BOTTOMRIGHT", -30, 8)
  3506. DeathKnightChatScrollFrame:SetScript(
  3507.     "OnVerticalScroll",
  3508.     function(self, offset)
  3509.         FauxScrollFrame_OnVerticalScroll(
  3510.             self,
  3511.             offset,
  3512.             NumberList.spellItemChatScrollButtonHeight,
  3513.             updateDeathKnightSpellChatList
  3514.         )
  3515.     end
  3516. )
  3517.  
  3518. DeathKnightChatScrollFrame.buttons = {}
  3519. for index = 1, NumberList.spellItemChatScrollButtonNumber do
  3520.     DeathKnightChatScrollFrame.buttons[index] =
  3521.         CreateFrame("Button", "$parentbtn" .. index, DeathKnightChatScrollParent, "OptionsListButtonTemplate")
  3522.     local button = DeathKnightChatScrollFrame.buttons[index]
  3523.     button:SetNormalFontObject(TextList.checkBoxSmallFontObject)
  3524.     button:SetHighlightFontObject(TextList.checkBoxSmallFontObject)
  3525.     button:SetSize(NumberList.scrollSpellFrameWidth, NumberList.phraseTextButtonHeight)
  3526.     button:SetPoint("TOPLEFT", 8, -(index - 1) * NumberList.phraseTextButtonHeight - 8)
  3527.     button:SetScript(
  3528.         "OnClick",
  3529.         function(self)
  3530.             VariableList.currentClassSpellPhrase = currentClassSpellList[self.index]
  3531.             clearCurrentClassSpellChat()
  3532.             updateDeathKnightSpellChatList()
  3533.         end
  3534.     )
  3535. end
  3536.  
  3537. DeathKnightSpellChatFrame.ClearChatListButton =
  3538.     CreateFrame(
  3539.     "Button",
  3540.     "DeathKnightSpellChatFrameClearChatListButton",
  3541.     DeathKnightSpellChatFrame,
  3542.     "BackdropTemplate",
  3543.     "UIMenuButtonStretchTemplate"
  3544. )
  3545. DeathKnightSpellChatFrame.ClearChatListButton:SetSize(
  3546.     NumberList.scrollSpellFrameWidth,
  3547.     NumberList.clearTargetListHeight
  3548. )
  3549. DeathKnightSpellChatFrame.ClearChatListButton:SetPoint("TOP", DeathKnightChatScrollParent, "BOTTOM", 0, -4)
  3550. DeathKnightSpellChatFrame.ClearChatListButton:SetBackdrop(
  3551.     {
  3552.         bgFile = nil,
  3553.         insets = nil,
  3554.         tileSize = nil,
  3555.         tile = true,
  3556.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  3557.         edgeSize = NumberList.edgeSize
  3558.     }
  3559. )
  3560. DeathKnightSpellChatFrame.ClearChatListButton:SetBackdropBorderColor(unpack(ColourList.deathKnightEdge))
  3561. DeathKnightSpellChatFrame.ClearChatListButton:SetNormalFontObject(TextList.buttonFontObject)
  3562. DeathKnightSpellChatFrame.ClearChatListButton:SetHighlightFontObject(TextList.buttonFontObject)
  3563. DeathKnightSpellChatFrame.ClearChatListButton:SetText(TextList.clearChatListButtonText)
  3564. DeathKnightSpellChatFrame.ClearChatListButton:RegisterForClicks("RightButtonUp")
  3565. DeathKnightSpellChatFrame.ClearChatListButton:SetScript(
  3566.     "OnClick",
  3567.     function()
  3568.         clearCurrentChatList()
  3569.         updateDeathKnightSpellChatList()
  3570.         DeathKnightSpellChatFrame.AddPhraseTextBox:SetText("")
  3571.     end
  3572. )
  3573.  
  3574. -- ===================================================================================================
  3575. -- ===================================================================================================
  3576. -- ===========================         DemonHunter class frame          ===========================
  3577. -- ===================================================================================================
  3578. -- ===================================================================================================
  3579.  
  3580. local DemonHunterSpellChatFrame =
  3581.     CreateFrame("Frame", "DemonHunterSpellChatFrame", SpellChatInterfaceFrame, "BackdropTemplate")
  3582. DemonHunterSpellChatFrame:SetSize(NumberList.classFrameWidth, NumberList.classFrameHeight)
  3583. DemonHunterSpellChatFrame:SetPoint("BOTTOM", SpellChatInterfaceFrame, "BOTTOM", 0, NumberList.spellChatFrameBottomGap)
  3584. DemonHunterSpellChatFrame:SetBackdrop(
  3585.     {
  3586.         bgFile = nil,
  3587.         insets = {
  3588.             left = NumberList.insetSize,
  3589.             right = NumberList.insetSize,
  3590.             top = NumberList.insetSize,
  3591.             bottom = NumberList.insetSize
  3592.         },
  3593.         tileSize = nil,
  3594.         tile = false,
  3595.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  3596.         edgeSize = NumberList.edgeSize
  3597.     }
  3598. )
  3599. DemonHunterSpellChatFrame:SetBackdropBorderColor(unpack(ColourList.demonHunterEdge))
  3600.  
  3601. DemonHunterSpellChatFrame.AddSpellButton =
  3602.     CreateFrame(
  3603.     "Button",
  3604.     "DemonHunterSpellChatFrameAddSpellButton",
  3605.     DemonHunterSpellChatFrame,
  3606.     "BackdropTemplate",
  3607.     "UIMenuButtonStretchTemplate"
  3608. )
  3609. DemonHunterSpellChatFrame.AddSpellButton:SetSize(NumberList.scrollFrameWidth, NumberList.chatHeaderHeight)
  3610. DemonHunterSpellChatFrame.AddSpellButton:SetPoint("TOPLEFT", DemonHunterSpellChatFrame, "TOPLEFT", 9, -10)
  3611. DemonHunterSpellChatFrame.AddSpellButton:SetBackdrop(
  3612.     {
  3613.         bgFile = nil,
  3614.         insets = nil,
  3615.         tileSize = nil,
  3616.         tile = true,
  3617.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  3618.         edgeSize = NumberList.edgeSize
  3619.     }
  3620. )
  3621. DemonHunterSpellChatFrame.AddSpellButton:SetBackdropBorderColor(unpack(ColourList.demonHunterEdge))
  3622. DemonHunterSpellChatFrame.AddSpellButton:SetNormalFontObject(TextList.buttonFontObject)
  3623. DemonHunterSpellChatFrame.AddSpellButton:SetHighlightFontObject(TextList.buttonFontObject)
  3624. DemonHunterSpellChatFrame.AddSpellButton:SetText(TextList.addSpellButtonText)
  3625. DemonHunterSpellChatFrame.AddSpellButton:SetScript(
  3626.     "OnReceiveDrag",
  3627.     function()
  3628.         toggleButton(VariableList.currentAddClassNavigationButton)
  3629.         if GetCursorInfo() then
  3630.             cursorType, _, _, spellID = GetCursorInfo()
  3631.             if cursorType ~= "spell" then
  3632.                 printErrorMessages("errorNotASpell")
  3633.             elseif checkIfSpellIsAlreadyListed(spellID) then
  3634.                 printErrorMessages("errorAlreadyListed")
  3635.             else
  3636.                 spellLink = GetSpellLink(spellID)
  3637.                 addSpellToClassSpellList(spellID, spellLink)
  3638.                 updateListBasedOnOpenFrame()
  3639.             end
  3640.             ClearCursor()
  3641.         end
  3642.     end
  3643. )
  3644. DemonHunterSpellChatFrame.AddSpellButton:SetScript(
  3645.     "OnClick",
  3646.     function()
  3647.         toggleButton(VariableList.currentAddClassNavigationButton)
  3648.         if GetCursorInfo() then
  3649.             cursorType, _, _, spellID = GetCursorInfo()
  3650.             if cursorType ~= "spell" then
  3651.                 printErrorMessages("errorNotASpell")
  3652.             elseif checkIfSpellIsAlreadyListed(spellID) then
  3653.                 printErrorMessages("errorAlreadyListed")
  3654.             else
  3655.                 spellLink = GetSpellLink(spellID)
  3656.                 addSpellToClassSpellList(spellID, spellLink)
  3657.                 updateListBasedOnOpenFrame()
  3658.             end
  3659.             ClearCursor()
  3660.         end
  3661.     end
  3662. )
  3663.  
  3664. local DemonHunterSpellScrollParent =
  3665.     CreateFrame(
  3666.     "Button",
  3667.     "DemonHunterSpellScrollParent",
  3668.     DemonHunterSpellChatFrame,
  3669.     "BackdropTemplate",
  3670.     "TooltipBorderedFrameTemplate"
  3671. )
  3672. DemonHunterSpellScrollParent:SetBackdrop(
  3673.     {
  3674.         bgFile = nil,
  3675.         insets = nil,
  3676.         tileSize = nil,
  3677.         tile = false,
  3678.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  3679.         edgeSize = NumberList.edgeSize
  3680.     }
  3681. )
  3682. DemonHunterSpellScrollParent:SetBackdropBorderColor(unpack(ColourList.demonHunterEdge))
  3683. DemonHunterSpellScrollParent:SetSize(NumberList.scrollFrameWidth, NumberList.scrollFrameHeight)
  3684. DemonHunterSpellScrollParent:SetPoint("TOP", DemonHunterSpellChatFrameAddSpellButton, "BOTTOM", 0, -5)
  3685.  
  3686. local DemonHunterSpellScrollFrame =
  3687.     CreateFrame("ScrollFrame", "DemonHunterSpellScrollFrame", DemonHunterSpellScrollParent, "FauxScrollFrameTemplate")
  3688. DemonHunterSpellScrollFrame:SetPoint("TOPLEFT", 0, -8)
  3689. DemonHunterSpellScrollFrame:SetPoint("BOTTOMRIGHT", -30, 8)
  3690. DemonHunterSpellScrollFrame:SetScript(
  3691.     "OnVerticalScroll",
  3692.     function(self, offset)
  3693.         FauxScrollFrame_OnVerticalScroll(
  3694.             self,
  3695.             offset,
  3696.             NumberList.spellItemScrollButtonHeight,
  3697.             updateDemonHunterSpellList
  3698.         )
  3699.     end
  3700. )
  3701.  
  3702. DemonHunterSpellScrollFrame.buttons = {}
  3703. for index = 1, NumberList.spellItemScrollButtonNumber do
  3704.     DemonHunterSpellScrollFrame.buttons[index] =
  3705.         CreateFrame("Button", "$parentbtn" .. index, DemonHunterSpellScrollParent, "OptionsListButtonTemplate")
  3706.     local button = DemonHunterSpellScrollFrame.buttons[index]
  3707.     button:SetNormalFontObject(TextList.checkBoxSmallFontObject)
  3708.     button:SetHighlightFontObject(TextList.checkBoxSmallFontObject)
  3709.     button:SetSize(NumberList.scrollFrameWidth, NumberList.phraseTextButtonHeight)
  3710.     button:SetPoint("TOPLEFT", 8, -(index - 1) * NumberList.phraseTextButtonHeight - 8)
  3711.     button:SetScript(
  3712.         "OnClick",
  3713.         function(self)
  3714.             VariableList.currentClassSpellList = DemonHunterSpellList
  3715.             VariableList.currentClassSpellLink = DemonHunterSpellList[self.index].spellLink
  3716.             VariableList.currentClassSpellID = DemonHunterSpellList[self.index].spellID
  3717.             VariableList.currentClassSpellPercentage = DemonHunterSpellList[self.index].percentage
  3718.             VariableList.currentClassSpellEnabled = DemonHunterSpellList[self.index].isEnabled
  3719.             loadSpellHeader()
  3720.             updateDemonHunterSpellChatList()
  3721.         end
  3722.     )
  3723.     button:SetScript(
  3724.         "OnEnter",
  3725.         function(self)
  3726.             GameTooltip:SetOwner(self, "ANCHOR_TOP", 0, 15)
  3727.             GameTooltip:SetHyperlink(DemonHunterSpellList[self.index].spellLink)
  3728.             GameTooltip:Show()
  3729.         end
  3730.     )
  3731. end
  3732.  
  3733. DemonHunterSpellChatFrame.ClearSpellListButton =
  3734.     CreateFrame(
  3735.     "Button",
  3736.     "DemonHunterSpellChatFrameClearSpellListButton",
  3737.     DemonHunterSpellChatFrame,
  3738.     "BackdropTemplate",
  3739.     "UIMenuButtonStretchTemplate"
  3740. )
  3741. DemonHunterSpellChatFrame.ClearSpellListButton:SetSize(NumberList.scrollFrameWidth, NumberList.clearTargetListHeight)
  3742. DemonHunterSpellChatFrame.ClearSpellListButton:SetPoint("TOP", DemonHunterSpellScrollParent, "BOTTOM", 0, -4)
  3743. DemonHunterSpellChatFrame.ClearSpellListButton:SetBackdrop(
  3744.     {
  3745.         bgFile = nil,
  3746.         insets = nil,
  3747.         tileSize = nil,
  3748.         tile = true,
  3749.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  3750.         edgeSize = NumberList.edgeSize
  3751.     }
  3752. )
  3753. DemonHunterSpellChatFrame.ClearSpellListButton:SetBackdropBorderColor(unpack(ColourList.demonHunterEdge))
  3754. DemonHunterSpellChatFrame.ClearSpellListButton:SetNormalFontObject(TextList.buttonFontObject)
  3755. DemonHunterSpellChatFrame.ClearSpellListButton:SetHighlightFontObject(TextList.buttonFontObject)
  3756. DemonHunterSpellChatFrame.ClearSpellListButton:SetText(TextList.clearSpellListButtonText)
  3757. DemonHunterSpellChatFrame.ClearSpellListButton:RegisterForClicks("RightButtonUp")
  3758. DemonHunterSpellChatFrame.ClearSpellListButton:SetScript(
  3759.     "OnClick",
  3760.     function()
  3761.         wipe(DemonHunterSpellList)
  3762.         clearCurrentClassSpell()
  3763.         updateDemonHunterSpellList()
  3764.         updateDemonHunterSpellChatList()
  3765.         DemonHunterSpellChatFrame.AddPhraseTextBox:SetText("")
  3766.         DemonHunterSpellChatFrame.AddPhraseTextBox:ClearFocus()
  3767.     end
  3768. )
  3769.  
  3770. DemonHunterSpellChatFrame.ChatParent =
  3771.     CreateFrame("Frame", "DemonHunterSpellChatFrameChatParent", DemonHunterSpellChatFrame)
  3772. DemonHunterSpellChatFrame.ChatParent:SetSize(NumberList.scrollSpellFrameWidth, NumberList.scrollSpellFrameHight)
  3773. DemonHunterSpellChatFrame.ChatParent:SetPoint("TOPRIGHT", DemonHunterSpellChatFrame, "TOPRIGHT", -9, -10)
  3774. DemonHunterSpellChatFrame.ChatHeader =
  3775.     CreateFrame("Frame", "DemonHunterSpellChatFrameChatHeader", DemonHunterSpellChatFrameChatParent, "BackdropTemplate")
  3776. DemonHunterSpellChatFrame.ChatHeader:SetBackdrop(
  3777.     {
  3778.         bgFile = nil,
  3779.         insets = nil,
  3780.         tileSize = nil,
  3781.         tile = false,
  3782.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  3783.         edgeSize = NumberList.edgeSize
  3784.     }
  3785. )
  3786. DemonHunterSpellChatFrame.ChatHeader:SetBackdropBorderColor(unpack(ColourList.demonHunterEdge))
  3787. DemonHunterSpellChatFrame.ChatHeader:SetSize(NumberList.scrollSpellFrameWidth, NumberList.chatHeaderHeight)
  3788. DemonHunterSpellChatFrame.ChatHeader:SetPoint("TOP", DemonHunterSpellChatFrameChatParent)
  3789. DemonHunterSpellChatFrame.TitleText = DemonHunterSpellChatFrame:CreateFontString("MyTestFrameTitleText")
  3790. DemonHunterSpellChatFrame.TitleText:SetPoint("TOPLEFT", DemonHunterSpellChatFrameChatHeader, "TOPLEFT", 10, -10)
  3791. DemonHunterSpellChatFrame.TitleText:SetFontObject(TextList.checkBoxFontObject)
  3792. DemonHunterSpellChatFrame.TitleText:SetText("")
  3793.  
  3794. DemonHunterSpellChatFrame.DeleteSpellButton =
  3795.     CreateFrame("Button", "DemonHunterSpellChatFrameDeleteSpellButton", DemonHunterSpellChatFrameChatHeader)
  3796. DemonHunterSpellChatFrame.DeleteSpellButton:SetPoint("RIGHT", DemonHunterSpellChatFrameChatHeader, "RIGHT", -10, 0)
  3797. DemonHunterSpellChatFrame.DeleteSpellButton:SetSize(NumberList.navButtonSize / 1.5, NumberList.navButtonSize / 1.5)
  3798. DemonHunterSpellChatFrame.DeleteSpellButton:SetNormalTexture(ImageList.removeSpellItemButton)
  3799. DemonHunterSpellChatFrame.DeleteSpellButton:SetHighlightTexture(ImageList.removeSpellItemButton, "BLEND")
  3800. DemonHunterSpellChatFrame.DeleteSpellButton:SetScript(
  3801.     "OnClick",
  3802.     function()
  3803.         clearCurrentClassSpell()
  3804.         updateDemonHunterSpellList()
  3805.         updateDemonHunterSpellChatList()
  3806.         DemonHunterSpellChatFrame.AddPhraseTextBox:SetText("")
  3807.         DemonHunterSpellChatFrame.AddPhraseTextBox:ClearFocus()
  3808.     end
  3809. )
  3810.  
  3811. DemonHunterSpellChatFrame.PercentageTextBox =
  3812.     CreateFrame(
  3813.     "EditBox",
  3814.     "DemonHunterSpellChatFramePercentageTextBox",
  3815.     DemonHunterSpellChatFrameChatHeader,
  3816.     "OptionsBoxTemplate"
  3817. )
  3818. DemonHunterSpellChatFrame.PercentageTextBox:SetPoint(
  3819.     "BOTTOMLEFT",
  3820.     DemonHunterSpellChatFrameChatHeader,
  3821.     "BOTTOMLEFT",
  3822.     10,
  3823.     5
  3824. )
  3825. DemonHunterSpellChatFrame.PercentageTextBox:SetFontObject(TextList.checkBoxSmallFontObject)
  3826. DemonHunterSpellChatFrame.PercentageTextBox:SetNumeric(true)
  3827. DemonHunterSpellChatFrame.PercentageTextBox:SetSize(
  3828.     NumberList.percentageTextBoxWidth,
  3829.     NumberList.percentageTextBoxHeight
  3830. )
  3831. DemonHunterSpellChatFrame.PercentageTextBox:SetMaxLetters(3)
  3832. DemonHunterSpellChatFrame.PercentageTextBox:SetAutoFocus()
  3833. DemonHunterSpellChatFrame.PercentageTextBox:SetText("")
  3834. DemonHunterSpellChatFrame.PercentageTextBox:SetJustifyH("CENTER")
  3835. DemonHunterSpellChatFrame.PercentageTextBox:SetScript(
  3836.     "OnEnterPressed",
  3837.     function(self)
  3838.         percentageNumber = tonumber(DemonHunterSpellChatFrame.PercentageTextBox:GetText())
  3839.         self:ClearFocus()
  3840.         updateSpellPercentage(percentageNumber)
  3841.     end
  3842. )
  3843.  
  3844. DemonHunterSpellChatFrame.PercentageText =
  3845.     DemonHunterSpellChatFrame:CreateFontString("DemonHunterSpellChatFramePercentageText")
  3846. DemonHunterSpellChatFrame.PercentageText:SetPoint("LEFT", DemonHunterSpellChatFramePercentageTextBox, "RIGHT")
  3847. DemonHunterSpellChatFrame.PercentageText:SetFontObject(TextList.checkBoxSmallFontObject)
  3848. DemonHunterSpellChatFrame.PercentageText:SetText(TextList.chatFrequencyText)
  3849.  
  3850. DemonHunterSpellChatFrame.EnableCheckbox =
  3851.     CreateFrame(
  3852.     "CheckButton",
  3853.     "DemonHunterSpellChatFrameEnableCheckbox",
  3854.     DemonHunterSpellChatFrameChatHeader,
  3855.     "UICheckButtonTemplate"
  3856. )
  3857. DemonHunterSpellChatFrame.EnableCheckbox:ClearAllPoints()
  3858. DemonHunterSpellChatFrame.EnableCheckbox:SetPoint(
  3859.     "LEFT",
  3860.     DemonHunterSpellChatFramePercentageText,
  3861.     "RIGHT",
  3862.     NumberList.enableCheckBoxSize,
  3863.     NumberList.checkEnableBottomGap
  3864. )
  3865. DemonHunterSpellChatFrame.EnableCheckbox:SetSize(NumberList.enableCheckBoxSize, NumberList.enableCheckBoxSize)
  3866. DemonHunterSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  3867. DemonHunterSpellChatFrame.EnableCheckbox.text:SetText(TextList.enableSpellChatsText)
  3868. DemonHunterSpellChatFrame.EnableCheckbox.text:SetFontObject(TextList.checkBoxSmallFontObject)
  3869. DemonHunterSpellChatFrame.EnableCheckbox:SetScript(
  3870.     "OnClick",
  3871.     function(self)
  3872.         if VariableList.currentClassSpellEnabled then
  3873.             VariableList.currentClassSpellEnabled = false
  3874.             updateSpellEnabled()
  3875.         elseif not VariableList.currentClassSpellEnabled then
  3876.             VariableList.currentClassSpellEnabled = true
  3877.             updateSpellEnabled()
  3878.         end
  3879.     end
  3880. )
  3881.  
  3882. DemonHunterSpellChatFrame.AddChatHeader =
  3883.     CreateFrame(
  3884.     "Frame",
  3885.     "DemonHunterSpellChatFrameAddChatHeader",
  3886.     DemonHunterSpellChatFrameChatParent,
  3887.     "BackdropTemplate"
  3888. )
  3889. DemonHunterSpellChatFrame.AddChatHeader:SetBackdrop(
  3890.     {
  3891.         bgFile = nil,
  3892.         insets = nil,
  3893.         tileSize = nil,
  3894.         tile = false,
  3895.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  3896.         edgeSize = NumberList.edgeSize
  3897.     }
  3898. )
  3899. DemonHunterSpellChatFrame.AddChatHeader:SetBackdropBorderColor(unpack(ColourList.demonHunterEdge))
  3900. DemonHunterSpellChatFrame.AddChatHeader:SetSize(NumberList.scrollSpellFrameWidth, NumberList.addChatHeaderHeight)
  3901. DemonHunterSpellChatFrame.AddChatHeader:SetPoint("TOP", DemonHunterSpellChatFrameChatHeader, "BOTTOM", 0, -5)
  3902.  
  3903. DemonHunterSpellChatFrame.AddPhraseTextBox =
  3904.     CreateFrame("EditBox", "DemonHunterSpellChatFrameAddPhraseTextBox", DemonHunterSpellChatFrameAddChatHeader)
  3905. DemonHunterSpellChatFrame.AddPhraseTextBox:SetPoint("LEFT", DemonHunterSpellChatFrameAddChatHeader, "LEFT", 10, 0)
  3906. DemonHunterSpellChatFrame.AddPhraseTextBox:SetFontObject(TextList.checkBoxSmallFontObject)
  3907. DemonHunterSpellChatFrame.AddPhraseTextBox:SetSize(
  3908.     NumberList.scrollSpellFrameWidth - NumberList.percentageTextBoxWidth,
  3909.     NumberList.addPhraseTextBoxHeight
  3910. )
  3911. DemonHunterSpellChatFrame.AddPhraseTextBox:SetMaxLetters(100)
  3912. DemonHunterSpellChatFrame.AddPhraseTextBox:SetAutoFocus(false)
  3913. DemonHunterSpellChatFrame.AddPhraseTextBox:SetJustifyH("LEFT")
  3914. DemonHunterSpellChatFrame.AddPhraseTextBox:SetScript(
  3915.     "OnReceiveDrag",
  3916.     function()
  3917.         if GetCursorInfo() then
  3918.             cursorType, arg1, arg2, arg3 = GetCursorInfo()
  3919.             cursorLink = getCursorLinkForCurrentPhrase(cursorType, arg1, arg2, arg3)
  3920.             if cursorLink ~= nil then
  3921.                 DemonHunterSpellChatFrame.AddPhraseTextBox:Insert(cursorLink .. " ")
  3922.                 DemonHunterSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  3923.             else
  3924.                 DemonHunterSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  3925.             end
  3926.         end
  3927.         ClearCursor()
  3928.     end
  3929. )
  3930. DemonHunterSpellChatFrame.AddPhraseTextBox:SetScript(
  3931.     "OnMouseDown",
  3932.     function()
  3933.         if GetCursorInfo() then
  3934.             cursorType, arg1, arg2, arg3 = GetCursorInfo()
  3935.             cursorLink = getCursorLinkForCurrentPhrase(cursorType, arg1, arg2, arg3)
  3936.             if cursorLink ~= nil then
  3937.                 DemonHunterSpellChatFrame.AddPhraseTextBox:Insert(cursorLink .. " ")
  3938.                 DemonHunterSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  3939.             else
  3940.                 DemonHunterSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  3941.             end
  3942.         end
  3943.         ClearCursor()
  3944.     end
  3945. )
  3946. DemonHunterSpellChatFrame.AddPhraseTextBox:SetScript(
  3947.     "OnEnterPressed",
  3948.     function()
  3949.         chatPhrase = DemonHunterSpellChatFrame.AddPhraseTextBox:GetText()
  3950.         if chatPhrase ~= "" then
  3951.             addChatStringToClassSpellList(chatPhrase)
  3952.             updateDemonHunterSpellChatList()
  3953.             DemonHunterSpellChatFrame.AddPhraseTextBox:SetText("")
  3954.         end
  3955.     end
  3956. )
  3957.  
  3958. local DemonHunterChatScrollParent =
  3959.     CreateFrame("Frame", "DemonHunterChatScrollParent", DemonHunterSpellChatFrameChatParent, "BackdropTemplate")
  3960. DemonHunterChatScrollParent:SetBackdrop(
  3961.     {
  3962.         bgFile = nil,
  3963.         insets = nil,
  3964.         tileSize = nil,
  3965.         tile = false,
  3966.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  3967.         edgeSize = NumberList.edgeSize
  3968.     }
  3969. )
  3970. DemonHunterChatScrollParent:SetBackdropBorderColor(unpack(ColourList.demonHunterEdge))
  3971. DemonHunterChatScrollParent:SetSize(NumberList.scrollSpellFrameWidth, NumberList.chatScrollParentHeight)
  3972. DemonHunterChatScrollParent:SetPoint("TOP", DemonHunterSpellChatFrameAddChatHeader, "BOTTOM", 0, -5)
  3973.  
  3974. local DemonHunterChatScrollFrame =
  3975.     CreateFrame("ScrollFrame", "DemonHunterChatScrollFrame", DemonHunterChatScrollParent, "FauxScrollFrameTemplate")
  3976. DemonHunterChatScrollFrame:SetPoint("TOPLEFT", 0, -8)
  3977. DemonHunterChatScrollFrame:SetPoint("BOTTOMRIGHT", -30, 8)
  3978. DemonHunterChatScrollFrame:SetScript(
  3979.     "OnVerticalScroll",
  3980.     function(self, offset)
  3981.         FauxScrollFrame_OnVerticalScroll(
  3982.             self,
  3983.             offset,
  3984.             NumberList.spellItemChatScrollButtonHeight,
  3985.             updateDemonHunterSpellChatList
  3986.         )
  3987.     end
  3988. )
  3989.  
  3990. DemonHunterChatScrollFrame.buttons = {}
  3991. for index = 1, NumberList.spellItemChatScrollButtonNumber do
  3992.     DemonHunterChatScrollFrame.buttons[index] =
  3993.         CreateFrame("Button", "$parentbtn" .. index, DemonHunterChatScrollParent, "OptionsListButtonTemplate")
  3994.     local button = DemonHunterChatScrollFrame.buttons[index]
  3995.     button:SetNormalFontObject(TextList.checkBoxSmallFontObject)
  3996.     button:SetHighlightFontObject(TextList.checkBoxSmallFontObject)
  3997.     button:SetSize(NumberList.scrollSpellFrameWidth, NumberList.phraseTextButtonHeight)
  3998.     button:SetPoint("TOPLEFT", 8, -(index - 1) * NumberList.phraseTextButtonHeight - 8)
  3999.     button:SetScript(
  4000.         "OnClick",
  4001.         function(self)
  4002.             VariableList.currentClassSpellPhrase = currentClassSpellList[self.index]
  4003.             clearCurrentClassSpellChat()
  4004.             updateDemonHunterSpellChatList()
  4005.         end
  4006.     )
  4007. end
  4008.  
  4009. DemonHunterSpellChatFrame.ClearChatListButton =
  4010.     CreateFrame(
  4011.     "Button",
  4012.     "DemonHunterSpellChatFrameClearChatListButton",
  4013.     DemonHunterSpellChatFrame,
  4014.     "BackdropTemplate",
  4015.     "UIMenuButtonStretchTemplate"
  4016. )
  4017. DemonHunterSpellChatFrame.ClearChatListButton:SetSize(
  4018.     NumberList.scrollSpellFrameWidth,
  4019.     NumberList.clearTargetListHeight
  4020. )
  4021. DemonHunterSpellChatFrame.ClearChatListButton:SetPoint("TOP", DemonHunterChatScrollParent, "BOTTOM", 0, -4)
  4022. DemonHunterSpellChatFrame.ClearChatListButton:SetBackdrop(
  4023.     {
  4024.         bgFile = nil,
  4025.         insets = nil,
  4026.         tileSize = nil,
  4027.         tile = true,
  4028.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4029.         edgeSize = NumberList.edgeSize
  4030.     }
  4031. )
  4032. DemonHunterSpellChatFrame.ClearChatListButton:SetBackdropBorderColor(unpack(ColourList.demonHunterEdge))
  4033. DemonHunterSpellChatFrame.ClearChatListButton:SetNormalFontObject(TextList.buttonFontObject)
  4034. DemonHunterSpellChatFrame.ClearChatListButton:SetHighlightFontObject(TextList.buttonFontObject)
  4035. DemonHunterSpellChatFrame.ClearChatListButton:SetText(TextList.clearChatListButtonText)
  4036. DemonHunterSpellChatFrame.ClearChatListButton:RegisterForClicks("RightButtonUp")
  4037. DemonHunterSpellChatFrame.ClearChatListButton:SetScript(
  4038.     "OnClick",
  4039.     function()
  4040.         clearCurrentChatList()
  4041.         updateDemonHunterSpellChatList()
  4042.         DemonHunterSpellChatFrame.AddPhraseTextBox:SetText("")
  4043.     end
  4044. )
  4045.  
  4046. -- ===================================================================================================
  4047. -- ===================================================================================================
  4048. -- ===========================         Druid class frame          ===========================
  4049. -- ===================================================================================================
  4050. -- ===================================================================================================
  4051.  
  4052. local DruidSpellChatFrame = CreateFrame("Frame", "DruidSpellChatFrame", SpellChatInterfaceFrame, "BackdropTemplate")
  4053. DruidSpellChatFrame:SetSize(NumberList.classFrameWidth, NumberList.classFrameHeight)
  4054. DruidSpellChatFrame:SetPoint("BOTTOM", SpellChatInterfaceFrame, "BOTTOM", 0, NumberList.spellChatFrameBottomGap)
  4055. DruidSpellChatFrame:SetBackdrop(
  4056.     {
  4057.         bgFile = nil,
  4058.         insets = {
  4059.             left = NumberList.insetSize,
  4060.             right = NumberList.insetSize,
  4061.             top = NumberList.insetSize,
  4062.             bottom = NumberList.insetSize
  4063.         },
  4064.         tileSize = nil,
  4065.         tile = false,
  4066.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4067.         edgeSize = NumberList.edgeSize
  4068.     }
  4069. )
  4070. DruidSpellChatFrame:SetBackdropBorderColor(unpack(ColourList.druidEdge))
  4071.  
  4072. DruidSpellChatFrame.AddSpellButton =
  4073.     CreateFrame(
  4074.     "Button",
  4075.     "DruidSpellChatFrameAddSpellButton",
  4076.     DruidSpellChatFrame,
  4077.     "BackdropTemplate",
  4078.     "UIMenuButtonStretchTemplate"
  4079. )
  4080. DruidSpellChatFrame.AddSpellButton:SetSize(NumberList.scrollFrameWidth, NumberList.chatHeaderHeight)
  4081. DruidSpellChatFrame.AddSpellButton:SetPoint("TOPLEFT", DruidSpellChatFrame, "TOPLEFT", 9, -10)
  4082. DruidSpellChatFrame.AddSpellButton:SetBackdrop(
  4083.     {
  4084.         bgFile = nil,
  4085.         insets = nil,
  4086.         tileSize = nil,
  4087.         tile = true,
  4088.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4089.         edgeSize = NumberList.edgeSize
  4090.     }
  4091. )
  4092. DruidSpellChatFrame.AddSpellButton:SetBackdropBorderColor(unpack(ColourList.druidEdge))
  4093. DruidSpellChatFrame.AddSpellButton:SetNormalFontObject(TextList.buttonFontObject)
  4094. DruidSpellChatFrame.AddSpellButton:SetHighlightFontObject(TextList.buttonFontObject)
  4095. DruidSpellChatFrame.AddSpellButton:SetText(TextList.addSpellButtonText)
  4096. DruidSpellChatFrame.AddSpellButton:SetScript(
  4097.     "OnReceiveDrag",
  4098.     function()
  4099.         toggleButton(VariableList.currentAddClassNavigationButton)
  4100.         if GetCursorInfo() then
  4101.             cursorType, _, _, spellID = GetCursorInfo()
  4102.             if cursorType ~= "spell" then
  4103.                 printErrorMessages("errorNotASpell")
  4104.             elseif checkIfSpellIsAlreadyListed(spellID) then
  4105.                 printErrorMessages("errorAlreadyListed")
  4106.             else
  4107.                 spellLink = GetSpellLink(spellID)
  4108.                 addSpellToClassSpellList(spellID, spellLink)
  4109.                 updateListBasedOnOpenFrame()
  4110.             end
  4111.             ClearCursor()
  4112.         end
  4113.     end
  4114. )
  4115. DruidSpellChatFrame.AddSpellButton:SetScript(
  4116.     "OnClick",
  4117.     function()
  4118.         toggleButton(VariableList.currentAddClassNavigationButton)
  4119.         if GetCursorInfo() then
  4120.             cursorType, _, _, spellID = GetCursorInfo()
  4121.             if cursorType ~= "spell" then
  4122.                 printErrorMessages("errorNotASpell")
  4123.             elseif checkIfSpellIsAlreadyListed(spellID) then
  4124.                 printErrorMessages("errorAlreadyListed")
  4125.             else
  4126.                 spellLink = GetSpellLink(spellID)
  4127.                 addSpellToClassSpellList(spellID, spellLink)
  4128.                 updateListBasedOnOpenFrame()
  4129.             end
  4130.             ClearCursor()
  4131.         end
  4132.     end
  4133. )
  4134.  
  4135. local DruidSpellScrollParent =
  4136.     CreateFrame(
  4137.     "Button",
  4138.     "DruidSpellScrollParent",
  4139.     DruidSpellChatFrame,
  4140.     "BackdropTemplate",
  4141.     "TooltipBorderedFrameTemplate"
  4142. )
  4143. DruidSpellScrollParent:SetBackdrop(
  4144.     {
  4145.         bgFile = nil,
  4146.         insets = nil,
  4147.         tileSize = nil,
  4148.         tile = false,
  4149.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4150.         edgeSize = NumberList.edgeSize
  4151.     }
  4152. )
  4153. DruidSpellScrollParent:SetBackdropBorderColor(unpack(ColourList.druidEdge))
  4154. DruidSpellScrollParent:SetSize(NumberList.scrollFrameWidth, NumberList.scrollFrameHeight)
  4155. DruidSpellScrollParent:SetPoint("TOP", DruidSpellChatFrameAddSpellButton, "BOTTOM", 0, -5)
  4156.  
  4157. local DruidSpellScrollFrame =
  4158.     CreateFrame("ScrollFrame", "DruidSpellScrollFrame", DruidSpellScrollParent, "FauxScrollFrameTemplate")
  4159. DruidSpellScrollFrame:SetPoint("TOPLEFT", 0, -8)
  4160. DruidSpellScrollFrame:SetPoint("BOTTOMRIGHT", -30, 8)
  4161. DruidSpellScrollFrame:SetScript(
  4162.     "OnVerticalScroll",
  4163.     function(self, offset)
  4164.         FauxScrollFrame_OnVerticalScroll(self, offset, NumberList.spellItemScrollButtonHeight, updateDruidSpellList)
  4165.     end
  4166. )
  4167.  
  4168. DruidSpellScrollFrame.buttons = {}
  4169. for index = 1, NumberList.spellItemScrollButtonNumber do
  4170.     DruidSpellScrollFrame.buttons[index] =
  4171.         CreateFrame("Button", "$parentbtn" .. index, DruidSpellScrollParent, "OptionsListButtonTemplate")
  4172.     local button = DruidSpellScrollFrame.buttons[index]
  4173.     button:SetNormalFontObject(TextList.checkBoxSmallFontObject)
  4174.     button:SetHighlightFontObject(TextList.checkBoxSmallFontObject)
  4175.     button:SetSize(NumberList.scrollFrameWidth, NumberList.phraseTextButtonHeight)
  4176.     button:SetPoint("TOPLEFT", 8, -(index - 1) * NumberList.phraseTextButtonHeight - 8)
  4177.     button:SetScript(
  4178.         "OnClick",
  4179.         function(self)
  4180.             VariableList.currentClassSpellList = DruidSpellList
  4181.             VariableList.currentClassSpellLink = DruidSpellList[self.index].spellLink
  4182.             VariableList.currentClassSpellID = DruidSpellList[self.index].spellID
  4183.             VariableList.currentClassSpellPercentage = DruidSpellList[self.index].percentage
  4184.             VariableList.currentClassSpellEnabled = DruidSpellList[self.index].isEnabled
  4185.             loadSpellHeader()
  4186.             updateDruidSpellChatList()
  4187.         end
  4188.     )
  4189.     button:SetScript(
  4190.         "OnEnter",
  4191.         function(self)
  4192.             GameTooltip:SetOwner(self, "ANCHOR_TOP", 0, 15)
  4193.             GameTooltip:SetHyperlink(DruidSpellList[self.index].spellLink)
  4194.             GameTooltip:Show()
  4195.         end
  4196.     )
  4197. end
  4198.  
  4199. DruidSpellChatFrame.ClearSpellListButton =
  4200.     CreateFrame(
  4201.     "Button",
  4202.     "DruidSpellChatFrameClearSpellListButton",
  4203.     DruidSpellChatFrame,
  4204.     "BackdropTemplate",
  4205.     "UIMenuButtonStretchTemplate"
  4206. )
  4207. DruidSpellChatFrame.ClearSpellListButton:SetSize(NumberList.scrollFrameWidth, NumberList.clearTargetListHeight)
  4208. DruidSpellChatFrame.ClearSpellListButton:SetPoint("TOP", DruidSpellScrollParent, "BOTTOM", 0, -4)
  4209. DruidSpellChatFrame.ClearSpellListButton:SetBackdrop(
  4210.     {
  4211.         bgFile = nil,
  4212.         insets = nil,
  4213.         tileSize = nil,
  4214.         tile = true,
  4215.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4216.         edgeSize = NumberList.edgeSize
  4217.     }
  4218. )
  4219. DruidSpellChatFrame.ClearSpellListButton:SetBackdropBorderColor(unpack(ColourList.druidEdge))
  4220. DruidSpellChatFrame.ClearSpellListButton:SetNormalFontObject(TextList.buttonFontObject)
  4221. DruidSpellChatFrame.ClearSpellListButton:SetHighlightFontObject(TextList.buttonFontObject)
  4222. DruidSpellChatFrame.ClearSpellListButton:SetText(TextList.clearSpellListButtonText)
  4223. DruidSpellChatFrame.ClearSpellListButton:RegisterForClicks("RightButtonUp")
  4224. DruidSpellChatFrame.ClearSpellListButton:SetScript(
  4225.     "OnClick",
  4226.     function()
  4227.         wipe(DruidSpellList)
  4228.         clearCurrentClassSpell()
  4229.         updateDruidSpellList()
  4230.         updateDruidSpellChatList()
  4231.         DruidSpellChatFrame.AddPhraseTextBox:SetText("")
  4232.         DruidSpellChatFrame.AddPhraseTextBox:ClearFocus()
  4233.     end
  4234. )
  4235.  
  4236. DruidSpellChatFrame.ChatParent = CreateFrame("Frame", "DruidSpellChatFrameChatParent", DruidSpellChatFrame)
  4237. DruidSpellChatFrame.ChatParent:SetSize(NumberList.scrollSpellFrameWidth, NumberList.scrollSpellFrameHight)
  4238. DruidSpellChatFrame.ChatParent:SetPoint("TOPRIGHT", DruidSpellChatFrame, "TOPRIGHT", -9, -10)
  4239. DruidSpellChatFrame.ChatHeader =
  4240.     CreateFrame("Frame", "DruidSpellChatFrameChatHeader", DruidSpellChatFrameChatParent, "BackdropTemplate")
  4241. DruidSpellChatFrame.ChatHeader:SetBackdrop(
  4242.     {
  4243.         bgFile = nil,
  4244.         insets = nil,
  4245.         tileSize = nil,
  4246.         tile = false,
  4247.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4248.         edgeSize = NumberList.edgeSize
  4249.     }
  4250. )
  4251. DruidSpellChatFrame.ChatHeader:SetBackdropBorderColor(unpack(ColourList.druidEdge))
  4252. DruidSpellChatFrame.ChatHeader:SetSize(NumberList.scrollSpellFrameWidth, NumberList.chatHeaderHeight)
  4253. DruidSpellChatFrame.ChatHeader:SetPoint("TOP", DruidSpellChatFrameChatParent)
  4254. DruidSpellChatFrame.TitleText = DruidSpellChatFrame:CreateFontString("MyTestFrameTitleText")
  4255. DruidSpellChatFrame.TitleText:SetPoint("TOPLEFT", DruidSpellChatFrameChatHeader, "TOPLEFT", 10, -10)
  4256. DruidSpellChatFrame.TitleText:SetFontObject(TextList.checkBoxFontObject)
  4257. DruidSpellChatFrame.TitleText:SetText("")
  4258.  
  4259. DruidSpellChatFrame.DeleteSpellButton =
  4260.     CreateFrame("Button", "DruidSpellChatFrameDeleteSpellButton", DruidSpellChatFrameChatHeader)
  4261. DruidSpellChatFrame.DeleteSpellButton:SetPoint("RIGHT", DruidSpellChatFrameChatHeader, "RIGHT", -10, 0)
  4262. DruidSpellChatFrame.DeleteSpellButton:SetSize(NumberList.navButtonSize / 1.5, NumberList.navButtonSize / 1.5)
  4263. DruidSpellChatFrame.DeleteSpellButton:SetNormalTexture(ImageList.removeSpellItemButton)
  4264. DruidSpellChatFrame.DeleteSpellButton:SetHighlightTexture(ImageList.removeSpellItemButton, "BLEND")
  4265. DruidSpellChatFrame.DeleteSpellButton:SetScript(
  4266.     "OnClick",
  4267.     function()
  4268.         clearCurrentClassSpell()
  4269.         updateDruidSpellList()
  4270.         updateDruidSpellChatList()
  4271.         DruidSpellChatFrame.AddPhraseTextBox:SetText("")
  4272.         DruidSpellChatFrame.AddPhraseTextBox:ClearFocus()
  4273.     end
  4274. )
  4275.  
  4276. DruidSpellChatFrame.PercentageTextBox =
  4277.     CreateFrame("EditBox", "DruidSpellChatFramePercentageTextBox", DruidSpellChatFrameChatHeader, "OptionsBoxTemplate")
  4278. DruidSpellChatFrame.PercentageTextBox:SetPoint("BOTTOMLEFT", DruidSpellChatFrameChatHeader, "BOTTOMLEFT", 10, 5)
  4279. DruidSpellChatFrame.PercentageTextBox:SetFontObject(TextList.checkBoxSmallFontObject)
  4280. DruidSpellChatFrame.PercentageTextBox:SetNumeric(true)
  4281. DruidSpellChatFrame.PercentageTextBox:SetSize(NumberList.percentageTextBoxWidth, NumberList.percentageTextBoxHeight)
  4282. DruidSpellChatFrame.PercentageTextBox:SetMaxLetters(3)
  4283. DruidSpellChatFrame.PercentageTextBox:SetAutoFocus()
  4284. DruidSpellChatFrame.PercentageTextBox:SetText("")
  4285. DruidSpellChatFrame.PercentageTextBox:SetJustifyH("CENTER")
  4286. DruidSpellChatFrame.PercentageTextBox:SetScript(
  4287.     "OnEnterPressed",
  4288.     function(self)
  4289.         percentageNumber = tonumber(DruidSpellChatFrame.PercentageTextBox:GetText())
  4290.         self:ClearFocus()
  4291.         updateSpellPercentage(percentageNumber)
  4292.     end
  4293. )
  4294.  
  4295. DruidSpellChatFrame.PercentageText = DruidSpellChatFrame:CreateFontString("DruidSpellChatFramePercentageText")
  4296. DruidSpellChatFrame.PercentageText:SetPoint("LEFT", DruidSpellChatFramePercentageTextBox, "RIGHT")
  4297. DruidSpellChatFrame.PercentageText:SetFontObject(TextList.checkBoxSmallFontObject)
  4298. DruidSpellChatFrame.PercentageText:SetText(TextList.chatFrequencyText)
  4299.  
  4300. DruidSpellChatFrame.EnableCheckbox =
  4301.     CreateFrame(
  4302.     "CheckButton",
  4303.     "DruidSpellChatFrameEnableCheckbox",
  4304.     DruidSpellChatFrameChatHeader,
  4305.     "UICheckButtonTemplate"
  4306. )
  4307. DruidSpellChatFrame.EnableCheckbox:ClearAllPoints()
  4308. DruidSpellChatFrame.EnableCheckbox:SetPoint(
  4309.     "LEFT",
  4310.     DruidSpellChatFramePercentageText,
  4311.     "RIGHT",
  4312.     NumberList.enableCheckBoxSize,
  4313.     NumberList.checkEnableBottomGap
  4314. )
  4315. DruidSpellChatFrame.EnableCheckbox:SetSize(NumberList.enableCheckBoxSize, NumberList.enableCheckBoxSize)
  4316. DruidSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  4317. DruidSpellChatFrame.EnableCheckbox.text:SetText(TextList.enableSpellChatsText)
  4318. DruidSpellChatFrame.EnableCheckbox.text:SetFontObject(TextList.checkBoxSmallFontObject)
  4319. DruidSpellChatFrame.EnableCheckbox:SetScript(
  4320.     "OnClick",
  4321.     function(self)
  4322.         if VariableList.currentClassSpellEnabled then
  4323.             VariableList.currentClassSpellEnabled = false
  4324.             updateSpellEnabled()
  4325.         elseif not VariableList.currentClassSpellEnabled then
  4326.             VariableList.currentClassSpellEnabled = true
  4327.             updateSpellEnabled()
  4328.         end
  4329.     end
  4330. )
  4331.  
  4332. DruidSpellChatFrame.AddChatHeader =
  4333.     CreateFrame("Frame", "DruidSpellChatFrameAddChatHeader", DruidSpellChatFrameChatParent, "BackdropTemplate")
  4334. DruidSpellChatFrame.AddChatHeader:SetBackdrop(
  4335.     {
  4336.         bgFile = nil,
  4337.         insets = nil,
  4338.         tileSize = nil,
  4339.         tile = false,
  4340.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4341.         edgeSize = NumberList.edgeSize
  4342.     }
  4343. )
  4344. DruidSpellChatFrame.AddChatHeader:SetBackdropBorderColor(unpack(ColourList.druidEdge))
  4345. DruidSpellChatFrame.AddChatHeader:SetSize(NumberList.scrollSpellFrameWidth, NumberList.addChatHeaderHeight)
  4346. DruidSpellChatFrame.AddChatHeader:SetPoint("TOP", DruidSpellChatFrameChatHeader, "BOTTOM", 0, -5)
  4347.  
  4348. DruidSpellChatFrame.AddPhraseTextBox =
  4349.     CreateFrame("EditBox", "DruidSpellChatFrameAddPhraseTextBox", DruidSpellChatFrameAddChatHeader)
  4350. DruidSpellChatFrame.AddPhraseTextBox:SetPoint("LEFT", DruidSpellChatFrameAddChatHeader, "LEFT", 10, 0)
  4351. DruidSpellChatFrame.AddPhraseTextBox:SetFontObject(TextList.checkBoxSmallFontObject)
  4352. DruidSpellChatFrame.AddPhraseTextBox:SetSize(
  4353.     NumberList.scrollSpellFrameWidth - NumberList.percentageTextBoxWidth,
  4354.     NumberList.addPhraseTextBoxHeight
  4355. )
  4356. DruidSpellChatFrame.AddPhraseTextBox:SetMaxLetters(100)
  4357. DruidSpellChatFrame.AddPhraseTextBox:SetAutoFocus(false)
  4358. DruidSpellChatFrame.AddPhraseTextBox:SetJustifyH("LEFT")
  4359. DruidSpellChatFrame.AddPhraseTextBox:SetScript(
  4360.     "OnReceiveDrag",
  4361.     function()
  4362.         if GetCursorInfo() then
  4363.             cursorType, arg1, arg2, arg3 = GetCursorInfo()
  4364.             cursorLink = getCursorLinkForCurrentPhrase(cursorType, arg1, arg2, arg3)
  4365.             if cursorLink ~= nil then
  4366.                 DruidSpellChatFrame.AddPhraseTextBox:Insert(cursorLink .. " ")
  4367.                 DruidSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  4368.             else
  4369.                 DruidSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  4370.             end
  4371.         end
  4372.         ClearCursor()
  4373.     end
  4374. )
  4375. DruidSpellChatFrame.AddPhraseTextBox:SetScript(
  4376.     "OnMouseDown",
  4377.     function()
  4378.         if GetCursorInfo() then
  4379.             cursorType, arg1, arg2, arg3 = GetCursorInfo()
  4380.             cursorLink = getCursorLinkForCurrentPhrase(cursorType, arg1, arg2, arg3)
  4381.             if cursorLink ~= nil then
  4382.                 DruidSpellChatFrame.AddPhraseTextBox:Insert(cursorLink .. " ")
  4383.                 DruidSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  4384.             else
  4385.                 DruidSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  4386.             end
  4387.         end
  4388.         ClearCursor()
  4389.     end
  4390. )
  4391. DruidSpellChatFrame.AddPhraseTextBox:SetScript(
  4392.     "OnEnterPressed",
  4393.     function()
  4394.         chatPhrase = DruidSpellChatFrame.AddPhraseTextBox:GetText()
  4395.         if chatPhrase ~= "" then
  4396.             addChatStringToClassSpellList(chatPhrase)
  4397.             updateDruidSpellChatList()
  4398.             DruidSpellChatFrame.AddPhraseTextBox:SetText("")
  4399.         end
  4400.     end
  4401. )
  4402.  
  4403. local DruidChatScrollParent =
  4404.     CreateFrame("Frame", "DruidChatScrollParent", DruidSpellChatFrameChatParent, "BackdropTemplate")
  4405. DruidChatScrollParent:SetBackdrop(
  4406.     {
  4407.         bgFile = nil,
  4408.         insets = nil,
  4409.         tileSize = nil,
  4410.         tile = false,
  4411.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4412.         edgeSize = NumberList.edgeSize
  4413.     }
  4414. )
  4415. DruidChatScrollParent:SetBackdropBorderColor(unpack(ColourList.druidEdge))
  4416. DruidChatScrollParent:SetSize(NumberList.scrollSpellFrameWidth, NumberList.chatScrollParentHeight)
  4417. DruidChatScrollParent:SetPoint("TOP", DruidSpellChatFrameAddChatHeader, "BOTTOM", 0, -5)
  4418.  
  4419. local DruidChatScrollFrame =
  4420.     CreateFrame("ScrollFrame", "DruidChatScrollFrame", DruidChatScrollParent, "FauxScrollFrameTemplate")
  4421. DruidChatScrollFrame:SetPoint("TOPLEFT", 0, -8)
  4422. DruidChatScrollFrame:SetPoint("BOTTOMRIGHT", -30, 8)
  4423. DruidChatScrollFrame:SetScript(
  4424.     "OnVerticalScroll",
  4425.     function(self, offset)
  4426.         FauxScrollFrame_OnVerticalScroll(
  4427.             self,
  4428.             offset,
  4429.             NumberList.spellItemChatScrollButtonHeight,
  4430.             updateDruidSpellChatList
  4431.         )
  4432.     end
  4433. )
  4434.  
  4435. DruidChatScrollFrame.buttons = {}
  4436. for index = 1, NumberList.spellItemChatScrollButtonNumber do
  4437.     DruidChatScrollFrame.buttons[index] =
  4438.         CreateFrame("Button", "$parentbtn" .. index, DruidChatScrollParent, "OptionsListButtonTemplate")
  4439.     local button = DruidChatScrollFrame.buttons[index]
  4440.     button:SetNormalFontObject(TextList.checkBoxSmallFontObject)
  4441.     button:SetHighlightFontObject(TextList.checkBoxSmallFontObject)
  4442.     button:SetSize(NumberList.scrollSpellFrameWidth, NumberList.phraseTextButtonHeight)
  4443.     button:SetPoint("TOPLEFT", 8, -(index - 1) * NumberList.phraseTextButtonHeight - 8)
  4444.     button:SetScript(
  4445.         "OnClick",
  4446.         function(self)
  4447.             VariableList.currentClassSpellPhrase = currentClassSpellList[self.index]
  4448.             clearCurrentClassSpellChat()
  4449.             updateDruidSpellChatList()
  4450.         end
  4451.     )
  4452. end
  4453.  
  4454. DruidSpellChatFrame.ClearChatListButton =
  4455.     CreateFrame(
  4456.     "Button",
  4457.     "DruidSpellChatFrameClearChatListButton",
  4458.     DruidSpellChatFrame,
  4459.     "BackdropTemplate",
  4460.     "UIMenuButtonStretchTemplate"
  4461. )
  4462. DruidSpellChatFrame.ClearChatListButton:SetSize(NumberList.scrollSpellFrameWidth, NumberList.clearTargetListHeight)
  4463. DruidSpellChatFrame.ClearChatListButton:SetPoint("TOP", DruidChatScrollParent, "BOTTOM", 0, -4)
  4464. DruidSpellChatFrame.ClearChatListButton:SetBackdrop(
  4465.     {
  4466.         bgFile = nil,
  4467.         insets = nil,
  4468.         tileSize = nil,
  4469.         tile = true,
  4470.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4471.         edgeSize = NumberList.edgeSize
  4472.     }
  4473. )
  4474. DruidSpellChatFrame.ClearChatListButton:SetBackdropBorderColor(unpack(ColourList.druidEdge))
  4475. DruidSpellChatFrame.ClearChatListButton:SetNormalFontObject(TextList.buttonFontObject)
  4476. DruidSpellChatFrame.ClearChatListButton:SetHighlightFontObject(TextList.buttonFontObject)
  4477. DruidSpellChatFrame.ClearChatListButton:SetText(TextList.clearChatListButtonText)
  4478. DruidSpellChatFrame.ClearChatListButton:RegisterForClicks("RightButtonUp")
  4479. DruidSpellChatFrame.ClearChatListButton:SetScript(
  4480.     "OnClick",
  4481.     function()
  4482.         clearCurrentChatList()
  4483.         updateDruidSpellChatList()
  4484.         DruidSpellChatFrame.AddPhraseTextBox:SetText("")
  4485.     end
  4486. )
  4487.  
  4488. -- ===================================================================================================
  4489. -- ===================================================================================================
  4490. -- ===========================         Hunter class frame          ===========================
  4491. -- ===================================================================================================
  4492. -- ===================================================================================================
  4493.  
  4494. local HunterSpellChatFrame = CreateFrame("Frame", "HunterSpellChatFrame", SpellChatInterfaceFrame, "BackdropTemplate")
  4495. HunterSpellChatFrame:SetSize(NumberList.classFrameWidth, NumberList.classFrameHeight)
  4496. HunterSpellChatFrame:SetPoint("BOTTOM", SpellChatInterfaceFrame, "BOTTOM", 0, NumberList.spellChatFrameBottomGap)
  4497. HunterSpellChatFrame:SetBackdrop(
  4498.     {
  4499.         bgFile = nil,
  4500.         insets = {
  4501.             left = NumberList.insetSize,
  4502.             right = NumberList.insetSize,
  4503.             top = NumberList.insetSize,
  4504.             bottom = NumberList.insetSize
  4505.         },
  4506.         tileSize = nil,
  4507.         tile = false,
  4508.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4509.         edgeSize = NumberList.edgeSize
  4510.     }
  4511. )
  4512. HunterSpellChatFrame:SetBackdropBorderColor(unpack(ColourList.hunterEdge))
  4513.  
  4514. HunterSpellChatFrame.AddSpellButton =
  4515.     CreateFrame(
  4516.     "Button",
  4517.     "HunterSpellChatFrameAddSpellButton",
  4518.     HunterSpellChatFrame,
  4519.     "BackdropTemplate",
  4520.     "UIMenuButtonStretchTemplate"
  4521. )
  4522. HunterSpellChatFrame.AddSpellButton:SetSize(NumberList.scrollFrameWidth, NumberList.chatHeaderHeight)
  4523. HunterSpellChatFrame.AddSpellButton:SetPoint("TOPLEFT", HunterSpellChatFrame, "TOPLEFT", 9, -10)
  4524. HunterSpellChatFrame.AddSpellButton:SetBackdrop(
  4525.     {
  4526.         bgFile = nil,
  4527.         insets = nil,
  4528.         tileSize = nil,
  4529.         tile = true,
  4530.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4531.         edgeSize = NumberList.edgeSize
  4532.     }
  4533. )
  4534. HunterSpellChatFrame.AddSpellButton:SetBackdropBorderColor(unpack(ColourList.hunterEdge))
  4535. HunterSpellChatFrame.AddSpellButton:SetNormalFontObject(TextList.buttonFontObject)
  4536. HunterSpellChatFrame.AddSpellButton:SetHighlightFontObject(TextList.buttonFontObject)
  4537. HunterSpellChatFrame.AddSpellButton:SetText(TextList.addSpellButtonText)
  4538. HunterSpellChatFrame.AddSpellButton:SetScript(
  4539.     "OnReceiveDrag",
  4540.     function()
  4541.         toggleButton(VariableList.currentAddClassNavigationButton)
  4542.         if GetCursorInfo() then
  4543.             cursorType, _, _, spellID = GetCursorInfo()
  4544.             if cursorType ~= "spell" then
  4545.                 printErrorMessages("errorNotASpell")
  4546.             elseif checkIfSpellIsAlreadyListed(spellID) then
  4547.                 printErrorMessages("errorAlreadyListed")
  4548.             else
  4549.                 spellLink = GetSpellLink(spellID)
  4550.                 addSpellToClassSpellList(spellID, spellLink)
  4551.                 updateListBasedOnOpenFrame()
  4552.             end
  4553.             ClearCursor()
  4554.         end
  4555.     end
  4556. )
  4557. HunterSpellChatFrame.AddSpellButton:SetScript(
  4558.     "OnClick",
  4559.     function()
  4560.         toggleButton(VariableList.currentAddClassNavigationButton)
  4561.         if GetCursorInfo() then
  4562.             cursorType, _, _, spellID = GetCursorInfo()
  4563.             if cursorType ~= "spell" then
  4564.                 printErrorMessages("errorNotASpell")
  4565.             elseif checkIfSpellIsAlreadyListed(spellID) then
  4566.                 printErrorMessages("errorAlreadyListed")
  4567.             else
  4568.                 spellLink = GetSpellLink(spellID)
  4569.                 addSpellToClassSpellList(spellID, spellLink)
  4570.                 updateListBasedOnOpenFrame()
  4571.             end
  4572.             ClearCursor()
  4573.         end
  4574.     end
  4575. )
  4576.  
  4577. local HunterSpellScrollParent =
  4578.     CreateFrame(
  4579.     "Button",
  4580.     "HunterSpellScrollParent",
  4581.     HunterSpellChatFrame,
  4582.     "BackdropTemplate",
  4583.     "TooltipBorderedFrameTemplate"
  4584. )
  4585. HunterSpellScrollParent:SetBackdrop(
  4586.     {
  4587.         bgFile = nil,
  4588.         insets = nil,
  4589.         tileSize = nil,
  4590.         tile = false,
  4591.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4592.         edgeSize = NumberList.edgeSize
  4593.     }
  4594. )
  4595. HunterSpellScrollParent:SetBackdropBorderColor(unpack(ColourList.hunterEdge))
  4596. HunterSpellScrollParent:SetSize(NumberList.scrollFrameWidth, NumberList.scrollFrameHeight)
  4597. HunterSpellScrollParent:SetPoint("TOP", HunterSpellChatFrameAddSpellButton, "BOTTOM", 0, -5)
  4598.  
  4599. local HunterSpellScrollFrame =
  4600.     CreateFrame("ScrollFrame", "HunterSpellScrollFrame", HunterSpellScrollParent, "FauxScrollFrameTemplate")
  4601. HunterSpellScrollFrame:SetPoint("TOPLEFT", 0, -8)
  4602. HunterSpellScrollFrame:SetPoint("BOTTOMRIGHT", -30, 8)
  4603. HunterSpellScrollFrame:SetScript(
  4604.     "OnVerticalScroll",
  4605.     function(self, offset)
  4606.         FauxScrollFrame_OnVerticalScroll(self, offset, NumberList.spellItemScrollButtonHeight, updateHunterSpellList)
  4607.     end
  4608. )
  4609.  
  4610. HunterSpellScrollFrame.buttons = {}
  4611. for index = 1, NumberList.spellItemScrollButtonNumber do
  4612.     HunterSpellScrollFrame.buttons[index] =
  4613.         CreateFrame("Button", "$parentbtn" .. index, HunterSpellScrollParent, "OptionsListButtonTemplate")
  4614.     local button = HunterSpellScrollFrame.buttons[index]
  4615.     button:SetNormalFontObject(TextList.checkBoxSmallFontObject)
  4616.     button:SetHighlightFontObject(TextList.checkBoxSmallFontObject)
  4617.     button:SetSize(NumberList.scrollFrameWidth, NumberList.phraseTextButtonHeight)
  4618.     button:SetPoint("TOPLEFT", 8, -(index - 1) * NumberList.phraseTextButtonHeight - 8)
  4619.     button:SetScript(
  4620.         "OnClick",
  4621.         function(self)
  4622.             VariableList.currentClassSpellList = HunterSpellList
  4623.             VariableList.currentClassSpellLink = HunterSpellList[self.index].spellLink
  4624.             VariableList.currentClassSpellID = HunterSpellList[self.index].spellID
  4625.             VariableList.currentClassSpellPercentage = HunterSpellList[self.index].percentage
  4626.             VariableList.currentClassSpellEnabled = HunterSpellList[self.index].isEnabled
  4627.             loadSpellHeader()
  4628.             updateHunterSpellChatList()
  4629.         end
  4630.     )
  4631.     button:SetScript(
  4632.         "OnEnter",
  4633.         function(self)
  4634.             GameTooltip:SetOwner(self, "ANCHOR_TOP", 0, 15)
  4635.             GameTooltip:SetHyperlink(HunterSpellList[self.index].spellLink)
  4636.             GameTooltip:Show()
  4637.         end
  4638.     )
  4639. end
  4640.  
  4641. HunterSpellChatFrame.ClearSpellListButton =
  4642.     CreateFrame(
  4643.     "Button",
  4644.     "HunterSpellChatFrameClearSpellListButton",
  4645.     HunterSpellChatFrame,
  4646.     "BackdropTemplate",
  4647.     "UIMenuButtonStretchTemplate"
  4648. )
  4649. HunterSpellChatFrame.ClearSpellListButton:SetSize(NumberList.scrollFrameWidth, NumberList.clearTargetListHeight)
  4650. HunterSpellChatFrame.ClearSpellListButton:SetPoint("TOP", HunterSpellScrollParent, "BOTTOM", 0, -4)
  4651. HunterSpellChatFrame.ClearSpellListButton:SetBackdrop(
  4652.     {
  4653.         bgFile = nil,
  4654.         insets = nil,
  4655.         tileSize = nil,
  4656.         tile = true,
  4657.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4658.         edgeSize = NumberList.edgeSize
  4659.     }
  4660. )
  4661. HunterSpellChatFrame.ClearSpellListButton:SetBackdropBorderColor(unpack(ColourList.hunterEdge))
  4662. HunterSpellChatFrame.ClearSpellListButton:SetNormalFontObject(TextList.buttonFontObject)
  4663. HunterSpellChatFrame.ClearSpellListButton:SetHighlightFontObject(TextList.buttonFontObject)
  4664. HunterSpellChatFrame.ClearSpellListButton:SetText(TextList.clearSpellListButtonText)
  4665. HunterSpellChatFrame.ClearSpellListButton:RegisterForClicks("RightButtonUp")
  4666. HunterSpellChatFrame.ClearSpellListButton:SetScript(
  4667.     "OnClick",
  4668.     function()
  4669.         wipe(HunterSpellList)
  4670.         clearCurrentClassSpell()
  4671.         updateHunterSpellList()
  4672.         updateHunterSpellChatList()
  4673.         HunterSpellChatFrame.AddPhraseTextBox:SetText("")
  4674.         HunterSpellChatFrame.AddPhraseTextBox:ClearFocus()
  4675.     end
  4676. )
  4677.  
  4678. HunterSpellChatFrame.ChatParent = CreateFrame("Frame", "HunterSpellChatFrameChatParent", HunterSpellChatFrame)
  4679. HunterSpellChatFrame.ChatParent:SetSize(NumberList.scrollSpellFrameWidth, NumberList.scrollSpellFrameHight)
  4680. HunterSpellChatFrame.ChatParent:SetPoint("TOPRIGHT", HunterSpellChatFrame, "TOPRIGHT", -9, -10)
  4681. HunterSpellChatFrame.ChatHeader =
  4682.     CreateFrame("Frame", "HunterSpellChatFrameChatHeader", HunterSpellChatFrameChatParent, "BackdropTemplate")
  4683. HunterSpellChatFrame.ChatHeader:SetBackdrop(
  4684.     {
  4685.         bgFile = nil,
  4686.         insets = nil,
  4687.         tileSize = nil,
  4688.         tile = false,
  4689.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4690.         edgeSize = NumberList.edgeSize
  4691.     }
  4692. )
  4693. HunterSpellChatFrame.ChatHeader:SetBackdropBorderColor(unpack(ColourList.hunterEdge))
  4694. HunterSpellChatFrame.ChatHeader:SetSize(NumberList.scrollSpellFrameWidth, NumberList.chatHeaderHeight)
  4695. HunterSpellChatFrame.ChatHeader:SetPoint("TOP", HunterSpellChatFrameChatParent)
  4696. HunterSpellChatFrame.TitleText = HunterSpellChatFrame:CreateFontString("MyTestFrameTitleText")
  4697. HunterSpellChatFrame.TitleText:SetPoint("TOPLEFT", HunterSpellChatFrameChatHeader, "TOPLEFT", 10, -10)
  4698. HunterSpellChatFrame.TitleText:SetFontObject(TextList.checkBoxFontObject)
  4699. HunterSpellChatFrame.TitleText:SetText("")
  4700.  
  4701. HunterSpellChatFrame.DeleteSpellButton =
  4702.     CreateFrame("Button", "HunterSpellChatFrameDeleteSpellButton", HunterSpellChatFrameChatHeader)
  4703. HunterSpellChatFrame.DeleteSpellButton:SetPoint("RIGHT", HunterSpellChatFrameChatHeader, "RIGHT", -10, 0)
  4704. HunterSpellChatFrame.DeleteSpellButton:SetSize(NumberList.navButtonSize / 1.5, NumberList.navButtonSize / 1.5)
  4705. HunterSpellChatFrame.DeleteSpellButton:SetNormalTexture(ImageList.removeSpellItemButton)
  4706. HunterSpellChatFrame.DeleteSpellButton:SetHighlightTexture(ImageList.removeSpellItemButton, "BLEND")
  4707. HunterSpellChatFrame.DeleteSpellButton:SetScript(
  4708.     "OnClick",
  4709.     function()
  4710.         clearCurrentClassSpell()
  4711.         updateHunterSpellList()
  4712.         updateHunterSpellChatList()
  4713.         HunterSpellChatFrame.AddPhraseTextBox:SetText("")
  4714.         HunterSpellChatFrame.AddPhraseTextBox:ClearFocus()
  4715.     end
  4716. )
  4717.  
  4718. HunterSpellChatFrame.PercentageTextBox =
  4719.     CreateFrame(
  4720.     "EditBox",
  4721.     "HunterSpellChatFramePercentageTextBox",
  4722.     HunterSpellChatFrameChatHeader,
  4723.     "OptionsBoxTemplate"
  4724. )
  4725. HunterSpellChatFrame.PercentageTextBox:SetPoint("BOTTOMLEFT", HunterSpellChatFrameChatHeader, "BOTTOMLEFT", 10, 5)
  4726. HunterSpellChatFrame.PercentageTextBox:SetFontObject(TextList.checkBoxSmallFontObject)
  4727. HunterSpellChatFrame.PercentageTextBox:SetNumeric(true)
  4728. HunterSpellChatFrame.PercentageTextBox:SetSize(NumberList.percentageTextBoxWidth, NumberList.percentageTextBoxHeight)
  4729. HunterSpellChatFrame.PercentageTextBox:SetMaxLetters(3)
  4730. HunterSpellChatFrame.PercentageTextBox:SetAutoFocus()
  4731. HunterSpellChatFrame.PercentageTextBox:SetText("")
  4732. HunterSpellChatFrame.PercentageTextBox:SetJustifyH("CENTER")
  4733. HunterSpellChatFrame.PercentageTextBox:SetScript(
  4734.     "OnEnterPressed",
  4735.     function(self)
  4736.         percentageNumber = tonumber(HunterSpellChatFrame.PercentageTextBox:GetText())
  4737.         self:ClearFocus()
  4738.         updateSpellPercentage(percentageNumber)
  4739.     end
  4740. )
  4741.  
  4742. HunterSpellChatFrame.PercentageText = HunterSpellChatFrame:CreateFontString("HunterSpellChatFramePercentageText")
  4743. HunterSpellChatFrame.PercentageText:SetPoint("LEFT", HunterSpellChatFramePercentageTextBox, "RIGHT")
  4744. HunterSpellChatFrame.PercentageText:SetFontObject(TextList.checkBoxSmallFontObject)
  4745. HunterSpellChatFrame.PercentageText:SetText(TextList.chatFrequencyText)
  4746.  
  4747. HunterSpellChatFrame.EnableCheckbox =
  4748.     CreateFrame(
  4749.     "CheckButton",
  4750.     "HunterSpellChatFrameEnableCheckbox",
  4751.     HunterSpellChatFrameChatHeader,
  4752.     "UICheckButtonTemplate"
  4753. )
  4754. HunterSpellChatFrame.EnableCheckbox:ClearAllPoints()
  4755. HunterSpellChatFrame.EnableCheckbox:SetPoint(
  4756.     "LEFT",
  4757.     HunterSpellChatFramePercentageText,
  4758.     "RIGHT",
  4759.     NumberList.enableCheckBoxSize,
  4760.     NumberList.checkEnableBottomGap
  4761. )
  4762. HunterSpellChatFrame.EnableCheckbox:SetSize(NumberList.enableCheckBoxSize, NumberList.enableCheckBoxSize)
  4763. HunterSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  4764. HunterSpellChatFrame.EnableCheckbox.text:SetFontObject(TextList.checkBoxSmallFontObject)
  4765. HunterSpellChatFrame.EnableCheckbox.text:SetText(TextList.enableSpellChatsText)
  4766. HunterSpellChatFrame.EnableCheckbox:SetScript(
  4767.     "OnClick",
  4768.     function(self)
  4769.         if VariableList.currentClassSpellEnabled then
  4770.             VariableList.currentClassSpellEnabled = false
  4771.             updateSpellEnabled()
  4772.         elseif not VariableList.currentClassSpellEnabled then
  4773.             VariableList.currentClassSpellEnabled = true
  4774.             updateSpellEnabled()
  4775.         end
  4776.     end
  4777. )
  4778.  
  4779. HunterSpellChatFrame.AddChatHeader =
  4780.     CreateFrame("Frame", "HunterSpellChatFrameAddChatHeader", HunterSpellChatFrameChatParent, "BackdropTemplate")
  4781. HunterSpellChatFrame.AddChatHeader:SetBackdrop(
  4782.     {
  4783.         bgFile = nil,
  4784.         insets = nil,
  4785.         tileSize = nil,
  4786.         tile = false,
  4787.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4788.         edgeSize = NumberList.edgeSize
  4789.     }
  4790. )
  4791. HunterSpellChatFrame.AddChatHeader:SetBackdropBorderColor(unpack(ColourList.hunterEdge))
  4792. HunterSpellChatFrame.AddChatHeader:SetSize(NumberList.scrollSpellFrameWidth, NumberList.addChatHeaderHeight)
  4793. HunterSpellChatFrame.AddChatHeader:SetPoint("TOP", HunterSpellChatFrameChatHeader, "BOTTOM", 0, -5)
  4794.  
  4795. HunterSpellChatFrame.AddPhraseTextBox =
  4796.     CreateFrame("EditBox", "HunterSpellChatFrameAddPhraseTextBox", HunterSpellChatFrameAddChatHeader)
  4797. HunterSpellChatFrame.AddPhraseTextBox:SetPoint("LEFT", HunterSpellChatFrameAddChatHeader, "LEFT", 10, 0)
  4798. HunterSpellChatFrame.AddPhraseTextBox:SetFontObject(TextList.checkBoxSmallFontObject)
  4799. HunterSpellChatFrame.AddPhraseTextBox:SetSize(
  4800.     NumberList.scrollSpellFrameWidth - NumberList.percentageTextBoxWidth,
  4801.     NumberList.addPhraseTextBoxHeight
  4802. )
  4803. HunterSpellChatFrame.AddPhraseTextBox:SetMaxLetters(100)
  4804. HunterSpellChatFrame.AddPhraseTextBox:SetAutoFocus(false)
  4805. HunterSpellChatFrame.AddPhraseTextBox:SetJustifyH("LEFT")
  4806. HunterSpellChatFrame.AddPhraseTextBox:SetScript(
  4807.     "OnReceiveDrag",
  4808.     function()
  4809.         if GetCursorInfo() then
  4810.             cursorType, arg1, arg2, arg3 = GetCursorInfo()
  4811.             cursorLink = getCursorLinkForCurrentPhrase(cursorType, arg1, arg2, arg3)
  4812.             if cursorLink ~= nil then
  4813.                 HunterSpellChatFrame.AddPhraseTextBox:Insert(cursorLink .. " ")
  4814.                 HunterSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  4815.             else
  4816.                 HunterSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  4817.             end
  4818.         end
  4819.         ClearCursor()
  4820.     end
  4821. )
  4822. HunterSpellChatFrame.AddPhraseTextBox:SetScript(
  4823.     "OnMouseDown",
  4824.     function()
  4825.         if GetCursorInfo() then
  4826.             cursorType, arg1, arg2, arg3 = GetCursorInfo()
  4827.             cursorLink = getCursorLinkForCurrentPhrase(cursorType, arg1, arg2, arg3)
  4828.             if cursorLink ~= nil then
  4829.                 HunterSpellChatFrame.AddPhraseTextBox:Insert(cursorLink .. " ")
  4830.                 HunterSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  4831.             else
  4832.                 HunterSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  4833.             end
  4834.         end
  4835.         ClearCursor()
  4836.     end
  4837. )
  4838. HunterSpellChatFrame.AddPhraseTextBox:SetScript(
  4839.     "OnEnterPressed",
  4840.     function()
  4841.         chatPhrase = HunterSpellChatFrame.AddPhraseTextBox:GetText()
  4842.         if chatPhrase ~= "" then
  4843.             addChatStringToClassSpellList(chatPhrase)
  4844.             updateHunterSpellChatList()
  4845.             HunterSpellChatFrame.AddPhraseTextBox:SetText("")
  4846.         end
  4847.     end
  4848. )
  4849.  
  4850. local HunterChatScrollParent =
  4851.     CreateFrame("Frame", "HunterChatScrollParent", HunterSpellChatFrameChatParent, "BackdropTemplate")
  4852. HunterChatScrollParent:SetBackdrop(
  4853.     {
  4854.         bgFile = nil,
  4855.         insets = nil,
  4856.         tileSize = nil,
  4857.         tile = false,
  4858.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4859.         edgeSize = NumberList.edgeSize
  4860.     }
  4861. )
  4862. HunterChatScrollParent:SetBackdropBorderColor(unpack(ColourList.hunterEdge))
  4863. HunterChatScrollParent:SetSize(NumberList.scrollSpellFrameWidth, NumberList.chatScrollParentHeight)
  4864. HunterChatScrollParent:SetPoint("TOP", HunterSpellChatFrameAddChatHeader, "BOTTOM", 0, -5)
  4865.  
  4866. local HunterChatScrollFrame =
  4867.     CreateFrame("ScrollFrame", "HunterChatScrollFrame", HunterChatScrollParent, "FauxScrollFrameTemplate")
  4868. HunterChatScrollFrame:SetPoint("TOPLEFT", 0, -8)
  4869. HunterChatScrollFrame:SetPoint("BOTTOMRIGHT", -30, 8)
  4870. HunterChatScrollFrame:SetScript(
  4871.     "OnVerticalScroll",
  4872.     function(self, offset)
  4873.         FauxScrollFrame_OnVerticalScroll(
  4874.             self,
  4875.             offset,
  4876.             NumberList.spellItemChatScrollButtonHeight,
  4877.             updateHunterSpellChatList
  4878.         )
  4879.     end
  4880. )
  4881.  
  4882. HunterChatScrollFrame.buttons = {}
  4883. for index = 1, NumberList.spellItemChatScrollButtonNumber do
  4884.     HunterChatScrollFrame.buttons[index] =
  4885.         CreateFrame("Button", "$parentbtn" .. index, HunterChatScrollParent, "OptionsListButtonTemplate")
  4886.     local button = HunterChatScrollFrame.buttons[index]
  4887.     button:SetNormalFontObject(TextList.checkBoxSmallFontObject)
  4888.     button:SetHighlightFontObject(TextList.checkBoxSmallFontObject)
  4889.     button:SetSize(NumberList.scrollSpellFrameWidth, NumberList.phraseTextButtonHeight)
  4890.     button:SetPoint("TOPLEFT", 8, -(index - 1) * NumberList.phraseTextButtonHeight - 8)
  4891.     button:SetScript(
  4892.         "OnClick",
  4893.         function(self)
  4894.             VariableList.currentClassSpellPhrase = currentClassSpellList[self.index]
  4895.             clearCurrentClassSpellChat()
  4896.             updateHunterSpellChatList()
  4897.         end
  4898.     )
  4899. end
  4900.  
  4901. HunterSpellChatFrame.ClearChatListButton =
  4902.     CreateFrame(
  4903.     "Button",
  4904.     "HunterSpellChatFrameClearChatListButton",
  4905.     HunterSpellChatFrame,
  4906.     "BackdropTemplate",
  4907.     "UIMenuButtonStretchTemplate"
  4908. )
  4909. HunterSpellChatFrame.ClearChatListButton:SetSize(NumberList.scrollSpellFrameWidth, NumberList.clearTargetListHeight)
  4910. HunterSpellChatFrame.ClearChatListButton:SetPoint("TOP", HunterChatScrollParent, "BOTTOM", 0, -4)
  4911. HunterSpellChatFrame.ClearChatListButton:SetBackdrop(
  4912.     {
  4913.         bgFile = nil,
  4914.         insets = nil,
  4915.         tileSize = nil,
  4916.         tile = true,
  4917.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4918.         edgeSize = NumberList.edgeSize
  4919.     }
  4920. )
  4921. HunterSpellChatFrame.ClearChatListButton:SetBackdropBorderColor(unpack(ColourList.hunterEdge))
  4922. HunterSpellChatFrame.ClearChatListButton:SetNormalFontObject(TextList.buttonFontObject)
  4923. HunterSpellChatFrame.ClearChatListButton:SetHighlightFontObject(TextList.buttonFontObject)
  4924. HunterSpellChatFrame.ClearChatListButton:SetText(TextList.clearChatListButtonText)
  4925. HunterSpellChatFrame.ClearChatListButton:RegisterForClicks("RightButtonUp")
  4926. HunterSpellChatFrame.ClearChatListButton:SetScript(
  4927.     "OnClick",
  4928.     function()
  4929.         clearCurrentChatList()
  4930.         updateHunterSpellChatList()
  4931.         HunterSpellChatFrame.AddPhraseTextBox:SetText("")
  4932.     end
  4933. )
  4934.  
  4935. -- ===================================================================================================
  4936. -- ===================================================================================================
  4937. -- ===========================         Mage class frame          ===========================
  4938. -- ===================================================================================================
  4939. -- ===================================================================================================
  4940.  
  4941. local MageSpellChatFrame = CreateFrame("Frame", "MageSpellChatFrame", SpellChatInterfaceFrame, "BackdropTemplate")
  4942. MageSpellChatFrame:SetSize(NumberList.classFrameWidth, NumberList.classFrameHeight)
  4943. MageSpellChatFrame:SetPoint("BOTTOM", SpellChatInterfaceFrame, "BOTTOM", 0, NumberList.spellChatFrameBottomGap)
  4944. MageSpellChatFrame:SetBackdrop(
  4945.     {
  4946.         bgFile = nil,
  4947.         insets = {
  4948.             left = NumberList.insetSize,
  4949.             right = NumberList.insetSize,
  4950.             top = NumberList.insetSize,
  4951.             bottom = NumberList.insetSize
  4952.         },
  4953.         tileSize = nil,
  4954.         tile = false,
  4955.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4956.         edgeSize = NumberList.edgeSize
  4957.     }
  4958. )
  4959. MageSpellChatFrame:SetBackdropBorderColor(unpack(ColourList.mageEdge))
  4960.  
  4961. MageSpellChatFrame.AddSpellButton =
  4962.     CreateFrame(
  4963.     "Button",
  4964.     "MageSpellChatFrameAddSpellButton",
  4965.     MageSpellChatFrame,
  4966.     "BackdropTemplate",
  4967.     "UIMenuButtonStretchTemplate"
  4968. )
  4969. MageSpellChatFrame.AddSpellButton:SetSize(NumberList.scrollFrameWidth, NumberList.chatHeaderHeight)
  4970. MageSpellChatFrame.AddSpellButton:SetPoint("TOPLEFT", MageSpellChatFrame, "TOPLEFT", 9, -10)
  4971. MageSpellChatFrame.AddSpellButton:SetBackdrop(
  4972.     {
  4973.         bgFile = nil,
  4974.         insets = nil,
  4975.         tileSize = nil,
  4976.         tile = true,
  4977.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  4978.         edgeSize = NumberList.edgeSize
  4979.     }
  4980. )
  4981. MageSpellChatFrame.AddSpellButton:SetBackdropBorderColor(unpack(ColourList.mageEdge))
  4982. MageSpellChatFrame.AddSpellButton:SetNormalFontObject(TextList.buttonFontObject)
  4983. MageSpellChatFrame.AddSpellButton:SetHighlightFontObject(TextList.buttonFontObject)
  4984. MageSpellChatFrame.AddSpellButton:SetText(TextList.addSpellButtonText)
  4985. MageSpellChatFrame.AddSpellButton:SetScript(
  4986.     "OnReceiveDrag",
  4987.     function()
  4988.         toggleButton(VariableList.currentAddClassNavigationButton)
  4989.         if GetCursorInfo() then
  4990.             cursorType, _, _, spellID = GetCursorInfo()
  4991.             if cursorType ~= "spell" then
  4992.                 printErrorMessages("errorNotASpell")
  4993.             elseif checkIfSpellIsAlreadyListed(spellID) then
  4994.                 printErrorMessages("errorAlreadyListed")
  4995.             else
  4996.                 spellLink = GetSpellLink(spellID)
  4997.                 addSpellToClassSpellList(spellID, spellLink)
  4998.                 updateListBasedOnOpenFrame()
  4999.             end
  5000.             ClearCursor()
  5001.         end
  5002.     end
  5003. )
  5004. MageSpellChatFrame.AddSpellButton:SetScript(
  5005.     "OnClick",
  5006.     function()
  5007.         toggleButton(VariableList.currentAddClassNavigationButton)
  5008.         if GetCursorInfo() then
  5009.             cursorType, _, _, spellID = GetCursorInfo()
  5010.             if cursorType ~= "spell" then
  5011.                 printErrorMessages("errorNotASpell")
  5012.             elseif checkIfSpellIsAlreadyListed(spellID) then
  5013.                 printErrorMessages("errorAlreadyListed")
  5014.             else
  5015.                 spellLink = GetSpellLink(spellID)
  5016.                 addSpellToClassSpellList(spellID, spellLink)
  5017.                 updateListBasedOnOpenFrame()
  5018.             end
  5019.             ClearCursor()
  5020.         end
  5021.     end
  5022. )
  5023.  
  5024. local MageSpellScrollParent =
  5025.     CreateFrame(
  5026.     "Button",
  5027.     "MageSpellScrollParent",
  5028.     MageSpellChatFrame,
  5029.     "BackdropTemplate",
  5030.     "TooltipBorderedFrameTemplate"
  5031. )
  5032. MageSpellScrollParent:SetBackdrop(
  5033.     {
  5034.         bgFile = nil,
  5035.         insets = nil,
  5036.         tileSize = nil,
  5037.         tile = false,
  5038.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  5039.         edgeSize = NumberList.edgeSize
  5040.     }
  5041. )
  5042. MageSpellScrollParent:SetBackdropBorderColor(unpack(ColourList.mageEdge))
  5043. MageSpellScrollParent:SetSize(NumberList.scrollFrameWidth, NumberList.scrollFrameHeight)
  5044. MageSpellScrollParent:SetPoint("TOP", MageSpellChatFrameAddSpellButton, "BOTTOM", 0, -5)
  5045.  
  5046. local MageSpellScrollFrame =
  5047.     CreateFrame("ScrollFrame", "MageSpellScrollFrame", MageSpellScrollParent, "FauxScrollFrameTemplate")
  5048. MageSpellScrollFrame:SetPoint("TOPLEFT", 0, -8)
  5049. MageSpellScrollFrame:SetPoint("BOTTOMRIGHT", -30, 8)
  5050. MageSpellScrollFrame:SetScript(
  5051.     "OnVerticalScroll",
  5052.     function(self, offset)
  5053.         FauxScrollFrame_OnVerticalScroll(self, offset, NumberList.spellItemScrollButtonHeight, updateMageSpellList)
  5054.     end
  5055. )
  5056.  
  5057. MageSpellScrollFrame.buttons = {}
  5058. for index = 1, NumberList.spellItemScrollButtonNumber do
  5059.     MageSpellScrollFrame.buttons[index] =
  5060.         CreateFrame("Button", "$parentbtn" .. index, MageSpellScrollParent, "OptionsListButtonTemplate")
  5061.     local button = MageSpellScrollFrame.buttons[index]
  5062.     button:SetNormalFontObject(TextList.checkBoxSmallFontObject)
  5063.     button:SetHighlightFontObject(TextList.checkBoxSmallFontObject)
  5064.     button:SetSize(NumberList.scrollFrameWidth, NumberList.phraseTextButtonHeight)
  5065.     button:SetPoint("TOPLEFT", 8, -(index - 1) * NumberList.phraseTextButtonHeight - 8)
  5066.     button:SetScript(
  5067.         "OnClick",
  5068.         function(self)
  5069.             VariableList.currentClassSpellList = MageSpellList
  5070.             VariableList.currentClassSpellLink = MageSpellList[self.index].spellLink
  5071.             VariableList.currentClassSpellID = MageSpellList[self.index].spellID
  5072.             VariableList.currentClassSpellPercentage = MageSpellList[self.index].percentage
  5073.             VariableList.currentClassSpellEnabled = MageSpellList[self.index].isEnabled
  5074.             loadSpellHeader()
  5075.             updateMageSpellChatList()
  5076.         end
  5077.     )
  5078.     button:SetScript(
  5079.         "OnEnter",
  5080.         function(self)
  5081.             GameTooltip:SetOwner(self, "ANCHOR_TOP", 0, 15)
  5082.             GameTooltip:SetHyperlink(MageSpellList[self.index].spellLink)
  5083.             GameTooltip:Show()
  5084.         end
  5085.     )
  5086. end
  5087.  
  5088. MageSpellChatFrame.ClearSpellListButton =
  5089.     CreateFrame(
  5090.     "Button",
  5091.     "MageSpellChatFrameClearSpellListButton",
  5092.     MageSpellChatFrame,
  5093.     "BackdropTemplate",
  5094.     "UIMenuButtonStretchTemplate"
  5095. )
  5096. MageSpellChatFrame.ClearSpellListButton:SetSize(NumberList.scrollFrameWidth, NumberList.clearTargetListHeight)
  5097. MageSpellChatFrame.ClearSpellListButton:SetPoint("TOP", MageSpellScrollParent, "BOTTOM", 0, -4)
  5098. MageSpellChatFrame.ClearSpellListButton:SetBackdrop(
  5099.     {
  5100.         bgFile = nil,
  5101.         insets = nil,
  5102.         tileSize = nil,
  5103.         tile = true,
  5104.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  5105.         edgeSize = NumberList.edgeSize
  5106.     }
  5107. )
  5108. MageSpellChatFrame.ClearSpellListButton:SetBackdropBorderColor(unpack(ColourList.mageEdge))
  5109. MageSpellChatFrame.ClearSpellListButton:SetNormalFontObject(TextList.buttonFontObject)
  5110. MageSpellChatFrame.ClearSpellListButton:SetHighlightFontObject(TextList.buttonFontObject)
  5111. MageSpellChatFrame.ClearSpellListButton:SetText(TextList.clearSpellListButtonText)
  5112. MageSpellChatFrame.ClearSpellListButton:RegisterForClicks("RightButtonUp")
  5113. MageSpellChatFrame.ClearSpellListButton:SetScript(
  5114.     "OnClick",
  5115.     function()
  5116.         wipe(MageSpellList)
  5117.         clearCurrentClassSpell()
  5118.         updateMageSpellList()
  5119.         updateMageSpellChatList()
  5120.         MageSpellChatFrame.AddPhraseTextBox:SetText("")
  5121.         MageSpellChatFrame.AddPhraseTextBox:ClearFocus()
  5122.     end
  5123. )
  5124.  
  5125. MageSpellChatFrame.ChatParent = CreateFrame("Frame", "MageSpellChatFrameChatParent", MageSpellChatFrame)
  5126. MageSpellChatFrame.ChatParent:SetSize(NumberList.scrollSpellFrameWidth, NumberList.scrollSpellFrameHight)
  5127. MageSpellChatFrame.ChatParent:SetPoint("TOPRIGHT", MageSpellChatFrame, "TOPRIGHT", -9, -10)
  5128. MageSpellChatFrame.ChatHeader =
  5129.     CreateFrame("Frame", "MageSpellChatFrameChatHeader", MageSpellChatFrameChatParent, "BackdropTemplate")
  5130. MageSpellChatFrame.ChatHeader:SetBackdrop(
  5131.     {
  5132.         bgFile = nil,
  5133.         insets = nil,
  5134.         tileSize = nil,
  5135.         tile = false,
  5136.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  5137.         edgeSize = NumberList.edgeSize
  5138.     }
  5139. )
  5140. MageSpellChatFrame.ChatHeader:SetBackdropBorderColor(unpack(ColourList.mageEdge))
  5141. MageSpellChatFrame.ChatHeader:SetSize(NumberList.scrollSpellFrameWidth, NumberList.chatHeaderHeight)
  5142. MageSpellChatFrame.ChatHeader:SetPoint("TOP", MageSpellChatFrameChatParent)
  5143. MageSpellChatFrame.TitleText = MageSpellChatFrame:CreateFontString("MyTestFrameTitleText")
  5144. MageSpellChatFrame.TitleText:SetPoint("TOPLEFT", MageSpellChatFrameChatHeader, "TOPLEFT", 10, -10)
  5145. MageSpellChatFrame.TitleText:SetFontObject(TextList.checkBoxFontObject)
  5146. MageSpellChatFrame.TitleText:SetText("")
  5147.  
  5148. MageSpellChatFrame.DeleteSpellButton =
  5149.     CreateFrame("Button", "MageSpellChatFrameDeleteSpellButton", MageSpellChatFrameChatHeader)
  5150. MageSpellChatFrame.DeleteSpellButton:SetPoint("RIGHT", MageSpellChatFrameChatHeader, "RIGHT", -10, 0)
  5151. MageSpellChatFrame.DeleteSpellButton:SetSize(NumberList.navButtonSize / 1.5, NumberList.navButtonSize / 1.5)
  5152. MageSpellChatFrame.DeleteSpellButton:SetNormalTexture(ImageList.removeSpellItemButton)
  5153. MageSpellChatFrame.DeleteSpellButton:SetHighlightTexture(ImageList.removeSpellItemButton, "BLEND")
  5154. MageSpellChatFrame.DeleteSpellButton:SetScript(
  5155.     "OnClick",
  5156.     function()
  5157.         clearCurrentClassSpell()
  5158.         updateMageSpellList()
  5159.         updateMageSpellChatList()
  5160.         MageSpellChatFrame.AddPhraseTextBox:SetText("")
  5161.         MageSpellChatFrame.AddPhraseTextBox:ClearFocus()
  5162.     end
  5163. )
  5164.  
  5165. MageSpellChatFrame.PercentageTextBox =
  5166.     CreateFrame("EditBox", "MageSpellChatFramePercentageTextBox", MageSpellChatFrameChatHeader, "OptionsBoxTemplate")
  5167. MageSpellChatFrame.PercentageTextBox:SetPoint("BOTTOMLEFT", MageSpellChatFrameChatHeader, "BOTTOMLEFT", 10, 5)
  5168. MageSpellChatFrame.PercentageTextBox:SetFontObject(TextList.checkBoxSmallFontObject)
  5169. MageSpellChatFrame.PercentageTextBox:SetNumeric(true)
  5170. MageSpellChatFrame.PercentageTextBox:SetSize(NumberList.percentageTextBoxWidth, NumberList.percentageTextBoxHeight)
  5171. MageSpellChatFrame.PercentageTextBox:SetMaxLetters(3)
  5172. MageSpellChatFrame.PercentageTextBox:SetAutoFocus()
  5173. MageSpellChatFrame.PercentageTextBox:SetText("")
  5174. MageSpellChatFrame.PercentageTextBox:SetJustifyH("CENTER")
  5175. MageSpellChatFrame.PercentageTextBox:SetScript(
  5176.     "OnEnterPressed",
  5177.     function(self)
  5178.         percentageNumber = tonumber(MageSpellChatFrame.PercentageTextBox:GetText())
  5179.         self:ClearFocus()
  5180.         updateSpellPercentage(percentageNumber)
  5181.     end
  5182. )
  5183.  
  5184. MageSpellChatFrame.PercentageText = MageSpellChatFrame:CreateFontString("MageSpellChatFramePercentageText")
  5185. MageSpellChatFrame.PercentageText:SetPoint("LEFT", MageSpellChatFramePercentageTextBox, "RIGHT")
  5186. MageSpellChatFrame.PercentageText:SetFontObject(TextList.checkBoxSmallFontObject)
  5187. MageSpellChatFrame.PercentageText:SetText(TextList.chatFrequencyText)
  5188.  
  5189. MageSpellChatFrame.EnableCheckbox =
  5190.     CreateFrame(
  5191.     "CheckButton",
  5192.     "MageSpellChatFrameEnableCheckbox",
  5193.     MageSpellChatFrameChatHeader,
  5194.     "UICheckButtonTemplate"
  5195. )
  5196. MageSpellChatFrame.EnableCheckbox:ClearAllPoints()
  5197. MageSpellChatFrame.EnableCheckbox:SetPoint(
  5198.     "LEFT",
  5199.     MageSpellChatFramePercentageText,
  5200.     "RIGHT",
  5201.     NumberList.enableCheckBoxSize,
  5202.     NumberList.checkEnableBottomGap
  5203. )
  5204. MageSpellChatFrame.EnableCheckbox:SetSize(NumberList.enableCheckBoxSize, NumberList.enableCheckBoxSize)
  5205. MageSpellChatFrame.EnableCheckbox:SetChecked(VariableList.currentClassSpellEnabled)
  5206. MageSpellChatFrame.EnableCheckbox.text:SetText(TextList.enableSpellChatsText)
  5207. MageSpellChatFrame.EnableCheckbox.text:SetFontObject(TextList.checkBoxSmallFontObject)
  5208. MageSpellChatFrame.EnableCheckbox:SetScript(
  5209.     "OnClick",
  5210.     function(self)
  5211.         if VariableList.currentClassSpellEnabled then
  5212.             VariableList.currentClassSpellEnabled = false
  5213.             updateSpellEnabled()
  5214.         elseif not VariableList.currentClassSpellEnabled then
  5215.             VariableList.currentClassSpellEnabled = true
  5216.             updateSpellEnabled()
  5217.         end
  5218.     end
  5219. )
  5220.  
  5221. MageSpellChatFrame.AddChatHeader =
  5222.     CreateFrame("Frame", "MageSpellChatFrameAddChatHeader", MageSpellChatFrameChatParent, "BackdropTemplate")
  5223. MageSpellChatFrame.AddChatHeader:SetBackdrop(
  5224.     {
  5225.         bgFile = nil,
  5226.         insets = nil,
  5227.         tileSize = nil,
  5228.         tile = false,
  5229.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  5230.         edgeSize = NumberList.edgeSize
  5231.     }
  5232. )
  5233. MageSpellChatFrame.AddChatHeader:SetBackdropBorderColor(unpack(ColourList.mageEdge))
  5234. MageSpellChatFrame.AddChatHeader:SetSize(NumberList.scrollSpellFrameWidth, NumberList.addChatHeaderHeight)
  5235. MageSpellChatFrame.AddChatHeader:SetPoint("TOP", MageSpellChatFrameChatHeader, "BOTTOM", 0, -5)
  5236.  
  5237. MageSpellChatFrame.AddPhraseTextBox =
  5238.     CreateFrame("EditBox", "MageSpellChatFrameAddPhraseTextBox", MageSpellChatFrameAddChatHeader)
  5239. MageSpellChatFrame.AddPhraseTextBox:SetPoint("LEFT", MageSpellChatFrameAddChatHeader, "LEFT", 10, 0)
  5240. MageSpellChatFrame.AddPhraseTextBox:SetFontObject(TextList.checkBoxSmallFontObject)
  5241. MageSpellChatFrame.AddPhraseTextBox:SetSize(
  5242.     NumberList.scrollSpellFrameWidth - NumberList.percentageTextBoxWidth,
  5243.     NumberList.addPhraseTextBoxHeight
  5244. )
  5245. MageSpellChatFrame.AddPhraseTextBox:SetMaxLetters(100)
  5246. MageSpellChatFrame.AddPhraseTextBox:SetAutoFocus(false)
  5247. MageSpellChatFrame.AddPhraseTextBox:SetJustifyH("LEFT")
  5248. MageSpellChatFrame.AddPhraseTextBox:SetScript(
  5249.     "OnReceiveDrag",
  5250.     function()
  5251.         if GetCursorInfo() then
  5252.             cursorType, arg1, arg2, arg3 = GetCursorInfo()
  5253.             cursorLink = getCursorLinkForCurrentPhrase(cursorType, arg1, arg2, arg3)
  5254.             if cursorLink ~= nil then
  5255.                 MageSpellChatFrame.AddPhraseTextBox:Insert(cursorLink .. " ")
  5256.                 MageSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  5257.             else
  5258.                 MageSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  5259.             end
  5260.         end
  5261.         ClearCursor()
  5262.     end
  5263. )
  5264. MageSpellChatFrame.AddPhraseTextBox:SetScript(
  5265.     "OnMouseDown",
  5266.     function()
  5267.         if GetCursorInfo() then
  5268.             cursorType, arg1, arg2, arg3 = GetCursorInfo()
  5269.             cursorLink = getCursorLinkForCurrentPhrase(cursorType, arg1, arg2, arg3)
  5270.             if cursorLink ~= nil then
  5271.                 MageSpellChatFrame.AddPhraseTextBox:Insert(cursorLink .. " ")
  5272.                 MageSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  5273.             else
  5274.                 MageSpellChatFrame.AddPhraseTextBox:SetAutoFocus(true)
  5275.             end
  5276.         end
  5277.         ClearCursor()
  5278.     end
  5279. )
  5280. MageSpellChatFrame.AddPhraseTextBox:SetScript(
  5281.     "OnEnterPressed",
  5282.     function()
  5283.         chatPhrase = MageSpellChatFrame.AddPhraseTextBox:GetText()
  5284.         if chatPhrase ~= "" then
  5285.             addChatStringToClassSpellList(chatPhrase)
  5286.             updateMageSpellChatList()
  5287.             MageSpellChatFrame.AddPhraseTextBox:SetText("")
  5288.         end
  5289.     end
  5290. )
  5291.  
  5292. local MageChatScrollParent =
  5293.     CreateFrame("Frame", "MageChatScrollParent", MageSpellChatFrameChatParent, "BackdropTemplate")
  5294. MageChatScrollParent:SetBackdrop(
  5295.     {
  5296.         bgFile = nil,
  5297.         insets = nil,
  5298.         tileSize = nil,
  5299.         tile = false,
  5300.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  5301.         edgeSize = NumberList.edgeSize
  5302.     }
  5303. )
  5304. MageChatScrollParent:SetBackdropBorderColor(unpack(ColourList.mageEdge))
  5305. MageChatScrollParent:SetSize(NumberList.scrollSpellFrameWidth, NumberList.chatScrollParentHeight)
  5306. MageChatScrollParent:SetPoint("TOP", MageSpellChatFrameAddChatHeader, "BOTTOM", 0, -5)
  5307.  
  5308. local MageChatScrollFrame =
  5309.     CreateFrame("ScrollFrame", "MageChatScrollFrame", MageChatScrollParent, "FauxScrollFrameTemplate")
  5310. MageChatScrollFrame:SetPoint("TOPLEFT", 0, -8)
  5311. MageChatScrollFrame:SetPoint("BOTTOMRIGHT", -30, 8)
  5312. MageChatScrollFrame:SetScript(
  5313.     "OnVerticalScroll",
  5314.     function(self, offset)
  5315.         FauxScrollFrame_OnVerticalScroll(
  5316.             self,
  5317.             offset,
  5318.             NumberList.spellItemChatScrollButtonHeight,
  5319.             updateMageSpellChatList
  5320.         )
  5321.     end
  5322. )
  5323.  
  5324. MageChatScrollFrame.buttons = {}
  5325. for index = 1, NumberList.spellItemChatScrollButtonNumber do
  5326.     MageChatScrollFrame.buttons[index] =
  5327.         CreateFrame("Button", "$parentbtn" .. index, MageChatScrollParent, "OptionsListButtonTemplate")
  5328.     local button = MageChatScrollFrame.buttons[index]
  5329.     button:SetNormalFontObject(TextList.checkBoxSmallFontObject)
  5330.     button:SetHighlightFontObject(TextList.checkBoxSmallFontObject)
  5331.     button:SetSize(NumberList.scrollSpellFrameWidth, NumberList.phraseTextButtonHeight)
  5332.     button:SetPoint("TOPLEFT", 8, -(index - 1) * NumberList.phraseTextButtonHeight - 8)
  5333.     button:SetScript(
  5334.         "OnClick",
  5335.         function(self)
  5336.             VariableList.currentClassSpellPhrase = currentClassSpellList[self.index]
  5337.             clearCurrentClassSpellChat()
  5338.             updateMageSpellChatList()
  5339.         end
  5340.     )
  5341. end
  5342.  
  5343. MageSpellChatFrame.ClearChatListButton =
  5344.     CreateFrame(
  5345.     "Button",
  5346.     "MageSpellChatFrameClearChatListButton",
  5347.     MageSpellChatFrame,
  5348.     "BackdropTemplate",
  5349.     "UIMenuButtonStretchTemplate"
  5350. )
  5351. MageSpellChatFrame.ClearChatListButton:SetSize(NumberList.scrollSpellFrameWidth, NumberList.clearTargetListHeight)
  5352. MageSpellChatFrame.ClearChatListButton:SetPoint("TOP", MageChatScrollParent, "BOTTOM", 0, -4)
  5353. MageSpellChatFrame.ClearChatListButton:SetBackdrop(
  5354.     {
  5355.         bgFile = nil,
  5356.         insets = nil,
  5357.         tileSize = nil,
  5358.         tile = true,
  5359.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  5360.         edgeSize = NumberList.edgeSize
  5361.     }
  5362. )
  5363. MageSpellChatFrame.ClearChatListButton:SetBackdropBorderColor(unpack(ColourList.mageEdge))
  5364. MageSpellChatFrame.ClearChatListButton:SetNormalFontObject(TextList.buttonFontObject)
  5365. MageSpellChatFrame.ClearChatListButton:SetHighlightFontObject(TextList.buttonFontObject)
  5366. MageSpellChatFrame.ClearChatListButton:SetText(TextList.clearChatListButtonText)
  5367. MageSpellChatFrame.ClearChatListButton:RegisterForClicks("RightButtonUp")
  5368. MageSpellChatFrame.ClearChatListButton:SetScript(
  5369.     "OnClick",
  5370.     function()
  5371.         clearCurrentChatList()
  5372.         updateMageSpellChatList()
  5373.         MageSpellChatFrame.AddPhraseTextBox:SetText("")
  5374.     end
  5375. )
  5376.  
  5377. -- ===================================================================================================
  5378. -- ===================================================================================================
  5379. -- ===========================         Monk class frame          ===========================
  5380. -- ===================================================================================================
  5381. -- ===================================================================================================
  5382.  
  5383. local MonkSpellChatFrame = CreateFrame("Frame", "MonkSpellChatFrame", SpellChatInterfaceFrame, "BackdropTemplate")
  5384. MonkSpellChatFrame:SetSize(NumberList.classFrameWidth, NumberList.classFrameHeight)
  5385. MonkSpellChatFrame:SetPoint("BOTTOM", SpellChatInterfaceFrame, "BOTTOM", 0, NumberList.spellChatFrameBottomGap)
  5386. MonkSpellChatFrame:SetBackdrop(
  5387.     {
  5388.         bgFile = nil,
  5389.         insets = {
  5390.             left = NumberList.insetSize,
  5391.             right = NumberList.insetSize,
  5392.             top = NumberList.insetSize,
  5393.             bottom = NumberList.insetSize
  5394.         },
  5395.         tileSize = nil,
  5396.         tile = false,
  5397.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  5398.         edgeSize = NumberList.edgeSize
  5399.     }
  5400. )
  5401. MonkSpellChatFrame:SetBackdropBorderColor(unpack(ColourList.monkEdge))
  5402.  
  5403. MonkSpellChatFrame.AddSpellButton =
  5404.     CreateFrame(
  5405.     "Button",
  5406.     "MonkSpellChatFrameAddSpellButton",
  5407.     MonkSpellChatFrame,
  5408.     "BackdropTemplate",
  5409.     "UIMenuButtonStretchTemplate"
  5410. )
  5411. MonkSpellChatFrame.AddSpellButton:SetSize(NumberList.scrollFrameWidth, NumberList.chatHeaderHeight)
  5412. MonkSpellChatFrame.AddSpellButton:SetPoint("TOPLEFT", MonkSpellChatFrame, "TOPLEFT", 9, -10)
  5413. MonkSpellChatFrame.AddSpellButton:SetBackdrop(
  5414.     {
  5415.         bgFile = nil,
  5416.         insets = nil,
  5417.         tileSize = nil,
  5418.         tile = true,
  5419.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  5420.         edgeSize = NumberList.edgeSize
  5421.     }
  5422. )
  5423. MonkSpellChatFrame.AddSpellButton:SetBackdropBorderColor(unpack(ColourList.monkEdge))
  5424. MonkSpellChatFrame.AddSpellButton:SetNormalFontObject(TextList.buttonFontObject)
  5425. MonkSpellChatFrame.AddSpellButton:SetHighlightFontObject(TextList.buttonFontObject)
  5426. MonkSpellChatFrame.AddSpellButton:SetText(TextList.addSpellButtonText)
  5427. MonkSpellChatFrame.AddSpellButton:SetScript(
  5428.     "OnReceiveDrag",
  5429.     function()
  5430.         toggleButton(VariableList.currentAddClassNavigationButton)
  5431.         if GetCursorInfo() then
  5432.             cursorType, _, _, spellID = GetCursorInfo()
  5433.             if cursorType ~= "spell" then
  5434.                 printErrorMessages("errorNotASpell")
  5435.             elseif checkIfSpellIsAlreadyListed(spellID) then
  5436.                 printErrorMessages("errorAlreadyListed")
  5437.             else
  5438.                 spellLink = GetSpellLink(spellID)
  5439.                 addSpellToClassSpellList(spellID, spellLink)
  5440.                 updateListBasedOnOpenFrame()
  5441.             end
  5442.             ClearCursor()
  5443.         end
  5444.     end
  5445. )
  5446. MonkSpellChatFrame.AddSpellButton:SetScript(
  5447.     "OnClick",
  5448.     function()
  5449.         toggleButton(VariableList.currentAddClassNavigationButton)
  5450.         if GetCursorInfo() then
  5451.             cursorType, _, _, spellID = GetCursorInfo()
  5452.             if cursorType ~= "spell" then
  5453.                 printErrorMessages("errorNotASpell")
  5454.             elseif checkIfSpellIsAlreadyListed(spellID) then
  5455.                 printErrorMessages("errorAlreadyListed")
  5456.             else
  5457.                 spellLink = GetSpellLink(spellID)
  5458.                 addSpellToClassSpellList(spellID, spellLink)
  5459.                 updateListBasedOnOpenFrame()
  5460.             end
  5461.             ClearCursor()
  5462.         end
  5463.     end
  5464. )
  5465.  
  5466. local MonkScrollParent =
  5467.     CreateFrame("Button", "MonkScrollParent", MonkSpellChatFrame, "BackdropTemplate", "TooltipBorderedFrameTemplate")
  5468. MonkScrollParent:SetBackdrop(
  5469.     {
  5470.         bgFile = nil,
  5471.         insets = nil,
  5472.         tileSize = nil,
  5473.         tile = false,
  5474.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  5475.         edgeSize = NumberList.edgeSize
  5476.     }
  5477. )
  5478. MonkScrollParent:SetBackdropBorderColor(unpack(ColourList.monkEdge))
  5479. MonkScrollParent:SetSize(NumberList.scrollFrameWidth, NumberList.scrollFrameHeight)
  5480. MonkScrollParent:SetPoint("TOP", MonkSpellChatFrameAddSpellButton, "BOTTOM", 0, -5)
  5481.  
  5482. local MonkSpellScrollFrame =
  5483.     CreateFrame("ScrollFrame", "MonkSpellScrollFrame", MonkScrollParent, "FauxScrollFrameTemplate")
  5484. MonkSpellScrollFrame:SetPoint("TOPLEFT", 0, -8)
  5485. MonkSpellScrollFrame:SetPoint("BOTTOMRIGHT", -30, 8)
  5486. MonkSpellScrollFrame:SetScript(
  5487.     "OnVerticalScroll",
  5488.     function(self, offset)
  5489.         FauxScrollFrame_OnVerticalScroll(self, offset, NumberList.spellItemScrollButtonHeight, updateMonkSpellList)
  5490.     end
  5491. )
  5492.  
  5493. MonkSpellScrollFrame.buttons = {}
  5494. for index = 1, NumberList.spellItemScrollButtonNumber do
  5495.     MonkSpellScrollFrame.buttons[index] =
  5496.         CreateFrame("Button", "$parentbtn" .. index, MonkScrollParent, "OptionsListButtonTemplate")
  5497.     local button = MonkSpellScrollFrame.buttons[index]
  5498.     button:SetNormalFontObject(TextList.checkBoxSmallFontObject)
  5499.     button:SetHighlightFontObject(TextList.checkBoxSmallFontObject)
  5500.     button:SetSize(NumberList.scrollFrameWidth, NumberList.phraseTextButtonHeight)
  5501.     button:SetPoint("TOPLEFT", 8, -(index - 1) * NumberList.phraseTextButtonHeight - 8)
  5502.     button:SetScript(
  5503.         "OnClick",
  5504.         function(self)
  5505.             VariableList.currentClassSpellList = MonkSpellList
  5506.             VariableList.currentClassSpellLink = MonkSpellList[self.index].spellLink
  5507.             VariableList.currentClassSpellID = MonkSpellList[self.index].spellID
  5508.             VariableList.currentClassSpellPercentage = MonkSpellList[self.index].percentage
  5509.             VariableList.currentClassSpellEnabled = MonkSpellList[self.index].isEnabled
  5510.             loadSpellHeader()
  5511.             updateMonkSpellChatList()
  5512.         end
  5513.     )
  5514.     button:SetScript(
  5515.         "OnEnter",
  5516.         function(self)
  5517.             GameTooltip:SetOwner(self, "ANCHOR_TOP", 0, 15)
  5518.             GameTooltip:SetHyperlink(MonkSpellList[self.index].spellLink)
  5519.             GameTooltip:Show()
  5520.         end
  5521.     )
  5522. end
  5523.  
  5524. MonkSpellChatFrame.ClearSpellListButton =
  5525.     CreateFrame(
  5526.     "Button",
  5527.     "MonkSpellChatFrameClearSpellListButton",
  5528.     MonkSpellChatFrame,
  5529.     "BackdropTemplate",
  5530.     "UIMenuButtonStretchTemplate"
  5531. )
  5532. MonkSpellChatFrame.ClearSpellListButton:SetSize(NumberList.scrollFrameWidth, NumberList.clearTargetListHeight)
  5533. MonkSpellChatFrame.ClearSpellListButton:SetPoint("TOP", MonkScrollParent, "BOTTOM", 0, -4)
  5534. MonkSpellChatFrame.ClearSpellListButton:SetBackdrop(
  5535.     {
  5536.         bgFile = nil,
  5537.         insets = nil,
  5538.         tileSize = nil,
  5539.         tile = true,
  5540.         edgeFile