Thread Tools Display Modes
10-03-18, 03:25 PM   #1
Brellison94
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2013
Posts: 36
Addon "Generate Menu" not responding

Here's the full code. Assist me of fixing this problem please.

Lua Code:
  1. BossTalk.version = tostring(GetAddOnMetadata("BossTalk", "Version"))
  2. local L = LibStub("AceLocale-3.0"):GetLocale("BossTalk")
  3. local LDB = LibStub("LibDataBroker-1.1", true)
  4. local LDBIcon = LDB and LibStub("LibDBIcon-1.0", true)
  5.  
  6. BossTalk.SetItemRef_Original = nil
  7. local oldactualf = 1   
  8. local manadone = false
  9. local gtime={["mount"]=GetTime(),["sync"]=GetTime(),}
  10. local spamcount={}
  11. local mounty, lifedone, wirklichtot, gradlebendig  = 0,0,0,0
  12. local BTchat = LibStub:GetLibrary("Dewdrop-2.0")
  13. local dbd
  14. local defaults = {
  15.     profile ={},
  16.     global = {
  17.         sync = true,
  18.         sendsync = true,
  19.         syncevent = true,
  20.         sendsyncevent = true,
  21.         globversion = 0,
  22.         synclocale = false,
  23.         syncsilent = false,                                            
  24.         useryell={},
  25.         MiniMap={},
  26.         eventspam = {
  27.             ["duell"] = 1,
  28.             ["kampf"] = 1,
  29.             ["killingblow"] = 1,
  30.             ["leben"] = 1,
  31.             ["mana"] = 1,
  32.             ["mount"] = 1,
  33.             ["pet"] = 1,       
  34.         },                                                                                                                                                                   
  35.         mana = 0.2,
  36.         leben = 0.2,
  37.         sound = true,
  38.         text = true,
  39.         say = true,
  40.         yello = false,
  41.         guild = false,
  42.         raid = false,
  43.         party = false,
  44.         emote = false,
  45.         othersyncoutput = true,
  46.         otheroutput = true,
  47.         yelllog=false,
  48.         worldlog=true,
  49.         howo = "SAY",
  50.         favoriten = {},
  51.         ignoppl = {},
  52.         ignoyell = {},
  53.         events = {
  54.             ["duell"] = {},
  55.             ["kampf"] = {},
  56.             ["killingblow"] = {},
  57.             ["leben"] = {},
  58.             ["mana"] = {},
  59.             ["mount"] = {},
  60.             ["pet"] = {},
  61.         },
  62.     },
  63. }
  64.  
  65. local function timer(arg1, arg2)
  66.     if GetTime()-gtime[arg1]<arg2 then
  67.         return true
  68.     else
  69.         gtime[arg1]=GetTime()
  70.         return nil
  71.     end
  72. end
  73.  
  74. function BossTalk:OnCmd(arg1)
  75.     if arg1=="" then
  76.         BossTalk:OnFuBarClick("LeftButton")
  77.     else
  78.         local arg1,arg2=string.split(" ", arg1)
  79.         if string.lower(arg1)=="shortcut" then
  80.             if type(tonumber(arg2))~="number" or type(BossTalk.data[tonumber(arg2)])=="nil" then
  81.                 BossTalk:Print(L["Validation error."])
  82.             else
  83.                 BossTalk:Play(tonumber(arg2))
  84.             end
  85.         elseif type(tonumber(arg1))=="number" and type(BossTalk.data[tonumber(arg1)])~="nil" then
  86.             BossTalk:Play(tonumber(arg1))
  87.         elseif string.lower(arg1)=="search" then
  88.             BossTalk:Search(arg2)
  89.         elseif string.lower(arg1)=="minimap" and LDB and not IsAddOnLoaded("FuBar") then
  90.             if type(tonumber(arg2))~="number" then
  91.                 dbd.MiniMap.hide = not dbd.MiniMap.hide
  92.                 BossTalk:ToggleMM(dbd.MiniMap.hide)
  93.             else
  94.                 if tonumber(arg2)>=0 and tonumber(arg2)<=360 then
  95.                     dbd.MiniMap.minimapPos = tonumber(arg2)
  96.                     LDBIcon:Refresh("BossTalk", dbd.MiniMap)
  97.                 else
  98.                     BossTalk:Print(L["Value must be smaller than 360 and greater than 0!"])
  99.                 end
  100.             end
  101.         else
  102.             BossTalk:Print(L["Wrong command."])
  103.         end
  104.     end
  105. end                                    
  106.  
  107.  
  108. function BossTalk:OnEnable()
  109.     BossTalk:RegisterChatCommand('BossTalk', 'OnCmd')
  110.     self:Print("v"..BossTalk.version..L[" loaded."])
  111. end
  112.  
  113. function BossTalk:GenerateMenu()
  114.     local tempZone = {
  115.         ["Vanilla Events"] = {
  116.             type = 'group',
  117.             name = "Vanilla Events",
  118.             desc = " ",
  119.             args = {},
  120.             order = 1
  121.         },
  122.         ["Vanilla Dungeons"] = {
  123.             type = 'group',
  124.             name = "Vanilla Dungeons",
  125.             desc = " ",
  126.             args = {},
  127.             order = 2
  128.         },
  129.         ["Vanilla Raids"] = {
  130.             type = 'group',
  131.             name = "Vanilla Raids",
  132.             desc = " ",
  133.             args = {},
  134.             order = 3
  135.         },
  136.         ["Burning Crusade Events"] = {
  137.             type = 'group',
  138.             name = "Burning Crusade Events",
  139.             desc = " ",
  140.             args = {},
  141.             order = 4
  142.         },
  143.         ["Burning Crusade Dungeons"] = {
  144.             type = 'group',
  145.             name = "Burning Crusade Dungeons",
  146.             desc = " ",
  147.             args = {},
  148.             order = 5
  149.         },
  150.         ["Burning Crusade Raids"] = {
  151.             type = 'group',
  152.             name = "Burning Crusade Raids",
  153.             desc = " ",
  154.             args = {},
  155.             order = 6
  156.         },
  157.         ["Wrath of the Lich King Events"] = {
  158.             type = 'group',
  159.             name = "Wrath of the Lich King Events",
  160.             desc = " ",
  161.             args = {},
  162.             order = 7
  163.         },
  164.         ["Wrath of the Lich King Dungeons"] = {
  165.             type = 'group',
  166.             name = "Wrath of the Lich King Dungeons",
  167.             desc = " ",
  168.             args = {},
  169.             order = 8
  170.         },
  171.         ["Wrath of the Lich King Raids"] = {
  172.             type = 'group',
  173.             name = "Wrath of the Lich King Raids",
  174.             desc = " ",
  175.             args = {},
  176.             order = 9
  177.         },
  178.         ["Cataclysm Events"] = {
  179.             type = 'group',
  180.             name = "Cataclysm Events",
  181.             desc = " ",
  182.             args = {},
  183.             order = 10
  184.         },
  185.         ["Cataclysm Unused"] = {
  186.             type = 'group',
  187.             name = "Cataclysm Unused",
  188.             desc = " ",
  189.             args = {},
  190.             order = 11
  191.         },
  192.         ["Cataclysm Dungeons"] = {
  193.             type = 'group',
  194.             name = "Cataclysm Dungeons",
  195.             desc = " ",
  196.             args = {},
  197.             order = 12
  198.         },
  199.         ["Cataclysm Raids"] = {
  200.             type = 'group',
  201.             name = "Cataclysm Raids",
  202.             desc = " ",
  203.             args = {},
  204.             order = 13
  205.         },
  206.         ["Mists of Pandaria Events"] = {
  207.             type = 'group',
  208.             name = "Mists of Pandaria Events",
  209.             desc = " ",
  210.             args = {},
  211.             order = 14
  212.         },
  213.         ["Mists of Pandaria Unused"] = {
  214.             type = 'group',
  215.             name = "Mists of Pandaria Unused",
  216.             desc = " ",
  217.             args = {},
  218.             order = 15
  219.         },
  220.         ["Mists of Pandaria Scenarios"] = {
  221.             type = 'group',
  222.             name = "Mists of Pandaria Scenarios",
  223.             desc = " ",
  224.             args = {},
  225.             order = 16
  226.         },
  227.         ["Mists of Pandaria Dungeons"] = {
  228.             type = 'group',
  229.             name = "Mists of Pandaria Dungeons",
  230.             desc = " ",
  231.             args = {},
  232.             order = 17
  233.         },
  234.         ["Mists of Pandaria Raids"] = {
  235.             type = 'group',
  236.             name = "Mists of Pandaria Raids",
  237.             desc = " ",
  238.             args = {},
  239.             order = 18
  240.         },
  241.         ["Warlords of Draenor Events"] = {
  242.             type = 'group',
  243.             name = "Warlords of Draenor Events",
  244.             desc = " ",
  245.             args = {},
  246.             order = 19
  247.         },
  248.         ["Warlords of Draenor Unused"] = {
  249.             type = 'group',
  250.             name = "Warlords of Draenor Unused",
  251.             desc = " ",
  252.             args = {},
  253.             order = 20
  254.         },
  255.         ["Warlords of Draenor Scenarios"] = {
  256.             type = 'group',
  257.             name = "Warlords of Draenor Scenarios",
  258.             desc = " ",
  259.             args = {},
  260.             order = 21
  261.         },
  262.         ["Warlords of Draenor Dungeons"] = {
  263.             type = 'group',
  264.             name = "Warlords of Draenor Dungeons",
  265.             desc = " ",
  266.             args = {},
  267.             order = 22
  268.         },
  269.         ["Warlords of Draenor Raids"] = {
  270.             type = 'group',
  271.             name = "Warlords of Draenor Raids",
  272.             desc = " ",
  273.             args = {},
  274.             order = 23
  275.         },
  276.         ["Class Trials"] = {
  277.             type = 'group',
  278.             name = "Class Trials",
  279.             desc = " ",
  280.             args = {},
  281.             order = 24
  282.         },
  283.         ["Artifact"] = {
  284.             type = 'group',
  285.             name = "Artifact",
  286.             desc = " ",
  287.             args = {},
  288.             order = 25
  289.         },
  290.         ["Class Campaign"] = {
  291.             type = 'group',
  292.             name = "Class Campaign",
  293.             desc = " ",
  294.             args = {},
  295.             order = 26
  296.         },
  297.         ["Legion Events"] = {
  298.             type = 'group',
  299.             name = "Legion Events",
  300.             desc = " ",
  301.             args = {},
  302.             order = 27
  303.         },
  304.         ["Legion Outdoor World"] = {
  305.             type = 'group',
  306.             name = "Legion Outdoor World",
  307.             desc = " ",
  308.             args = {},
  309.             order = 28
  310.         },
  311.         ["Legion World Quests"] = {
  312.             type = 'group',
  313.             name = "Legion World Quests",
  314.             desc = " ",
  315.             args = {},
  316.             order = 29
  317.         },
  318.         ["Legion Scenarios"] = {
  319.             type = 'group',
  320.             name = "Legion Scenarios",
  321.             desc = " ",
  322.             args = {},
  323.             order = 30
  324.         },
  325.         ["Legion Dungeons"] = {
  326.             type = 'group',
  327.             name = "Legion Dungeons",
  328.             desc = " ",
  329.             args = {},
  330.             order = 31
  331.         },
  332.         ["Legion Raids"] = {
  333.             type = 'group',
  334.             name = "Legion Raids",
  335.             desc = " ",
  336.             args = {},
  337.             order = 32
  338.         },
  339.         ["Battle for Azeroth Events"] = {
  340.             type = 'group',
  341.             name = "Battle for Azeroth Events",
  342.             desc = " ",
  343.             args = {},
  344.             order = 33
  345.         },
  346.         ["Battle for Azeroth Outdoor World"] = {
  347.             type = 'group',
  348.             name = "Battle for Azeroth Outdoor World",
  349.             desc = " ",
  350.             args = {},
  351.             order = 34
  352.         },
  353.         ["Battle for Azeroth World Quests"] = {
  354.             type = 'group',
  355.             name = "Battle for Azeroth World Quests",
  356.             desc = " ",
  357.             args = {},
  358.             order = 35
  359.         },
  360.         ["Battle for Azeroth Scenarios"] = {
  361.             type = 'group',
  362.             name = "Battle for Azeroth Scenarios",
  363.             desc = " ",
  364.             args = {},
  365.             order = 36
  366.         },
  367.         ["User"] = {
  368.             type = 'group',
  369.             name = L["User Yells"],
  370.             desc = " ",
  371.             args = {
  372.                 ["World"] = {
  373.                     type = 'group',
  374.                     name = L["World"],
  375.                     desc = " ",
  376.                     args = {},
  377.                     order = 1
  378.                 },
  379.                 ["Instance"] = {
  380.                     type = 'group',
  381.                     name = L["Instance"],
  382.                     desc = " ",
  383.                     args = {},
  384.                     order = 2
  385.                 },
  386.                 ["Sync"] = {
  387.                     type = 'text',
  388.                     name = L["|cffff8800Send to player|r"],
  389.                     desc = L["Enter the name of another BossTalk user to send him your collected yells. This may take a while!"],
  390.                     usage = "<name>",
  391.                     order = 3,
  392.                     get = false,
  393.                     set = function(id)
  394.                         if id=="" or id==" " then return end
  395.                         id = string.gsub(id, "(%w)(%w*)", function(FirstLetter, Rest) return string.upper(FirstLetter)..string.lower(Rest) end)
  396.                         local pack=""
  397.                         for i=1,#dbd.useryell do
  398.                             if dbd.useryell[i] then
  399.                                 if i==#dbd.useryell then
  400.                                     pack="F|"..dbd.useryell[i].boss.."|"..dbd.useryell[i].zone.."|"..dbd.useryell[i].text.."|"..dbd.useryell[i].w.."|"..tostring(#dbd.useryell-i).."|"..GetLocale()
  401.                                 else
  402.                                     pack="G|"..dbd.useryell[i].boss.."|"..dbd.useryell[i].zone.."|"..dbd.useryell[i].text.."|"..dbd.useryell[i].w.."|"..tostring(#dbd.useryell-i).."|"..GetLocale()
  403.                                 end
  404.                                 BossTalk:SendCommMessage("BossTalkComm", pack, "WHISPER", id, "BULK")
  405.                                 BossTalk:Print(L["Sending quote "]..i.."/"..#dbd.useryell.."...")
  406.                             end
  407.                         end                    
  408.                     end,
  409.                 },
  410.                 ["sync"]= {
  411.                     type = 'execute',
  412.                     name = L["|cffff8800Delete double entrys|r"],
  413.                     desc = " ",
  414.                     func = function()
  415.                         for k,v in pairs(BossTalk.data) do
  416.                             for i=1,BossTalk:tcount(dbd.useryell) do
  417.                                 if dbd.useryell[i] then
  418.                                     if dbd.useryell[i].text==v.text then
  419.                                         for u=i, BossTalk:tcount(dbd.useryell)-1 do
  420.                                             dbd.useryell[u]=dbd.useryell[u+1];
  421.                                         end
  422.                                         dbd.useryell[BossTalk:tcount(dbd.useryell)]=nil;               
  423.                                     end
  424.                                 end
  425.                             end
  426.                         end
  427.                         ReloadUI()
  428.                     end,
  429.                     order=4,
  430.                 }
  431.             },
  432.         order = 37
  433.         },           
  434.     }
  435.    
  436.     local function wowcheck(arg1)
  437.         if(arg1 == "ve") then return "Vanilla Events" end
  438.         if(arg1 == "vd") then return "Vanilla Dungeons" end
  439.         if(arg1 == "vr") then return "Vanilla Raids" end
  440.         if(arg1 == "be") then return "Burning Crusade Events" end
  441.         if(arg1 == "bd") then return "Burning Crusade Dungeons" end
  442.         if(arg1 == "br") then return "Burning Crusade Raids" end
  443.         if(arg1 == "we") then return "Wrath of the Lich King Events" end
  444.         if(arg1 == "wd") then return "Wrath of the Lich King Dungeons" end
  445.         if(arg1 == "wr") then return "Wrath of the Lich King Raids" end
  446.         if(arg1 == "ce") then return "Cataclysm Events" end
  447.         if(arg1 == "cu") then return "Cataclysm Unused" end
  448.         if(arg1 == "cd") then return "Cataclysm Dungeons" end
  449.         if(arg1 == "cr") then return "Cataclysm Raids" end
  450.         if(arg1 == "pe") then return "Mists of Pandaria Events" end
  451.         if(arg1 == "pu") then return "Mists of Pandaria Unused" end
  452.         if(arg1 == "ps") then return "Mists of Pandaria Scenarios" end
  453.         if(arg1 == "pd") then return "Mists of Pandaria Dungeons" end
  454.         if(arg1 == "pr") then return "Mists of Pandaria Raids" end
  455.         if(arg1 == "de") then return "Warlords of Draenor Events" end
  456.         if(arg1 == "du") then return "Warlords of Draenor Unused" end
  457.         if(arg1 == "ds") then return "Warlords of Draenor Scenarios" end
  458.         if(arg1 == "dd") then return "Warlords of Draenor Dungeons" end
  459.         if(arg1 == "dr") then return "Warlords of Draenor Raids" end
  460.         if(arg1 == "ct") then return "Class Trials" end
  461.         if(arg1 == "ar") then return "Artifact" end
  462.         if(arg1 == "cc") then return "Class Campaign" end
  463.         if(arg1 == "le") then return "Legion Events" end
  464.         if(arg1 == "low") then return "Legion Outdoor World" end
  465.         if(arg1 == "lwq") then return "Legion World Quests" end
  466.         if(arg1 == "ls") then return "Legion Scenarios" end
  467.         if(arg1 == "ld") then return "Legion Dungeons" end
  468.         if(arg1 == "lr") then return "Legion Raids" end
  469.         if(arg1 == "ae") then return "Battle for Azeroth Events" end
  470.         if(arg1 == "aow") then return "Battle for Azeroth Outdoor World" end
  471.         if(arg1 == "awq") then return "Battle for Azeroth World Quests" end
  472.         if(arg1 == "as") then return "Battle for Azeroth Scenarios" end
  473.     end
  474.    
  475.     for i=1, #self.data do
  476.         if(self.data[i]) then
  477.             if(not tempZone[wowcheck(self.data[i].w)].args[self.data[i].zone]) then
  478.                 tempZone[wowcheck(self.data[i].w)].args[self.data[i].zone] = {
  479.                     type = 'group',
  480.                     name = self.data[i].zone,
  481.                     desc = self.data[i].zone,
  482.                     args = {},
  483.                 }
  484.             end
  485.             if(not tempZone[wowcheck(self.data[i].w)].args[self.data[i].zone].args[self.data[i].boss]) then
  486.                 tempZone[wowcheck(self.data[i].w)].args[self.data[i].zone].args[self.data[i].boss] = {
  487.                     type = 'group',
  488.                     name = self.data[i].boss,
  489.                     desc = self.data[i].boss,
  490.                     args = {},
  491.                 }
  492.             end    
  493.             local yell
  494.             if(not tempZone[wowcheck(self.data[i].w)].args[self.data[i].zone].args[self.data[i].boss].args[self.data[i].text]) then
  495.                 yell = string.sub(self.data[i].text, 0, 15)
  496.                 if(string.len(self.data[i].text) > 15) then
  497.                     yell = yell.."..."
  498.                 end
  499.                 tempZone[wowcheck(self.data[i].w)].args[self.data[i].zone].args[self.data[i].boss].args[self.data[i].text] = {
  500.                     type = 'execute',
  501.                     name = "|cffff8800[#"..i.."]|r "..yell,
  502.                     desc = self.data[i].text..L["\n\n|cff7fff7fshift-leftclick|r |cffff8800to add to favorites.|r"],
  503.                     func = function()
  504.                         if IsShiftKeyDown() then
  505.                             local old = BossTalk:tcount(dbd.favoriten)+1
  506.                             for z=1,BossTalk:tcount(dbd.favoriten) do if dbd.favoriten[z].text == BossTalk.data[i].text then BossTalk:Print(L["Yell is already in list!"]); return; end end
  507.                             dbd.favoriten[old]=self.data[i]
  508.                             BossTalk:MakeFunk()
  509.                         else  
  510.                             self:Play(i)
  511.                         end
  512.                     end,
  513.                 }
  514.             end
  515.         end
  516.     end
  517.  
  518.     local function worldcheck(arg1)
  519.         if arg1=="1" then return "World" end
  520.         if arg1=="2" then return "Instance" end
  521.     end
  522.  
  523.     for i=1, #dbd.useryell do
  524.         if(dbd.useryell[i]) then
  525.             if type(dbd.useryell[i].w)=="nil" then dbd.useryell[i].w = "1" end
  526.             if(not tempZone.User.args[worldcheck(dbd.useryell[i].w)].args[dbd.useryell[i].zone]) then
  527.                 tempZone.User.args[worldcheck(dbd.useryell[i].w)].args[dbd.useryell[i].zone] = {
  528.                     type = 'group',
  529.                     name = dbd.useryell[i].zone,
  530.                     desc = dbd.useryell[i].zone,
  531.                     args = {},
  532.                 }
  533.             end
  534.             if(not tempZone.User.args[worldcheck(dbd.useryell[i].w)].args[dbd.useryell[i].zone].args[dbd.useryell[i].boss]) then
  535.                 tempZone.User.args[worldcheck(dbd.useryell[i].w)].args[dbd.useryell[i].zone].args[dbd.useryell[i].boss] = {
  536.                     type = 'group',
  537.                     name = dbd.useryell[i].boss,
  538.                     desc = dbd.useryell[i].boss,
  539.                     args = {},
  540.                 }
  541.             end
  542.             local yell
  543.             if(not tempZone.User.args[worldcheck(dbd.useryell[i].w)].args[dbd.useryell[i].zone].args[dbd.useryell[i].boss].args[dbd.useryell[i].text]) then
  544.                 yell = string.sub(dbd.useryell[i].text, 0, 15)
  545.                 if(string.len(dbd.useryell[i].text) > 15) then
  546.                     yell = yell.."..."
  547.                 end
  548.                 tempZone.User.args[worldcheck(dbd.useryell[i].w)].args[dbd.useryell[i].zone].args[dbd.useryell[i].boss].args[dbd.useryell[i].text] = {
  549.                     type = 'execute',
  550.                     name = "|cffff8800[#"..i.."]|r "..yell,
  551.                     desc = dbd.useryell[i].text..L["\n\n|cff7fff7fshift-leftclick|r |cffff8800to add to favorites.|r"]..L[" \n\n|cff7fff7falt-leftclick|r |cffff8800to delete entry|r"],
  552.                     func = function()
  553.                         if IsShiftKeyDown() then
  554.                             local old = BossTalk:tcount(dbd.favoriten)+1
  555.                             for z=1,BossTalk:tcount(dbd.favoriten) do if dbd.favoriten[z].text == BossTalk.data[i].text then BossTalk:Print(L["Yell is already in list!"]); return; end end
  556.                             dbd.favoriten[old]=dbd.useryell[i]
  557.                             BossTalk:MakeFunk()
  558.                         elseif IsAltKeyDown() then
  559.                             self.cmdtable.args.bosses.args.User.args[worldcheck(dbd.useryell[i].w)].args[dbd.useryell[i].zone].args[dbd.useryell[i].boss].args[dbd.useryell[i].text]=nil
  560.                             for u=i, BossTalk:tcount(dbd.useryell)-1 do
  561.                                 dbd.useryell[u]=dbd.useryell[u+1];
  562.                             end
  563.                             dbd.useryell[BossTalk:tcount(dbd.useryell)]=nil;                           
  564.                         else  
  565.                             self:Play(i,"user")
  566.                         end
  567.                     end,
  568.                 }
  569.             end
  570.         end
  571.     end
  572.     self.cmdtable.args.bosses.args = tempZone
  573.     tempZone = nil
  574.     wowcheck=nil
  575.     for i=1,BossTalk:tcount(BossTalk.data) do
  576.     BossTalk.data[i].zone=nil
  577.     BossTalk.data[i].w=nil
  578.     end
  579. end
  580.  
  581.  
  582.  
  583. function BossTalk:tcount(tab)
  584.     if(tab == nil) then
  585.         return 0
  586.     end
  587.     local n=0
  588.     for _ in pairs(tab) do
  589.         n=n+1
  590.     end
  591.     return n
  592. end
  593.  
  594. function BossTalk:IgnorePlayer(who)
  595.     local who = string.upper(string.sub(who, 1,1))..string.lower(string.sub(who,2,string.len(who)))
  596.     local check = 0
  597.     local notallowed={"%p", "%c", "%d", "%s", "!", "?", "&", "/", "%(", "%)", "%.", "%%", "%+", "%-", "%*", "%?", "%[", "%^,", "%$",}
  598.     for i=1,BossTalk:tcount(notallowed) do
  599.         if string.find(who, notallowed[i]) ~= nil then check = 1 end
  600.     end
  601.     if check == 1 or string.len(who)<2 then
  602.         BossTalk:Print(L["You entered an invalid name."])
  603.         return
  604.     end
  605.     for z=1,BossTalk:tcount(dbd.ignoppl) do
  606.         if dbd.ignoppl[z] == who then
  607.             BossTalk:Print(L["Player is already in list!"])
  608.             return
  609.         end
  610.     end
  611.     dbd.ignoppl[#dbd.ignoppl+1]=who
  612.     BossTalk:Print(who..L[" is now being ignored."])
  613.     BossTalk:MakeIgno()
  614. end
  615.  
  616. function BossTalk:TextOut(text, arg2)
  617.     if arg2 ~= "sync" then
  618.         if dbd.text then
  619.             if dbd.howo == "EMOTE" then
  620.                 SendChatMessage(L[" quotes "]..arg2..": \""..text.."\"", dbd.howo)
  621.             else         
  622.                 SendChatMessage(text, dbd.howo)
  623.             end
  624.         end
  625.         if dbd.otheroutput then
  626.             UIErrorsFrame:AddMessage(text, 1.0, 0.2, 0.2, 1, 5);
  627.             DEFAULT_CHAT_FRAME:AddMessage(text, 1.0, 0.2, 0.2, 1, 5);
  628.         end    
  629.     elseif arg2 == "sync" and dbd.othersyncoutput then
  630.         UIErrorsFrame:AddMessage(text, 1.0, 0.2, 0.2, 1, 5);
  631.         DEFAULT_CHAT_FRAME:AddMessage(text, 1.0, 0.2, 0.2, 1, 5);  
  632.     end
  633. end
  634.  
  635. function BossTalk:OnDisable()
  636.     BossTalk:Show()
  637.     if self:IsMinimapAttached() == true then
  638.         self:ToggleMinimapAttached()
  639.     end
  640.     self:Print("BossTalk reset")
  641. end
  642.  
  643. function BossTalk.SetItemRef(link, text, button)
  644.     if ( strsub(link, 1, 3) == "bTs" ) then
  645.         if button == "LeftButton" then
  646.             PlaySoundFile("Sound\\Creature\\"..BossTalk.data[tonumber(strsub(link, 5))].sound..".ogg")
  647.             UIErrorsFrame:AddMessage(BossTalk.data[tonumber(strsub(link, 5))].text, 1.0, 0.2, 0.2, 1, 5);
  648.             BossTalk:SendMessage(BossTalk.data[tonumber(strsub(link, 5))].boss,BossTalk.data[tonumber(strsub(link, 5))].sound,"normal")
  649.             return;
  650.         else
  651.             BossTalk.searchcmd = { type='group', args = { welcha = {    type = 'header', name = "|cff00ff00#"..strsub(link, 5)..":|r |cffffff00"..strsub(BossTalk.data[tonumber(strsub(link, 5))].text,1,20).."...\n|r", order = 3, },
  652.             playsound = { type = 'execute', name =  L["Play sound"], desc = " ", func = function() PlaySoundFile("Sound\\Creature\\"..BossTalk.data[tonumber(strsub(link, 5))].sound..".ogg"); UIErrorsFrame:AddMessage(BossTalk.data[tonumber(strsub(link, 5))].text, 1.0, 0.2, 0.2, 1, 5); BossTalk:SendMessage(BossTalk.data[tonumber(strsub(link, 5))].boss,BossTalk.data[tonumber(strsub(link, 5))].sound,"normal"); end, order = 5,},
  653.             addfav = { type = 'execute', name =     L["Add to favorites"], desc = " ", func = function() local old = BossTalk:tcount(dbd.favoriten)+1; for z=1,BossTalk:tcount(dbd.favoriten) do if dbd.favoriten[z].text == BossTalk.data[tonumber(strsub(link, 5))].text then BossTalk:Print(L["Yell is already in list!"]); return; end end dbd.favoriten[old]=BossTalk.data[tonumber(strsub(link, 5))]; BossTalk:MakeFunk(); BossTalk:Print(L["Yell added"]); end, order = 6,},
  654.             addign = {type = 'execute', name =  L["Add to ignore list"], desc = " ", func = function() for z=1,BossTalk:tcount(dbd.ignoyell) do if dbd.ignoyell[z].id == tonumber(strsub(link, 5)) then BossTalk:Print(L["Yell is already in list!"]); return; end end dbd.ignoyell[#dbd.ignoyell+1] = { ["id"] = tonumber(strsub(link, 5)), ["yell"]=BossTalk.data[tonumber(strsub(link, 5))].text, ["sound"]=BossTalk.data[tonumber(strsub(link, 5))].sound } BossTalk:MakeIgno() BossTalk:Print(L["Yell added"]) end, order = 7,},},}
  655.             BTchat:Register("BossTalkChatFrame", 'children', function()
  656.             BTchat:FeedAceOptionsTable(BossTalk.searchcmd) end )
  657.             BTchat:Open("BossTalkChatFrame", 'cursorX', true, 'cursorY', true)
  658.             BTchat:Unregister("BossTalkChatFrame")
  659.             return;
  660.         end
  661.     end
  662.     BossTalk.SetItemRef_Original(link, text, button);
  663. end
  664.  
  665. function BossTalk:Search(phrase)
  666.     if string.len(phrase) < 3 then
  667.         BossTalk:Print("|cffff3333"..L["Please enter 3 or more letters!"].."|r")
  668.         return
  669.     end
  670.     local searchcount = 0
  671.     DEFAULT_CHAT_FRAME:AddMessage("|cffB954FF"..L["BossTalk search results for \""]..phrase.."\":|r")
  672.     for i=1,BossTalk:tcount(BossTalk.data) do
  673.         if string.find(string.upper(BossTalk.data[i].text), string.upper(phrase)) ~= nil then
  674.             searchcount = searchcount + 1
  675.             local a, b = string.find(string.upper(BossTalk.data[i].text), string.upper(phrase))
  676.             if type(BossTalk.data[i].zone) == "nil" then
  677.                 DEFAULT_CHAT_FRAME:AddMessage("|cffffff00"..BossTalk.data[i].boss..":|r")    
  678.             else
  679.                 DEFAULT_CHAT_FRAME:AddMessage("|cffffff00"..BossTalk.data[i].boss.." in "..BossTalk.data[i].zone..":|r")     
  680.             end
  681.             DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00|HbTs:"..i.."|h".."#"..i..":|r |cffff9911"..string.sub(BossTalk.data[i].text, 1, a-1).."|r|cffff0000"..string.sub(BossTalk.data[i].text, a, b).."|r|cffff9911"..string.sub(BossTalk.data[i].text, b+1).."|r|h")
  682.         end
  683.     end
  684.     DEFAULT_CHAT_FRAME:AddMessage("|cffB954FF"..searchcount..L[" matches.|r"])
  685. end
  686.  
  687. function BossTalk_UnitPopup_OnClick(self)
  688.     if self.value == "BOSSTALK_IGNORE" then
  689.         BossTalk:IgnorePlayer(getglobal(UIDROPDOWNMENU_INIT_MENU).name)
  690.     end
  691.     BossTalk_Old_UnitPopup_OnClick(self);
  692. end
  693.  
  694. function BossTalk:AddEvent(id, welches, arg2)
  695.     local nummer = BossTalk:tcount(dbd.events[welches])+1
  696.     dbd.events[welches][nummer]= BossTalk.data[id]
  697.     BossTalk:MakeEvent(welches, arg2)
  698. end
  699.  
  700. function BossTalk:MakeEvent(arg1,arg2)
  701.     temp = {}
  702.     local qt
  703.     spamcount[arg1]=0
  704.     if not self.cmdtable.args.events.args[arg1] or arg2 then
  705.         qt=true
  706.         if not dbd.eventspam[arg1] then dbd.eventspam[arg1]=1 end
  707.         self.cmdtable.args.events.args[arg1]={
  708.             type = "group",
  709.             name = arg1,
  710.             desc = L["Quotes a boss when "]..L["you perform a "]..arg1,
  711.             args = {},
  712.         }
  713.         temp[2]= {
  714.             type = 'execute',
  715.             name = L["Delete event"],
  716.             desc = " ",
  717.             func = function()
  718.                 self.cmdtable.args.events.args[arg1]=nil
  719.                 dbd.events[arg1]=nil           
  720.             end,
  721.             order = 2,
  722.             icon = "Interface\\Icons\\Spell_ChargeNegative",
  723.         }
  724.     end
  725.     temp[1] = {
  726.         type = 'text',
  727.         name = L["Add Quote"],
  728.         desc = L["Adds a quote to this event.\nSimply enter an ID, which you can lookup in the boss menu.\n\n|cff7fff7fshift-leftclick|r |cffff8800on a quote to remove that entry.|r"],
  729.         usage = "<id>",
  730.         pass = true,
  731.         error = L["ID not found!"],
  732.         order = 1,
  733.         message = "Quote added.",
  734.         get = false,
  735.         set = function(id) BossTalk:AddEvent(tonumber(id), arg1,qt) end,
  736.         validate = function(id) return BossTalk.data[tonumber(id)] end,
  737.         icon = "Interface\\Icons\\Spell_ChargePositive",
  738.     }      
  739.     if arg1 == "leben" or arg1 == "mana" then
  740.         local iscrap = 1
  741.         temp[2] = {
  742.             type = 'range',
  743.             name = L["Percent"],
  744.             desc = L["Set the trigger to a percentage"],
  745.             get = function() return dbd[arg1] end,
  746.             set = function(v) dbd[arg1] = v end,
  747.             min = 0.05,
  748.             max = 1,
  749.             step = 0.01,
  750.             isPercent = true,
  751.             order = 2,
  752.         }
  753.     end    
  754.     if arg1 ~= "leben" and arg1 ~= "mana" then         
  755.         temp[3] = {
  756.             name = L["Event frequency"],           
  757.             desc = L["You don't want to spam around? Set a higher number!\n1=play every event, 2=play every second event, and so on."],
  758.             get  = function() return dbd.eventspam[arg1] end,
  759.             set  = function(v) dbd.eventspam[arg1] = v end,
  760.             usage = "<number>",
  761.             type = 'range',
  762.             max = 15,
  763.             min = 1,
  764.             step = 1,
  765.             order = 3,
  766.         }  
  767.     end
  768.     for i=1, BossTalk:tcount(dbd.events[arg1]) do
  769.         if(dbd.events[arg1][i]) then
  770.             yell = string.sub(dbd.events[arg1][i].text, 0, 15)
  771.             if(string.len(dbd.events[arg1][i].text) > 15) then
  772.                 yell = yell.."..."
  773.             end
  774.             temp[i+4] = {
  775.                 type = 'execute',
  776.                 name = "|cff7fff7f"..tostring(i)..")|r "..yell,
  777.                 desc = dbd.events[arg1][i].text..L[" \n\n|cff7fff7fshift-leftclick|r |cffff8800to delete entry|r"],
  778.                 func = function()
  779.                 if IsShiftKeyDown() then
  780.                     for u=i, BossTalk:tcount(dbd.events[arg1])-1 do
  781.                         dbd.events[arg1][u]=dbd.events[arg1][u+1];
  782.                     end
  783.                     dbd.events[arg1][BossTalk:tcount(dbd.events[arg1])]=nil;
  784.                     BossTalk:MakeEvent(arg1,arg2)
  785.                 else
  786.                     BossTalk:Play(i,"event",arg1)
  787.                 end
  788.                 end,
  789.                 order = i+10,
  790.             }
  791.         end
  792.     end
  793.     self.cmdtable.args.events.args[arg1].args = temp
  794.     temp = {}
  795. end
  796.  
  797. function BossTalk:MakeFunk()
  798.     local temp = {}
  799.     temp[1] = {
  800.         type = 'execute',
  801.         name = L[" \n |cffffff00Clear favorites|r \n "],
  802.         desc = L["Resets your favorites."],
  803.         func = function() dbd.favoriten = {} BossTalk:MakeFunk() end,
  804.         icon = "Interface\\Icons\\Spell_ChargePositive",
  805.         order = 1,
  806.     }
  807.     for i=1, BossTalk:tcount(dbd.favoriten) do
  808.         if(dbd.favoriten[i]) then
  809.             yell = string.sub(dbd.favoriten[i].text, 0, 15)
  810.             if(string.len(dbd.favoriten[i].text) > 15) then
  811.                 yell = yell.."..."
  812.             end
  813.             temp[i+1] = {
  814.                 type = 'execute',
  815.                 name = "|cff7fff7f"..tostring(i)..")|r "..yell,
  816.                 desc = dbd.favoriten[i].text..L[" \n\n|cff7fff7fshift-leftclick|r |cffff8800to delete entry|r"],
  817.                 func = function()
  818.                     if IsShiftKeyDown() then
  819.                         for u=i, BossTalk:tcount(dbd.favoriten)-1 do
  820.                             dbd.favoriten[u]=dbd.favoriten[u+1];
  821.                         end
  822.                         dbd.favoriten[BossTalk:tcount(dbd.favoriten)]=nil;
  823.                         BossTalk:MakeFunk();                                   
  824.                     else
  825.                         self:Play(i,"fav")
  826.                     end
  827.                 end,
  828.                 order = i,
  829.             }
  830.         end
  831.     end
  832.     self.cmdtable.args.favorites.args = temp
  833. end            
  834.  
  835. function BossTalk:MakeIgno()
  836.     local temp = {}
  837.     temp[1] = {
  838.         type = 'text',
  839.         name = L["Add player"],
  840.         desc = L["Enter the name of a player you want to ignore. You will no longer receive any sync from that player."],
  841.         usage = "<name>",
  842.         order = 1,
  843.         icon = "Interface\\Icons\\Spell_ChargePositive",
  844.         get = false,
  845.         set = function(who)
  846.             BossTalk:IgnorePlayer(who)                                                                                                                                     
  847.         end,
  848.     }
  849.     for i=1, BossTalk:tcount(dbd.ignoppl) do
  850.         temp[i+1] = {
  851.             type = 'execute',
  852.             name = "|cffff2222"..dbd.ignoppl[i].."|r",
  853.             desc = L[" \n\n|cff7fff7fshift-leftclick|r |cffff8800to delete entry|r"],
  854.             func = function()
  855.                 if IsShiftKeyDown() then
  856.                     for u=i, BossTalk:tcount(dbd.ignoppl)-1 do
  857.                         dbd.ignoppl[u]=dbd.ignoppl[u+1];
  858.                     end
  859.                     dbd.ignoppl[BossTalk:tcount(dbd.ignoppl)]=nil;
  860.                     BossTalk:MakeIgno();                                   
  861.                 end
  862.             end,
  863.         }
  864.     end
  865.     BossTalk.cmdtable.args.options.args.ignore.args.ignoppl.args = temp
  866.     local temp = {}
  867.     temp[1] = {
  868.         type = 'text',
  869.         name = L["Add yell"],
  870.         desc = L["Enter the ID of the yell you don't want to receive."],
  871.         usage = "<ID>",
  872.         order = 1,
  873.         icon = "Interface\\Icons\\Spell_ChargePositive",
  874.         get = false,
  875.         set = function(id)
  876.             for z=1,BossTalk:tcount(dbd.ignoyell) do
  877.                 if dbd.ignoyell[z].id == tonumber(id) then
  878.                     BossTalk:Print(L["Yell is already in list!"])
  879.                     return
  880.                 end
  881.             end
  882.             dbd.ignoyell[#dbd.ignoyell+1] = { ["id"] = tonumber(id), ["yell"]=BossTalk.data[tonumber(id)].text, ["sound"]=BossTalk.data[tonumber(id)].sound }
  883.             BossTalk:MakeIgno()
  884.         end,
  885.         validate = function(id)
  886.         return BossTalk.data[tonumber(id)]
  887.         end,
  888.     }
  889.     for i=1, BossTalk:tcount(dbd.ignoyell) do
  890.         local yell = string.sub(dbd.ignoyell[i].yell, 0, 20)
  891.         if(string.len(dbd.ignoyell[i].yell) > 20) then
  892.             yell = yell.."..."
  893.         end
  894.         temp[i+1] = {
  895.             type = 'execute',
  896.             name = "|cffff2222#"..dbd.ignoyell[i].id.."|r |cffffee22"..yell.."|r",
  897.             desc = L[" \n\n|cff7fff7fshift-leftclick|r |cffff8800to delete entry|r"],
  898.             func = function()
  899.                 if IsShiftKeyDown() then
  900.                     for u=i, BossTalk:tcount(dbd.ignoyell)-1 do
  901.                         dbd.ignoyell[u]=dbd.ignoyell[u+1];
  902.                     end
  903.                     dbd.ignoyell[BossTalk:tcount(dbd.ignoyell)]=nil;
  904.                     BossTalk:MakeIgno();                                   
  905.                 end
  906.             end,
  907.         }
  908.     end
  909.     BossTalk.cmdtable.args.options.args.ignore.args.ignoyell.args = temp
  910. end
  911.  
  912. function BossTalk:PLAYER_LOGIN()
  913.     self:UnregisterEvent("PLAYER_LOGIN")
  914.  
  915.     if LDB and not IsAddOnLoaded("FuBar") then
  916.         BossTalkLauncher = LDB:NewDataObject("BossTalk", {
  917.             type = "launcher",
  918.             icon = "Interface\\Icons\\Spell_Arcane_TeleportShattrath",
  919.             OnClick = function(clickedframe, button)
  920.                 BossTalk:OnFuBarClick(button)
  921.             end,
  922.             OnTooltipShow = function(tt)
  923.                 GameTooltip:AddLine("|cffff8800Bosstalk|r".." |cff7fff7fv"..BossTalk.version.."|r");
  924.                 GameTooltip:AddLine("|cffA843EFby Brellison94")
  925.                 GameTooltip:AddLine(" ")
  926.                 GameTooltip:AddLine(L["|cff7fff7fleftclick:|r random quote"])
  927.                 GameTooltip:AddLine(L["|cff7fff7frightclick:|r show options menu"])
  928.                 GameTooltip:AddLine(" ")
  929.                 if dbd.globversion ~= 0 and dbd.globversion > tonumber(BossTalk.version) then
  930.                     GameTooltip:AddLine("|cffff1111"..L["New BossTalk version!"].."|r")
  931.                     GameTooltip:AddLine("|cffff1111"..L["You use: "].."|cffffff00v"..tostring(BossTalk.version).."|r")
  932.                     GameTooltip:AddLine("|cffff1111"..L["Latest version: "].."|cff00ff00v"..tostring(dbd.globversion).."|r")
  933.                     GameTooltip:AddLine(" ")
  934.                 end
  935.                 GameTooltip:AddLine(L["Database: "].."|cff7fff7f"..BossTalk:tcount(BossTalk.data).."|r"..L[" entrys."])
  936.             end,
  937.         })
  938.         if LDBIcon then
  939.             LDBIcon:Register("BossTalk", BossTalkLauncher, dbd.MiniMap)
  940.             function BossTalk:ToggleMM(value)
  941.                 if value then LDBIcon:Show("BossTalk") else LDBIcon:Hide("BossTalk") end
  942.                 LDBIcon:Refresh("BossTalk", dbd.MiniMap)
  943.             end
  944.         end    
  945.     end
  946.    
  947.     if LibStub:GetLibrary("LibFuBarPlugin-3.0", true) and IsAddOnLoaded("FuBar") then
  948.         local LFBP = LibStub:GetLibrary("LibFuBarPlugin-3.0")
  949.         LibStub("AceAddon-3.0"):EmbedLibrary(self, "LibFuBarPlugin-3.0")
  950.         BossTalk:SetFuBarOption('tooltipType', "GameTooltip")
  951.         BossTalk:SetFuBarOption('iconPath', "Interface\\Icons\\Ability_Druid_Berserk")
  952.         BossTalk:SetFuBarOption('hasIcon', true)
  953.         BossTalk:SetFuBarOption('configType', "None")
  954.         BossTalk:SetFuBarOption("defaultMinimapPosition" , 195)
  955.         LFBP:OnEmbedInitialize(self)
  956.         function BossTalk:OnUpdateFuBarTooltip()
  957.             GameTooltip:AddLine("|cffff8800Bosstalk|r".." |cff7fff7fv"..BossTalk.version.."|r");
  958.             GameTooltip:AddLine("|cffA843EFby Yvaine/Endeavour EU Arthas|r update by Brellison94")
  959.             GameTooltip:AddLine(" ")
  960.             GameTooltip:AddLine(L["|cff7fff7fleftclick:|r random quote"])
  961.             if self:IsFuBarMinimapAttached() then
  962.                 GameTooltip:AddLine(L["|cff7fff7fhold left button:|r move button"]);   
  963.             end
  964.             GameTooltip:AddLine(L["|cff7fff7frightclick:|r show options menu"])
  965.             GameTooltip:AddLine(" ")
  966.             if dbd.globversion ~= 0 and dbd.globversion > tonumber(BossTalk.version) then
  967.                 GameTooltip:AddLine("|cffff1111"..L["New BossTalk version!"].."|r")
  968.                 GameTooltip:AddLine("|cffff1111"..L["You use: "].."|cffffff00v"..tostring(BossTalk.version).."|r")
  969.                 GameTooltip:AddLine("|cffff1111"..L["Latest version: "].."|cff00ff00v"..tostring(dbd.globversion).."|r")
  970.                 GameTooltip:AddLine(" ")
  971.             end
  972.             GameTooltip:AddLine(L["Database: "].."|cff7fff7f"..BossTalk:tcount(BossTalk.data).."|r"..L[" entrys."])
  973.         end
  974.         BossTalk:Show()
  975.     end
  976. end
  977.  
  978. function BossTalk:OnFuBarClick(button)
  979.     if button == "LeftButton" then
  980.         local zufall = random(#BossTalk.data)
  981.         BossTalk:Play(zufall)
  982.     elseif button =="RightButton" then
  983.         if BTchat:IsRegistered("BossTalkMenu")~=true then
  984.             BTchat:Register("BossTalkMenu", 'children', function()
  985.             BTchat:FeedAceOptionsTable(BossTalk.cmdtable) end )
  986.         end
  987.         BTchat:Open("BossTalkMenu", 'cursorX', true, 'cursorY', true)
  988.     end
  989. end
  990.        
  991. function BossTalk:OnInitialize()
  992.     BossTalk.db = LibStub('AceDB-3.0'):New('BossTalkDBX')
  993.     BossTalk.db:RegisterDefaults(defaults)
  994.     dbd = BossTalk.db.global
  995.     BossTalk:RegisterComm("BossTalkComm")
  996.     self:RegisterEvent("PLAYER_ALIVE")
  997.     self:RegisterEvent("PLAYER_UNGHOST")
  998.     self:RegisterEvent("CHAT_MSG_MONSTER_YELL")
  999.     self:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")
  1000.     self:RegisterEvent("UNIT_HEALTH")
  1001.     self:RegisterEvent("UNIT_MANA")
  1002.     self:RegisterEvent("PET_ATTACK_START")
  1003.     self:RegisterEvent("DUEL_REQUESTED")
  1004.     self:RegisterEvent("PLAYER_REGEN_DISABLED")
  1005.     self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")  
  1006.     self:RegisterEvent("PLAYER_LOGIN")
  1007.     BossTalk.SetItemRef_Original = SetItemRef
  1008.     SetItemRef = BossTalk.SetItemRef
  1009.     NEWBIE_TOOLTIP_UNIT_BOSSTALK_IGNORE = L["If you don't want to disable the entire sync ability, you can add players and/or yells to an ignore list."]
  1010.     UnitPopupButtons["BOSSTALK_IGNORE"] = { text = "|cffffff22BossTalk:|r |cffff6666Ignore|r", dist = 0, space = 1 };  
  1011.     table.insert(UnitPopupMenus["CHAT_ROSTER"],#UnitPopupMenus["CHAT_ROSTER"]-1, "BOSSTALK_IGNORE")
  1012.     table.insert(UnitPopupMenus["FRIEND"],#UnitPopupMenus["FRIEND"]-1, "BOSSTALK_IGNORE")
  1013.     table.insert(UnitPopupMenus["PARTY"],#UnitPopupMenus["PARTY"]-1, "BOSSTALK_IGNORE")
  1014.     table.insert(UnitPopupMenus["RAID_PLAYER"],#UnitPopupMenus["RAID_PLAYER"]-1, "BOSSTALK_IGNORE")
  1015.     BossTalk_Old_UnitPopup_OnClick = UnitPopup_OnClick
  1016.     UnitPopup_OnClick = BossTalk_UnitPopup_OnClick
  1017.     BossTalk:GenerateSync()
  1018.     for k,_ in pairs(dbd.events) do
  1019.         BossTalk:MakeEvent(k)
  1020.     end
  1021.     BossTalk:MakeFunk()
  1022.     BossTalk:MakeIgno()
  1023.     BossTalk.cmdtable.args.options.args.syncopt.args.showsync.args.eigener.name = UnitName("player").." v|cff00ff00"..tostring(BossTalk.version).."|r"
  1024.     BossTalk.buffcheckframe=CreateFrame("frame")
  1025.     BossTalk.buffcheckframe:SetScript('OnUpdate', function() if not timer("mount",1) then BossTalk:MountCheck() end end)
  1026. end
  1027.  
  1028. function BossTalk:SendMessage(arg1, arg2, arg3)
  1029.     arg1=tostring(arg1)
  1030.     arg2=tostring(arg2)
  1031.     arg3=tostring(arg3)
  1032.     if arg1 == "X" then
  1033.         BossTalk:SendCommMessage("BossTalkComm", "X|X|X|"..BossTalk.version.."|"..GetLocale(), "GUILD", nil, "BULK")
  1034.     end
  1035.     if dbd.sendsync == false and arg3 ~= "event" then
  1036.         return
  1037.     end
  1038.     if dbd.sendsyncevent == false and arg3 == "event" then
  1039.         return
  1040.     end
  1041.     BossTalk:SendCommMessage("BossTalkComm", arg1.."|"..arg2.."|"..arg3.."|"..BossTalk.version.."|"..GetLocale(), "RAID", nil, "BULK")
  1042.     BossTalk:SendCommMessage("BossTalkComm", arg1.."|"..arg2.."|"..arg3.."|"..BossTalk.version.."|"..GetLocale(), "PARTY", nil, "BULK")
  1043. end
  1044.  
  1045. function BossTalk:VersionCheck(version, player, loc)
  1046.     if player==UnitName("player") or tonumber(version) == nil then
  1047.         return
  1048.     end
  1049.     loc=loc or "?"
  1050.     if tonumber(version) > tonumber(BossTalk.version) and tonumber(version) > dbd.globversion then
  1051.         dbd.globversion = tonumber(version)
  1052.         BossTalk:Print("|cffff1111"..L["New BossTalk version!"].."|r")
  1053.         BossTalk:Print("|cffff1111"..L["You use: "].."|cffffff00v"..tostring(BossTalk.version).."|r")
  1054.         BossTalk:Print("|cffff1111"..L["Latest version: "].."|cff00ff00v"..tostring(dbd.globversion).."|r")
  1055.     end    
  1056.     for i=1, #self.cmdtable.args.options.args.syncopt.args.showsync.args do
  1057.         if string.find(self.cmdtable.args.options.args.syncopt.args.showsync.args[i].name, player) ~= nil then
  1058.             return
  1059.         end
  1060.     end
  1061.     if tonumber(version) == tonumber(BossTalk.version) then
  1062.         version = "|cff00ff00"..tostring(version).."|r"
  1063.         descri = player..L[" and you are running the same version."]
  1064.     elseif tonumber(version) > tonumber(BossTalk.version) then
  1065.         version = "|cffff0000"..tostring(version).."|r"
  1066.         descri = player..L[" has a newer version!\nYou should update BossTalk!"]
  1067.     elseif tonumber(version) < tonumber(BossTalk.version) then
  1068.         version = "|cffffff00"..tostring(version).."|r"
  1069.         descri = player..L[" has an outdated Version.\nTell him to update BossTalk!"]
  1070.     end
  1071.     self.cmdtable.args.options.args.syncopt.args.showsync.args[#self.cmdtable.args.options.args.syncopt.args.showsync.args+1] ={
  1072.         type = 'execute',
  1073.         name = player.." v"..version.." "..loc,
  1074.         desc = descri,
  1075.         func = function() end,
  1076.     }
  1077.     local anzahl = BossTalk:tcount(self.cmdtable.args.options.args.syncopt.args.showsync.args)-2
  1078.     self.cmdtable.args.options.args.syncopt.args.showsync.args.wieviele = {
  1079.         type = 'header',
  1080.         name = "|cffffff00"..tostring(anzahl).."|r "..L[" entrys."],
  1081.         order = 2,
  1082.     },
  1083.     table.sort(self.cmdtable.args.options.args.syncopt.args.showsync.args, function(a,b) return a["name"] < b["name"] end)                             
  1084. end
  1085.  
  1086. function BossTalk:OnCommReceived(caller, data, _, sender)
  1087.     if sender==UnitName("player") then
  1088.         return
  1089.     end
  1090.     local arg1,arg2,arg3,arg4,arg5,arg6,arg7 = string.split("|", data)     
  1091.     if arg1=="G" or arg1== "F" then
  1092.         arg7=tostring(arg7)
  1093.         if arg7~=GetLocale() and dbd.synclocale~=false then if dbd.syncsilent==false then BossTalk:Print(L["Sync blocked."].." "..arg7.."!="..GetLocale()) end return end
  1094.         for i=1,#dbd.useryell do
  1095.             if dbd.useryell[i].text==tostring(arg4) then
  1096.                 if dbd.syncsilent==false then
  1097.                     BossTalk:Print(L["Quote already in DB, skipped. "]..tostring(arg6))
  1098.                 end
  1099.                 return
  1100.             end
  1101.         end
  1102.         dbd.useryell[#dbd.useryell+1]={["boss"]=tostring(arg2), ["zone"]=tostring(arg3), ["text"]=tostring(arg4), ["w"]=tostring(arg5), ["sound"]=""}
  1103.         if dbd.syncsilent==false then
  1104.             BossTalk:Print(sender..": "..tostring(arg2)..", "..tostring(arg6)..L[" quotes remaining."])
  1105.         end
  1106.         if arg1=="F" then BossTalk:Print(L["Synchronisation completed. Reload your UI in order to activate the new quotes."]) end
  1107.         table.sort(BossTalk.db.global.useryell, function(a,b)
  1108.             if(a["w"] ~= b["w"]) then
  1109.                 return tonumber(a["w"]) < tonumber(b["w"])
  1110.             else
  1111.                 if(a["zone"] ~= b["zone"]) then
  1112.                     return a["zone"] < b["zone"]
  1113.                 else
  1114.                     if(a["boss"] ~= b["boss"]) then
  1115.                         return a["boss"] < b["boss"]
  1116.                     else
  1117.                         return a["text"] < b["text"]
  1118.                     end    
  1119.                 end
  1120.             end        
  1121.         end)
  1122.         return
  1123.     end    
  1124.     if arg4==nil then
  1125.         arg4=0
  1126.     end
  1127.     BossTalk:VersionCheck(arg4, sender, arg5)
  1128.     if arg1=="Y" then
  1129.         return
  1130.     end
  1131.     if arg1=="X" then
  1132.         BossTalk:SendCommMessage("BossTalkComm", "Y|X|X|"..tostring(BossTalk.version).."|"..GetLocale(), "WHISPER", sender, "BULK")
  1133.         return
  1134.     end    
  1135.     if (arg3 == "event" and dbd.syncevent == false) or  (dbd.sync == false and arg3 ~= "event") then
  1136.         return
  1137.     end
  1138.     if timer("sync", 5) then return end
  1139.     for i=1,BossTalk:tcount(dbd.ignoppl) do
  1140.         if sender == dbd.ignoppl[i] then
  1141.             BossTalk:Print(L["Sync blocked."].." "..sender)
  1142.             return
  1143.         end
  1144.     end
  1145.     self:Print(sender..L[" quotes "].."|cffffff00"..arg1.."|r")
  1146.     if arg3=="user" then
  1147.         BossTalk:TextOut(arg2, "sync")
  1148.     else
  1149.         if arg2=="" then return end
  1150.         for i=1,BossTalk:tcount(dbd.ignoyell) do
  1151.             if arg2 == dbd.ignoyell[i].sound then
  1152.                 BossTalk:Print(L["Sync blocked."].."(#"..dbd.ignoyell[i].id.." "..string.sub(dbd.ignoyell[i].yell, 0, 20)..")")
  1153.                 return
  1154.             end
  1155.         end    
  1156.         if dbd.sound then
  1157.             PlaySoundFile("Sound\\Creature\\"..arg2..".ogg")
  1158.         end
  1159.         for k=1,BossTalk:tcount(BossTalk.data) do
  1160.             if string.find(BossTalk.data[k].sound, arg2) ~= nil then
  1161.                 BossTalk:TextOut(BossTalk.data[k].text, "sync")
  1162.             end
  1163.         end
  1164.     end
  1165. end
  1166.  
  1167. function BossTalk:GenerateSync()
  1168.     self.cmdtable.args.options.args.syncopt.args.showsync.args = nil
  1169.     self.cmdtable.args.options.args.syncopt.args.showsync.args = {
  1170.         listemachen = {
  1171.             type = 'execute',
  1172.             name = L[" \n |cffffff00Update List!|r \n "],
  1173.             desc = L["Updates the user list."],
  1174.             func = function() BossTalk:GenerateSync() end,
  1175.             icon = "Interface\\Icons\\Spell_ChargePositive",
  1176.             order = 1,
  1177.         },
  1178.         wieviele = {
  1179.             type = 'header',
  1180.             name = "|cff00ff00"..tostring(BossTalk:tcount(self.cmdtable.args.options.args.syncopt.args.showsync.args)+1).."|r "..L[" entrys."],
  1181.             order = 2,
  1182.         },
  1183.         eigener = {
  1184.             type = 'execute',
  1185.             name = UnitName("player").." v|cff00ff00"..tostring(BossTalk.version).."|r".." "..GetLocale(),
  1186.             desc = L["Guess who's that! :-)"],
  1187.             func = function() end,
  1188.             order = 3,
  1189.         },
  1190.     }
  1191.     BossTalk:SendMessage("X", "X", "X")
  1192. end
  1193.  
  1194. function BossTalk:Play(id, arg2, arg3)
  1195.     local M
  1196.     if arg2 == "fav" then
  1197.         M = dbd.favoriten[id]
  1198.     elseif arg2 == "event" then
  1199.         M = dbd.events[arg3][id]
  1200.     elseif arg2 == "user" then
  1201.         M = dbd.useryell[id]
  1202.         M.sound="N2O"
  1203.     else
  1204.         M = self.data[id]
  1205.     end
  1206.     if arg2 ~= "event" then
  1207.         self:Print(L["Quoted from "].."|cffffff00"..M.boss.."|r")
  1208.     end
  1209.     BossTalk:TextOut(M.text,M.boss)
  1210.     if dbd.sound then
  1211.         PlaySoundFile("Sound\\Creature\\"..M.sound..".ogg")
  1212.     end
  1213.     if arg2 == "event" then
  1214.         self:SendMessage(M.boss,M.sound,"event")
  1215.     elseif arg2 == "user" then
  1216.         self:SendMessage(M.boss,M.text,"user")
  1217.     else
  1218.         self:SendMessage(M.boss,M.sound,"normal")
  1219.     end
  1220. end
  1221.  
  1222. function BossTalk:COMBAT_LOG_EVENT_UNFILTERED(_, _, etype, _, srcGUID, _, sourceFlags, sourecRaidFlags, _, _, _, _, spellID, spellName, _, amount) 
  1223.     if srcGUID~=UnitGUID("player") then return end
  1224.     if etype == "PARTY_KILL" then
  1225.         if BossTalk:tcount(dbd.events.killingblow) == 0 then return end
  1226.         if (bit.band(sourceFlags, COMBATLOG_OBJECT_AFFILIATION_MINE) == COMBATLOG_OBJECT_AFFILIATION_MINE) then
  1227.             spamcount["killingblow"]=spamcount["killingblow"]+1
  1228.             if spamcount["killingblow"] < dbd.eventspam.killingblow then return end
  1229.             spamcount["killingblow"] = 0
  1230.             local zufall = random(BossTalk:tcount(dbd.events.killingblow))
  1231.             BossTalk:Play(zufall,"event","killingblow")
  1232.         end
  1233.     elseif etype=="SPELL_CAST_SUCCESS" and dbd.events[spellName] then
  1234.         if BossTalk:tcount(dbd.events[spellName]) == 0 then return end
  1235.         spamcount[spellName]=spamcount[spellName]+1
  1236.         if spamcount[spellName] < dbd.eventspam[spellName] then return end
  1237.         spamcount[spellName] = 0
  1238.         local zufall = random(#dbd.events[spellName])
  1239.         BossTalk:Play(zufall,"event",spellName)
  1240.     end
  1241. end
  1242.  
  1243. function BossTalk:DUEL_REQUESTED()
  1244.     spamcount["duell"]=spamcount["duell"]+1
  1245.     if spamcount["duell"] < dbd.eventspam.duell then return end
  1246.     spamcount["duell"] = 0
  1247.     if BossTalk:tcount(dbd.events.duell) == 0 then return end
  1248.     local zufall = random(BossTalk:tcount(dbd.events.duell))
  1249.     BossTalk:Play(zufall,"event","duell")
  1250. end
  1251.  
  1252. function BossTalk:MountCheck()
  1253.     if IsMounted() == 1 and UnitOnTaxi("player") == nil and BossTalk:tcount(dbd.events.mount) ~= 0 then
  1254.         if mounty == 0 then
  1255.             mounty = 1
  1256.             spamcount["mount"]=spamcount["mount"]+1
  1257.             if spamcount["mount"] < dbd.eventspam.mount then return end
  1258.             spamcount["mount"] = 0
  1259.             local zufall = random(BossTalk:tcount(dbd.events.mount))
  1260.             BossTalk:Play(zufall,"event","mount")
  1261.         end
  1262.     else
  1263.         mounty = 0
  1264.     end
  1265. end
  1266.  
  1267. function BossTalk:PET_ATTACK_START()
  1268.     spamcount["pet"]=spamcount["pet"]+1
  1269.     if spamcount["pet"] < dbd.eventspam.pet then return end
  1270.     spamcount["pet"] = 0
  1271.     if BossTalk:tcount(dbd.events.pet) == 0 then return end
  1272.     local zufall = random(BossTalk:tcount(dbd.events.pet))
  1273.     BossTalk:Play(zufall,"event","pet")
  1274. end
  1275.  
  1276.  
  1277. function BossTalk:PLAYER_ALIVE()
  1278.     BossTalk:PLAYER_UNGHOST()
  1279. end
  1280.  
  1281. function BossTalk:PLAYER_UNGHOST()
  1282.     gradlebendig = 1
  1283. end
  1284.  
  1285. function BossTalk:UNIT_HEALTH()
  1286.     if gradlebendig == 1 and (UnitHealth("player")/UnitHealthMax("player"))*100 < 35 then return end
  1287.     gradlebendig = 0
  1288.     if BossTalk:tcount(dbd.events.leben) == 0 then return end
  1289.     if (UnitHealth("player")/UnitHealthMax("player"))*100 <= (dbd.leben*100) and (UnitHealth("player")/UnitHealthMax("player"))*100 > 1 then
  1290.         if lifedone == 0 then
  1291.             lifedone = 1
  1292.             local zufall = random(BossTalk:tcount(dbd.events.leben))
  1293.             BossTalk:Play(zufall,"event","leben")
  1294.         end
  1295.     else
  1296.         lifedone = 0
  1297.     end
  1298. end
  1299.  
  1300. function BossTalk:UNIT_MANA()
  1301.     if gradlebendig == 1 and (UnitMana("player")/UnitManaMax("player"))*100 < 35 then return end
  1302.     gradlebendig = 0
  1303.     if BossTalk:tcount(dbd.events.mana) == 0 then return end
  1304.     if (UnitMana("player")/UnitManaMax("player"))*100 < (dbd.mana*100)+1 and (UnitMana("player")/UnitManaMax("player"))*100 > 1 then
  1305.             if manadone == false then
  1306.             manadone = true
  1307.             local zufall = random(BossTalk:tcount(dbd.events.mana))
  1308.             BossTalk:Play(zufall,"event","mana")
  1309.         end
  1310.     else
  1311.         manadone = false
  1312.     end
  1313. end
  1314.  
  1315. function BossTalk:CHAT_MSG_MONSTER_WHISPER(dist, yell, boss)
  1316.     if boss==nil then
  1317.         boss="UNKNOWN"
  1318.     end
  1319.     if yell==nil then
  1320.         yell="UNKNOWN"
  1321.     end
  1322.     BossTalk:CHAT_MSG_MONSTER_YELL(nil, yell, boss)
  1323. end
  1324.  
  1325. function BossTalk:CHAT_MSG_MONSTER_YELL(dist, yell, boss)
  1326.     local inInstance, instanceType = IsInInstance()
  1327.     local zony = tostring(GetRealZoneText())
  1328.     if zony == nil then
  1329.         zony = tostring(GetZoneText())
  1330.     end
  1331.     if zony == nil then
  1332.         zony = tostring(GetMinimapZoneText())
  1333.     end
  1334.     if zony == nil then
  1335.         zony = "UNKNOWN"
  1336.     end
  1337.     local typol="2"
  1338.     if ( (inInstance ~= 1) or (instanceType ~= "raid" and instanceType ~= "party") ) then
  1339.         typol="1"
  1340.     end
  1341.     if( ((dbd.yelllog ~= true) and (typol=="2")) or ((dbd.worldlog ~= true) and (typol=="1")) ) then    
  1342.     for i=1,BossTalk:tcount(dbd.useryell) do
  1343.         if type(dbd.useryell[i].text) ~= "nil" then
  1344.             if dbd.useryell[i].text == yell then
  1345.                 return
  1346.             end
  1347.         end
  1348.     end
  1349.     dbd.useryell[BossTalk:tcount(dbd.useryell)+1]={["boss"]=boss, ["zone"]=zony, ["text"]=yell, ["w"]=typol, ["sound"]=""}
  1350.     BossTalk:Print(L["New yell collected!"])
  1351.     end
  1352. end
  1353.  
  1354. function BossTalk:PLAYER_REGEN_DISABLED()
  1355.     if BossTalk:tcount(dbd.events.kampf) == 0 then return end
  1356.     spamcount["kampf"]=spamcount["kampf"]+1
  1357.     if spamcount["kampf"] < dbd.eventspam.kampf then return end
  1358.     spamcount["kampf"] = 0
  1359.     local zufall = random(#dbd.events.kampf)
  1360.     BossTalk:Play(zufall,"event","kampf")
  1361. end

Last edited by Brellison94 : 10-05-18 at 07:54 AM.
  Reply With Quote
10-04-18, 02:07 PM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,237
Ouch. Can you use the code tags please? Either those or the PHP tags?
  Reply With Quote
10-05-18, 07:55 AM   #3
Brellison94
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2013
Posts: 36
Originally Posted by myrroddin View Post
Ouch. Can you use the code tags please? Either those or the PHP tags?
Edited. Sorry about that. Please look at it again.
  Reply With Quote
10-24-18, 01:33 PM   #4
Brellison94
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2013
Posts: 36
Anything of being resolved of on how to fix the tab so it can open?
  Reply With Quote
10-30-18, 09:10 AM   #5
Goranaws
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Sep 2010
Posts: 5
Is this the full Addon? Can't really test and debug, if I can't run the code.
  Reply With Quote
11-01-18, 02:30 PM   #6
Brellison94
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2013
Posts: 36
Originally Posted by Goranaws View Post
Is this the full Addon? Can't really test and debug, if I can't run the code.
Here's the full Addon.

BossTalk.zip
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Addon "Generate Menu" not responding

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off