BossTalk.version = tostring(GetAddOnMetadata("BossTalk", "Version"))
local L = LibStub("AceLocale-3.0"):GetLocale("BossTalk")
local LDB = LibStub("LibDataBroker-1.1", true)
local LDBIcon = LDB and LibStub("LibDBIcon-1.0", true)
BossTalk.SetItemRef_Original = nil
local oldactualf = 1
local manadone = false
local gtime={["mount"]=GetTime(),["sync"]=GetTime(),}
local spamcount={}
local mounty, lifedone, wirklichtot, gradlebendig = 0,0,0,0
local BTchat = LibStub:GetLibrary("Dewdrop-2.0")
local dbd
local defaults = {
profile ={},
global = {
sync = true,
sendsync = true,
syncevent = true,
sendsyncevent = true,
globversion = 0,
synclocale = false,
syncsilent = false,
useryell={},
MiniMap={},
eventspam = {
["duell"] = 1,
["kampf"] = 1,
["killingblow"] = 1,
["leben"] = 1,
["mana"] = 1,
["mount"] = 1,
["pet"] = 1,
},
mana = 0.2,
leben = 0.2,
sound = true,
text = true,
say = true,
yello = false,
guild = false,
raid = false,
party = false,
emote = false,
othersyncoutput = true,
otheroutput = true,
yelllog=false,
worldlog=true,
howo = "SAY",
favoriten = {},
ignoppl = {},
ignoyell = {},
events = {
["duell"] = {},
["kampf"] = {},
["killingblow"] = {},
["leben"] = {},
["mana"] = {},
["mount"] = {},
["pet"] = {},
},
},
}
local function timer(arg1, arg2)
if GetTime()-gtime[arg1]<arg2 then
return true
else
gtime[arg1]=GetTime()
return nil
end
end
function BossTalk:OnCmd(arg1)
if arg1=="" then
BossTalk:OnFuBarClick("LeftButton")
else
local arg1,arg2=string.split(" ", arg1)
if string.lower(arg1)=="shortcut" then
if type(tonumber(arg2))~="number" or type(BossTalk.data[tonumber(arg2)])=="nil" then
BossTalk:Print(L["Validation error."])
else
BossTalk:Play(tonumber(arg2))
end
elseif type(tonumber(arg1))=="number" and type(BossTalk.data[tonumber(arg1)])~="nil" then
BossTalk:Play(tonumber(arg1))
elseif string.lower(arg1)=="search" then
BossTalk:Search(arg2)
elseif string.lower(arg1)=="minimap" and LDB and not IsAddOnLoaded("FuBar") then
if type(tonumber(arg2))~="number" then
dbd.MiniMap.hide = not dbd.MiniMap.hide
BossTalk:ToggleMM(dbd.MiniMap.hide)
else
if tonumber(arg2)>=0 and tonumber(arg2)<=360 then
dbd.MiniMap.minimapPos = tonumber(arg2)
LDBIcon:Refresh("BossTalk", dbd.MiniMap)
else
BossTalk:Print(L["Value must be smaller than 360 and greater than 0!"])
end
end
else
BossTalk:Print(L["Wrong command."])
end
end
end
function BossTalk:OnEnable()
BossTalk:RegisterChatCommand('BossTalk', 'OnCmd')
self:Print("v"..BossTalk.version..L[" loaded."])
end
function BossTalk:GenerateMenu()
local tempZone = {
["Vanilla Events"] = {
type = 'group',
name = "Vanilla Events",
desc = " ",
args = {},
order = 1
},
["Vanilla Dungeons"] = {
type = 'group',
name = "Vanilla Dungeons",
desc = " ",
args = {},
order = 2
},
["Vanilla Raids"] = {
type = 'group',
name = "Vanilla Raids",
desc = " ",
args = {},
order = 3
},
["Burning Crusade Events"] = {
type = 'group',
name = "Burning Crusade Events",
desc = " ",
args = {},
order = 4
},
["Burning Crusade Dungeons"] = {
type = 'group',
name = "Burning Crusade Dungeons",
desc = " ",
args = {},
order = 5
},
["Burning Crusade Raids"] = {
type = 'group',
name = "Burning Crusade Raids",
desc = " ",
args = {},
order = 6
},
["Wrath of the Lich King Events"] = {
type = 'group',
name = "Wrath of the Lich King Events",
desc = " ",
args = {},
order = 7
},
["Wrath of the Lich King Dungeons"] = {
type = 'group',
name = "Wrath of the Lich King Dungeons",
desc = " ",
args = {},
order = 8
},
["Wrath of the Lich King Raids"] = {
type = 'group',
name = "Wrath of the Lich King Raids",
desc = " ",
args = {},
order = 9
},
["Cataclysm Events"] = {
type = 'group',
name = "Cataclysm Events",
desc = " ",
args = {},
order = 10
},
["Cataclysm Unused"] = {
type = 'group',
name = "Cataclysm Unused",
desc = " ",
args = {},
order = 11
},
["Cataclysm Dungeons"] = {
type = 'group',
name = "Cataclysm Dungeons",
desc = " ",
args = {},
order = 12
},
["Cataclysm Raids"] = {
type = 'group',
name = "Cataclysm Raids",
desc = " ",
args = {},
order = 13
},
["Mists of Pandaria Events"] = {
type = 'group',
name = "Mists of Pandaria Events",
desc = " ",
args = {},
order = 14
},
["Mists of Pandaria Unused"] = {
type = 'group',
name = "Mists of Pandaria Unused",
desc = " ",
args = {},
order = 15
},
["Mists of Pandaria Scenarios"] = {
type = 'group',
name = "Mists of Pandaria Scenarios",
desc = " ",
args = {},
order = 16
},
["Mists of Pandaria Dungeons"] = {
type = 'group',
name = "Mists of Pandaria Dungeons",
desc = " ",
args = {},
order = 17
},
["Mists of Pandaria Raids"] = {
type = 'group',
name = "Mists of Pandaria Raids",
desc = " ",
args = {},
order = 18
},
["Warlords of Draenor Events"] = {
type = 'group',
name = "Warlords of Draenor Events",
desc = " ",
args = {},
order = 19
},
["Warlords of Draenor Unused"] = {
type = 'group',
name = "Warlords of Draenor Unused",
desc = " ",
args = {},
order = 20
},
["Warlords of Draenor Scenarios"] = {
type = 'group',
name = "Warlords of Draenor Scenarios",
desc = " ",
args = {},
order = 21
},
["Warlords of Draenor Dungeons"] = {
type = 'group',
name = "Warlords of Draenor Dungeons",
desc = " ",
args = {},
order = 22
},
["Warlords of Draenor Raids"] = {
type = 'group',
name = "Warlords of Draenor Raids",
desc = " ",
args = {},
order = 23
},
["Class Trials"] = {
type = 'group',
name = "Class Trials",
desc = " ",
args = {},
order = 24
},
["Artifact"] = {
type = 'group',
name = "Artifact",
desc = " ",
args = {},
order = 25
},
["Class Campaign"] = {
type = 'group',
name = "Class Campaign",
desc = " ",
args = {},
order = 26
},
["Legion Events"] = {
type = 'group',
name = "Legion Events",
desc = " ",
args = {},
order = 27
},
["Legion Outdoor World"] = {
type = 'group',
name = "Legion Outdoor World",
desc = " ",
args = {},
order = 28
},
["Legion World Quests"] = {
type = 'group',
name = "Legion World Quests",
desc = " ",
args = {},
order = 29
},
["Legion Scenarios"] = {
type = 'group',
name = "Legion Scenarios",
desc = " ",
args = {},
order = 30
},
["Legion Dungeons"] = {
type = 'group',
name = "Legion Dungeons",
desc = " ",
args = {},
order = 31
},
["Legion Raids"] = {
type = 'group',
name = "Legion Raids",
desc = " ",
args = {},
order = 32
},
["Battle for Azeroth Events"] = {
type = 'group',
name = "Battle for Azeroth Events",
desc = " ",
args = {},
order = 33
},
["Battle for Azeroth Outdoor World"] = {
type = 'group',
name = "Battle for Azeroth Outdoor World",
desc = " ",
args = {},
order = 34
},
["Battle for Azeroth World Quests"] = {
type = 'group',
name = "Battle for Azeroth World Quests",
desc = " ",
args = {},
order = 35
},
["Battle for Azeroth Scenarios"] = {
type = 'group',
name = "Battle for Azeroth Scenarios",
desc = " ",
args = {},
order = 36
},
["User"] = {
type = 'group',
name = L["User Yells"],
desc = " ",
args = {
["World"] = {
type = 'group',
name = L["World"],
desc = " ",
args = {},
order = 1
},
["Instance"] = {
type = 'group',
name = L["Instance"],
desc = " ",
args = {},
order = 2
},
["Sync"] = {
type = 'text',
name = L["|cffff8800Send to player|r"],
desc = L["Enter the name of another BossTalk user to send him your collected yells. This may take a while!"],
usage = "<name>",
order = 3,
get = false,
set = function(id)
if id=="" or id==" " then return end
id = string.gsub(id, "(%w)(%w*)", function(FirstLetter, Rest) return string.upper(FirstLetter)..string.lower(Rest) end)
local pack=""
for i=1,#dbd.useryell do
if dbd.useryell[i] then
if i==#dbd.useryell then
pack="F|"..dbd.useryell[i].boss.."|"..dbd.useryell[i].zone.."|"..dbd.useryell[i].text.."|"..dbd.useryell[i].w.."|"..tostring(#dbd.useryell-i).."|"..GetLocale()
else
pack="G|"..dbd.useryell[i].boss.."|"..dbd.useryell[i].zone.."|"..dbd.useryell[i].text.."|"..dbd.useryell[i].w.."|"..tostring(#dbd.useryell-i).."|"..GetLocale()
end
BossTalk:SendCommMessage("BossTalkComm", pack, "WHISPER", id, "BULK")
BossTalk:Print(L["Sending quote "]..i.."/"..#dbd.useryell.."...")
end
end
end,
},
["sync"]= {
type = 'execute',
name = L["|cffff8800Delete double entrys|r"],
desc = " ",
func = function()
for k,v in pairs(BossTalk.data) do
for i=1,BossTalk:tcount(dbd.useryell) do
if dbd.useryell[i] then
if dbd.useryell[i].text==v.text then
for u=i, BossTalk:tcount(dbd.useryell)-1 do
dbd.useryell[u]=dbd.useryell[u+1];
end
dbd.useryell[BossTalk:tcount(dbd.useryell)]=nil;
end
end
end
end
ReloadUI()
end,
order=4,
}
},
order = 37
},
}
local function wowcheck(arg1)
if(arg1 == "ve") then return "Vanilla Events" end
if(arg1 == "vd") then return "Vanilla Dungeons" end
if(arg1 == "vr") then return "Vanilla Raids" end
if(arg1 == "be") then return "Burning Crusade Events" end
if(arg1 == "bd") then return "Burning Crusade Dungeons" end
if(arg1 == "br") then return "Burning Crusade Raids" end
if(arg1 == "we") then return "Wrath of the Lich King Events" end
if(arg1 == "wd") then return "Wrath of the Lich King Dungeons" end
if(arg1 == "wr") then return "Wrath of the Lich King Raids" end
if(arg1 == "ce") then return "Cataclysm Events" end
if(arg1 == "cu") then return "Cataclysm Unused" end
if(arg1 == "cd") then return "Cataclysm Dungeons" end
if(arg1 == "cr") then return "Cataclysm Raids" end
if(arg1 == "pe") then return "Mists of Pandaria Events" end
if(arg1 == "pu") then return "Mists of Pandaria Unused" end
if(arg1 == "ps") then return "Mists of Pandaria Scenarios" end
if(arg1 == "pd") then return "Mists of Pandaria Dungeons" end
if(arg1 == "pr") then return "Mists of Pandaria Raids" end
if(arg1 == "de") then return "Warlords of Draenor Events" end
if(arg1 == "du") then return "Warlords of Draenor Unused" end
if(arg1 == "ds") then return "Warlords of Draenor Scenarios" end
if(arg1 == "dd") then return "Warlords of Draenor Dungeons" end
if(arg1 == "dr") then return "Warlords of Draenor Raids" end
if(arg1 == "ct") then return "Class Trials" end
if(arg1 == "ar") then return "Artifact" end
if(arg1 == "cc") then return "Class Campaign" end
if(arg1 == "le") then return "Legion Events" end
if(arg1 == "low") then return "Legion Outdoor World" end
if(arg1 == "lwq") then return "Legion World Quests" end
if(arg1 == "ls") then return "Legion Scenarios" end
if(arg1 == "ld") then return "Legion Dungeons" end
if(arg1 == "lr") then return "Legion Raids" end
if(arg1 == "ae") then return "Battle for Azeroth Events" end
if(arg1 == "aow") then return "Battle for Azeroth Outdoor World" end
if(arg1 == "awq") then return "Battle for Azeroth World Quests" end
if(arg1 == "as") then return "Battle for Azeroth Scenarios" end
end
for i=1, #self.data do
if(self.data[i]) then
if(not tempZone[wowcheck(self.data[i].w)].args[self.data[i].zone]) then
tempZone[wowcheck(self.data[i].w)].args[self.data[i].zone] = {
type = 'group',
name = self.data[i].zone,
desc = self.data[i].zone,
args = {},
}
end
if(not tempZone[wowcheck(self.data[i].w)].args[self.data[i].zone].args[self.data[i].boss]) then
tempZone[wowcheck(self.data[i].w)].args[self.data[i].zone].args[self.data[i].boss] = {
type = 'group',
name = self.data[i].boss,
desc = self.data[i].boss,
args = {},
}
end
local yell
if(not tempZone[wowcheck(self.data[i].w)].args[self.data[i].zone].args[self.data[i].boss].args[self.data[i].text]) then
yell = string.sub(self.data[i].text, 0, 15)
if(string.len(self.data[i].text) > 15) then
yell = yell.."..."
end
tempZone[wowcheck(self.data[i].w)].args[self.data[i].zone].args[self.data[i].boss].args[self.data[i].text] = {
type = 'execute',
name = "|cffff8800[#"..i.."]|r "..yell,
desc = self.data[i].text..L["\n\n|cff7fff7fshift-leftclick|r |cffff8800to add to favorites.|r"],
func = function()
if IsShiftKeyDown() then
local old = BossTalk:tcount(dbd.favoriten)+1
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
dbd.favoriten[old]=self.data[i]
BossTalk:MakeFunk()
else
self:Play(i)
end
end,
}
end
end
end
local function worldcheck(arg1)
if arg1=="1" then return "World" end
if arg1=="2" then return "Instance" end
end
for i=1, #dbd.useryell do
if(dbd.useryell[i]) then
if type(dbd.useryell[i].w)=="nil" then dbd.useryell[i].w = "1" end
if(not tempZone.User.args[worldcheck(dbd.useryell[i].w)].args[dbd.useryell[i].zone]) then
tempZone.User.args[worldcheck(dbd.useryell[i].w)].args[dbd.useryell[i].zone] = {
type = 'group',
name = dbd.useryell[i].zone,
desc = dbd.useryell[i].zone,
args = {},
}
end
if(not tempZone.User.args[worldcheck(dbd.useryell[i].w)].args[dbd.useryell[i].zone].args[dbd.useryell[i].boss]) then
tempZone.User.args[worldcheck(dbd.useryell[i].w)].args[dbd.useryell[i].zone].args[dbd.useryell[i].boss] = {
type = 'group',
name = dbd.useryell[i].boss,
desc = dbd.useryell[i].boss,
args = {},
}
end
local yell
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
yell = string.sub(dbd.useryell[i].text, 0, 15)
if(string.len(dbd.useryell[i].text) > 15) then
yell = yell.."..."
end
tempZone.User.args[worldcheck(dbd.useryell[i].w)].args[dbd.useryell[i].zone].args[dbd.useryell[i].boss].args[dbd.useryell[i].text] = {
type = 'execute',
name = "|cffff8800[#"..i.."]|r "..yell,
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"],
func = function()
if IsShiftKeyDown() then
local old = BossTalk:tcount(dbd.favoriten)+1
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
dbd.favoriten[old]=dbd.useryell[i]
BossTalk:MakeFunk()
elseif IsAltKeyDown() then
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
for u=i, BossTalk:tcount(dbd.useryell)-1 do
dbd.useryell[u]=dbd.useryell[u+1];
end
dbd.useryell[BossTalk:tcount(dbd.useryell)]=nil;
else
self:Play(i,"user")
end
end,
}
end
end
end
self.cmdtable.args.bosses.args = tempZone
tempZone = nil
wowcheck=nil
for i=1,BossTalk:tcount(BossTalk.data) do
BossTalk.data[i].zone=nil
BossTalk.data[i].w=nil
end
end
function BossTalk:tcount(tab)
if(tab == nil) then
return 0
end
local n=0
for _ in pairs(tab) do
n=n+1
end
return n
end
function BossTalk:IgnorePlayer(who)
local who = string.upper(string.sub(who, 1,1))..string.lower(string.sub(who,2,string.len(who)))
local check = 0
local notallowed={"%p", "%c", "%d", "%s", "!", "?", "&", "/", "%(", "%)", "%.", "%%", "%+", "%-", "%*", "%?", "%[", "%^,", "%$",}
for i=1,BossTalk:tcount(notallowed) do
if string.find(who, notallowed[i]) ~= nil then check = 1 end
end
if check == 1 or string.len(who)<2 then
BossTalk:Print(L["You entered an invalid name."])
return
end
for z=1,BossTalk:tcount(dbd.ignoppl) do
if dbd.ignoppl[z] == who then
BossTalk:Print(L["Player is already in list!"])
return
end
end
dbd.ignoppl[#dbd.ignoppl+1]=who
BossTalk:Print(who..L[" is now being ignored."])
BossTalk:MakeIgno()
end
function BossTalk:TextOut(text, arg2)
if arg2 ~= "sync" then
if dbd.text then
if dbd.howo == "EMOTE" then
SendChatMessage(L[" quotes "]..arg2..": \""..text.."\"", dbd.howo)
else
SendChatMessage(text, dbd.howo)
end
end
if dbd.otheroutput then
UIErrorsFrame:AddMessage(text, 1.0, 0.2, 0.2, 1, 5);
DEFAULT_CHAT_FRAME:AddMessage(text, 1.0, 0.2, 0.2, 1, 5);
end
elseif arg2 == "sync" and dbd.othersyncoutput then
UIErrorsFrame:AddMessage(text, 1.0, 0.2, 0.2, 1, 5);
DEFAULT_CHAT_FRAME:AddMessage(text, 1.0, 0.2, 0.2, 1, 5);
end
end
function BossTalk:OnDisable()
BossTalk:Show()
if self:IsMinimapAttached() == true then
self:ToggleMinimapAttached()
end
self:Print("BossTalk reset")
end
function BossTalk.SetItemRef(link, text, button)
if ( strsub(link, 1, 3) == "bTs" ) then
if button == "LeftButton" then
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")
return;
else
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, },
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,},
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,},
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,},},}
BTchat:Register("BossTalkChatFrame", 'children', function()
BTchat:FeedAceOptionsTable(BossTalk.searchcmd) end )
BTchat:Open("BossTalkChatFrame", 'cursorX', true, 'cursorY', true)
BTchat:Unregister("BossTalkChatFrame")
return;
end
end
BossTalk.SetItemRef_Original(link, text, button);
end
function BossTalk:Search(phrase)
if string.len(phrase) < 3 then
BossTalk:Print("|cffff3333"..L["Please enter 3 or more letters!"].."|r")
return
end
local searchcount = 0
DEFAULT_CHAT_FRAME:AddMessage("|cffB954FF"..L["BossTalk search results for \""]..phrase.."\":|r")
for i=1,BossTalk:tcount(BossTalk.data) do
if string.find(string.upper(BossTalk.data[i].text), string.upper(phrase)) ~= nil then
searchcount = searchcount + 1
local a, b = string.find(string.upper(BossTalk.data[i].text), string.upper(phrase))
if type(BossTalk.data[i].zone) == "nil" then
DEFAULT_CHAT_FRAME:AddMessage("|cffffff00"..BossTalk.data[i].boss..":|r")
else
DEFAULT_CHAT_FRAME:AddMessage("|cffffff00"..BossTalk.data[i].boss.." in "..BossTalk.data[i].zone..":|r")
end
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")
end
end
DEFAULT_CHAT_FRAME:AddMessage("|cffB954FF"..searchcount..L[" matches.|r"])
end
function BossTalk_UnitPopup_OnClick(self)
if self.value == "BOSSTALK_IGNORE" then
BossTalk:IgnorePlayer(getglobal(UIDROPDOWNMENU_INIT_MENU).name)
end
BossTalk_Old_UnitPopup_OnClick(self);
end
function BossTalk:AddEvent(id, welches, arg2)
local nummer = BossTalk:tcount(dbd.events[welches])+1
dbd.events[welches][nummer]= BossTalk.data[id]
BossTalk:MakeEvent(welches, arg2)
end
function BossTalk:MakeEvent(arg1,arg2)
temp = {}
local qt
spamcount[arg1]=0
if not self.cmdtable.args.events.args[arg1] or arg2 then
qt=true
if not dbd.eventspam[arg1] then dbd.eventspam[arg1]=1 end
self.cmdtable.args.events.args[arg1]={
type = "group",
name = arg1,
desc = L["Quotes a boss when "]..L["you perform a "]..arg1,
args = {},
}
temp[2]= {
type = 'execute',
name = L["Delete event"],
desc = " ",
func = function()
self.cmdtable.args.events.args[arg1]=nil
dbd.events[arg1]=nil
end,
order = 2,
icon = "Interface\\Icons\\Spell_ChargeNegative",
}
end
temp[1] = {
type = 'text',
name = L["Add Quote"],
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"],
usage = "<id>",
pass = true,
error = L["ID not found!"],
order = 1,
message = "Quote added.",
get = false,
set = function(id) BossTalk:AddEvent(tonumber(id), arg1,qt) end,
validate = function(id) return BossTalk.data[tonumber(id)] end,
icon = "Interface\\Icons\\Spell_ChargePositive",
}
if arg1 == "leben" or arg1 == "mana" then
local iscrap = 1
temp[2] = {
type = 'range',
name = L["Percent"],
desc = L["Set the trigger to a percentage"],
get = function() return dbd[arg1] end,
set = function(v) dbd[arg1] = v end,
min = 0.05,
max = 1,
step = 0.01,
isPercent = true,
order = 2,
}
end
if arg1 ~= "leben" and arg1 ~= "mana" then
temp[3] = {
name = L["Event frequency"],
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."],
get = function() return dbd.eventspam[arg1] end,
set = function(v) dbd.eventspam[arg1] = v end,
usage = "<number>",
type = 'range',
max = 15,
min = 1,
step = 1,
order = 3,
}
end
for i=1, BossTalk:tcount(dbd.events[arg1]) do
if(dbd.events[arg1][i]) then
yell = string.sub(dbd.events[arg1][i].text, 0, 15)
if(string.len(dbd.events[arg1][i].text) > 15) then
yell = yell.."..."
end
temp[i+4] = {
type = 'execute',
name = "|cff7fff7f"..tostring(i)..")|r "..yell,
desc = dbd.events[arg1][i].text..L[" \n\n|cff7fff7fshift-leftclick|r |cffff8800to delete entry|r"],
func = function()
if IsShiftKeyDown() then
for u=i, BossTalk:tcount(dbd.events[arg1])-1 do
dbd.events[arg1][u]=dbd.events[arg1][u+1];
end
dbd.events[arg1][BossTalk:tcount(dbd.events[arg1])]=nil;
BossTalk:MakeEvent(arg1,arg2)
else
BossTalk:Play(i,"event",arg1)
end
end,
order = i+10,
}
end
end
self.cmdtable.args.events.args[arg1].args = temp
temp = {}
end
function BossTalk:MakeFunk()
local temp = {}
temp[1] = {
type = 'execute',
name = L[" \n |cffffff00Clear favorites|r \n "],
desc = L["Resets your favorites."],
func = function() dbd.favoriten = {} BossTalk:MakeFunk() end,
icon = "Interface\\Icons\\Spell_ChargePositive",
order = 1,
}
for i=1, BossTalk:tcount(dbd.favoriten) do
if(dbd.favoriten[i]) then
yell = string.sub(dbd.favoriten[i].text, 0, 15)
if(string.len(dbd.favoriten[i].text) > 15) then
yell = yell.."..."
end
temp[i+1] = {
type = 'execute',
name = "|cff7fff7f"..tostring(i)..")|r "..yell,
desc = dbd.favoriten[i].text..L[" \n\n|cff7fff7fshift-leftclick|r |cffff8800to delete entry|r"],
func = function()
if IsShiftKeyDown() then
for u=i, BossTalk:tcount(dbd.favoriten)-1 do
dbd.favoriten[u]=dbd.favoriten[u+1];
end
dbd.favoriten[BossTalk:tcount(dbd.favoriten)]=nil;
BossTalk:MakeFunk();
else
self:Play(i,"fav")
end
end,
order = i,
}
end
end
self.cmdtable.args.favorites.args = temp
end
function BossTalk:MakeIgno()
local temp = {}
temp[1] = {
type = 'text',
name = L["Add player"],
desc = L["Enter the name of a player you want to ignore. You will no longer receive any sync from that player."],
usage = "<name>",
order = 1,
icon = "Interface\\Icons\\Spell_ChargePositive",
get = false,
set = function(who)
BossTalk:IgnorePlayer(who)
end,
}
for i=1, BossTalk:tcount(dbd.ignoppl) do
temp[i+1] = {
type = 'execute',
name = "|cffff2222"..dbd.ignoppl[i].."|r",
desc = L[" \n\n|cff7fff7fshift-leftclick|r |cffff8800to delete entry|r"],
func = function()
if IsShiftKeyDown() then
for u=i, BossTalk:tcount(dbd.ignoppl)-1 do
dbd.ignoppl[u]=dbd.ignoppl[u+1];
end
dbd.ignoppl[BossTalk:tcount(dbd.ignoppl)]=nil;
BossTalk:MakeIgno();
end
end,
}
end
BossTalk.cmdtable.args.options.args.ignore.args.ignoppl.args = temp
local temp = {}
temp[1] = {
type = 'text',
name = L["Add yell"],
desc = L["Enter the ID of the yell you don't want to receive."],
usage = "<ID>",
order = 1,
icon = "Interface\\Icons\\Spell_ChargePositive",
get = false,
set = function(id)
for z=1,BossTalk:tcount(dbd.ignoyell) do
if dbd.ignoyell[z].id == tonumber(id) then
BossTalk:Print(L["Yell is already in list!"])
return
end
end
dbd.ignoyell[#dbd.ignoyell+1] = { ["id"] = tonumber(id), ["yell"]=BossTalk.data[tonumber(id)].text, ["sound"]=BossTalk.data[tonumber(id)].sound }
BossTalk:MakeIgno()
end,
validate = function(id)
return BossTalk.data[tonumber(id)]
end,
}
for i=1, BossTalk:tcount(dbd.ignoyell) do
local yell = string.sub(dbd.ignoyell[i].yell, 0, 20)
if(string.len(dbd.ignoyell[i].yell) > 20) then
yell = yell.."..."
end
temp[i+1] = {
type = 'execute',
name = "|cffff2222#"..dbd.ignoyell[i].id.."|r |cffffee22"..yell.."|r",
desc = L[" \n\n|cff7fff7fshift-leftclick|r |cffff8800to delete entry|r"],
func = function()
if IsShiftKeyDown() then
for u=i, BossTalk:tcount(dbd.ignoyell)-1 do
dbd.ignoyell[u]=dbd.ignoyell[u+1];
end
dbd.ignoyell[BossTalk:tcount(dbd.ignoyell)]=nil;
BossTalk:MakeIgno();
end
end,
}
end
BossTalk.cmdtable.args.options.args.ignore.args.ignoyell.args = temp
end
function BossTalk:PLAYER_LOGIN()
self:UnregisterEvent("PLAYER_LOGIN")
if LDB and not IsAddOnLoaded("FuBar") then
BossTalkLauncher = LDB:NewDataObject("BossTalk", {
type = "launcher",
icon = "Interface\\Icons\\Spell_Arcane_TeleportShattrath",
OnClick = function(clickedframe, button)
BossTalk:OnFuBarClick(button)
end,
OnTooltipShow = function(tt)
GameTooltip:AddLine("|cffff8800Bosstalk|r".." |cff7fff7fv"..BossTalk.version.."|r");
GameTooltip:AddLine("|cffA843EFby Brellison94")
GameTooltip:AddLine(" ")
GameTooltip:AddLine(L["|cff7fff7fleftclick:|r random quote"])
GameTooltip:AddLine(L["|cff7fff7frightclick:|r show options menu"])
GameTooltip:AddLine(" ")
if dbd.globversion ~= 0 and dbd.globversion > tonumber(BossTalk.version) then
GameTooltip:AddLine("|cffff1111"..L["New BossTalk version!"].."|r")
GameTooltip:AddLine("|cffff1111"..L["You use: "].."|cffffff00v"..tostring(BossTalk.version).."|r")
GameTooltip:AddLine("|cffff1111"..L["Latest version: "].."|cff00ff00v"..tostring(dbd.globversion).."|r")
GameTooltip:AddLine(" ")
end
GameTooltip:AddLine(L["Database: "].."|cff7fff7f"..BossTalk:tcount(BossTalk.data).."|r"..L[" entrys."])
end,
})
if LDBIcon then
LDBIcon:Register("BossTalk", BossTalkLauncher, dbd.MiniMap)
function BossTalk:ToggleMM(value)
if value then LDBIcon:Show("BossTalk") else LDBIcon:Hide("BossTalk") end
LDBIcon:Refresh("BossTalk", dbd.MiniMap)
end
end
end
if LibStub:GetLibrary("LibFuBarPlugin-3.0", true) and IsAddOnLoaded("FuBar") then
local LFBP = LibStub:GetLibrary("LibFuBarPlugin-3.0")
LibStub("AceAddon-3.0"):EmbedLibrary(self, "LibFuBarPlugin-3.0")
BossTalk:SetFuBarOption('tooltipType', "GameTooltip")
BossTalk:SetFuBarOption('iconPath', "Interface\\Icons\\Ability_Druid_Berserk")
BossTalk:SetFuBarOption('hasIcon', true)
BossTalk:SetFuBarOption('configType', "None")
BossTalk:SetFuBarOption("defaultMinimapPosition" , 195)
LFBP:OnEmbedInitialize(self)
function BossTalk:OnUpdateFuBarTooltip()
GameTooltip:AddLine("|cffff8800Bosstalk|r".." |cff7fff7fv"..BossTalk.version.."|r");
GameTooltip:AddLine("|cffA843EFby Yvaine/Endeavour EU Arthas|r update by Brellison94")
GameTooltip:AddLine(" ")
GameTooltip:AddLine(L["|cff7fff7fleftclick:|r random quote"])
if self:IsFuBarMinimapAttached() then
GameTooltip:AddLine(L["|cff7fff7fhold left button:|r move button"]);
end
GameTooltip:AddLine(L["|cff7fff7frightclick:|r show options menu"])
GameTooltip:AddLine(" ")
if dbd.globversion ~= 0 and dbd.globversion > tonumber(BossTalk.version) then
GameTooltip:AddLine("|cffff1111"..L["New BossTalk version!"].."|r")
GameTooltip:AddLine("|cffff1111"..L["You use: "].."|cffffff00v"..tostring(BossTalk.version).."|r")
GameTooltip:AddLine("|cffff1111"..L["Latest version: "].."|cff00ff00v"..tostring(dbd.globversion).."|r")
GameTooltip:AddLine(" ")
end
GameTooltip:AddLine(L["Database: "].."|cff7fff7f"..BossTalk:tcount(BossTalk.data).."|r"..L[" entrys."])
end
BossTalk:Show()
end
end
function BossTalk:OnFuBarClick(button)
if button == "LeftButton" then
local zufall = random(#BossTalk.data)
BossTalk:Play(zufall)
elseif button =="RightButton" then
if BTchat:IsRegistered("BossTalkMenu")~=true then
BTchat:Register("BossTalkMenu", 'children', function()
BTchat:FeedAceOptionsTable(BossTalk.cmdtable) end )
end
BTchat:Open("BossTalkMenu", 'cursorX', true, 'cursorY', true)
end
end
function BossTalk:OnInitialize()
BossTalk.db = LibStub('AceDB-3.0'):New('BossTalkDBX')
BossTalk.db:RegisterDefaults(defaults)
dbd = BossTalk.db.global
BossTalk:RegisterComm("BossTalkComm")
self:RegisterEvent("PLAYER_ALIVE")
self:RegisterEvent("PLAYER_UNGHOST")
self:RegisterEvent("CHAT_MSG_MONSTER_YELL")
self:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")
self:RegisterEvent("UNIT_HEALTH")
self:RegisterEvent("UNIT_MANA")
self:RegisterEvent("PET_ATTACK_START")
self:RegisterEvent("DUEL_REQUESTED")
self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:RegisterEvent("PLAYER_LOGIN")
BossTalk.SetItemRef_Original = SetItemRef
SetItemRef = BossTalk.SetItemRef
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."]
UnitPopupButtons["BOSSTALK_IGNORE"] = { text = "|cffffff22BossTalk:|r |cffff6666Ignore|r", dist = 0, space = 1 };
table.insert(UnitPopupMenus["CHAT_ROSTER"],#UnitPopupMenus["CHAT_ROSTER"]-1, "BOSSTALK_IGNORE")
table.insert(UnitPopupMenus["FRIEND"],#UnitPopupMenus["FRIEND"]-1, "BOSSTALK_IGNORE")
table.insert(UnitPopupMenus["PARTY"],#UnitPopupMenus["PARTY"]-1, "BOSSTALK_IGNORE")
table.insert(UnitPopupMenus["RAID_PLAYER"],#UnitPopupMenus["RAID_PLAYER"]-1, "BOSSTALK_IGNORE")
BossTalk_Old_UnitPopup_OnClick = UnitPopup_OnClick
UnitPopup_OnClick = BossTalk_UnitPopup_OnClick
BossTalk:GenerateSync()
for k,_ in pairs(dbd.events) do
BossTalk:MakeEvent(k)
end
BossTalk:MakeFunk()
BossTalk:MakeIgno()
BossTalk.cmdtable.args.options.args.syncopt.args.showsync.args.eigener.name = UnitName("player").." v|cff00ff00"..tostring(BossTalk.version).."|r"
BossTalk.buffcheckframe=CreateFrame("frame")
BossTalk.buffcheckframe:SetScript('OnUpdate', function() if not timer("mount",1) then BossTalk:MountCheck() end end)
end
function BossTalk:SendMessage(arg1, arg2, arg3)
arg1=tostring(arg1)
arg2=tostring(arg2)
arg3=tostring(arg3)
if arg1 == "X" then
BossTalk:SendCommMessage("BossTalkComm", "X|X|X|"..BossTalk.version.."|"..GetLocale(), "GUILD", nil, "BULK")
end
if dbd.sendsync == false and arg3 ~= "event" then
return
end
if dbd.sendsyncevent == false and arg3 == "event" then
return
end
BossTalk:SendCommMessage("BossTalkComm", arg1.."|"..arg2.."|"..arg3.."|"..BossTalk.version.."|"..GetLocale(), "RAID", nil, "BULK")
BossTalk:SendCommMessage("BossTalkComm", arg1.."|"..arg2.."|"..arg3.."|"..BossTalk.version.."|"..GetLocale(), "PARTY", nil, "BULK")
end
function BossTalk:VersionCheck(version, player, loc)
if player==UnitName("player") or tonumber(version) == nil then
return
end
loc=loc or "?"
if tonumber(version) > tonumber(BossTalk.version) and tonumber(version) > dbd.globversion then
dbd.globversion = tonumber(version)
BossTalk:Print("|cffff1111"..L["New BossTalk version!"].."|r")
BossTalk:Print("|cffff1111"..L["You use: "].."|cffffff00v"..tostring(BossTalk.version).."|r")
BossTalk:Print("|cffff1111"..L["Latest version: "].."|cff00ff00v"..tostring(dbd.globversion).."|r")
end
for i=1, #self.cmdtable.args.options.args.syncopt.args.showsync.args do
if string.find(self.cmdtable.args.options.args.syncopt.args.showsync.args[i].name, player) ~= nil then
return
end
end
if tonumber(version) == tonumber(BossTalk.version) then
version = "|cff00ff00"..tostring(version).."|r"
descri = player..L[" and you are running the same version."]
elseif tonumber(version) > tonumber(BossTalk.version) then
version = "|cffff0000"..tostring(version).."|r"
descri = player..L[" has a newer version!\nYou should update BossTalk!"]
elseif tonumber(version) < tonumber(BossTalk.version) then
version = "|cffffff00"..tostring(version).."|r"
descri = player..L[" has an outdated Version.\nTell him to update BossTalk!"]
end
self.cmdtable.args.options.args.syncopt.args.showsync.args[#self.cmdtable.args.options.args.syncopt.args.showsync.args+1] ={
type = 'execute',
name = player.." v"..version.." "..loc,
desc = descri,
func = function() end,
}
local anzahl = BossTalk:tcount(self.cmdtable.args.options.args.syncopt.args.showsync.args)-2
self.cmdtable.args.options.args.syncopt.args.showsync.args.wieviele = {
type = 'header',
name = "|cffffff00"..tostring(anzahl).."|r "..L[" entrys."],
order = 2,
},
table.sort(self.cmdtable.args.options.args.syncopt.args.showsync.args, function(a,b) return a["name"] < b["name"] end)
end
function BossTalk:OnCommReceived(caller, data, _, sender)
if sender==UnitName("player") then
return
end
local arg1,arg2,arg3,arg4,arg5,arg6,arg7 = string.split("|", data)
if arg1=="G" or arg1== "F" then
arg7=tostring(arg7)
if arg7~=GetLocale() and dbd.synclocale~=false then if dbd.syncsilent==false then BossTalk:Print(L["Sync blocked."].." "..arg7.."!="..GetLocale()) end return end
for i=1,#dbd.useryell do
if dbd.useryell[i].text==tostring(arg4) then
if dbd.syncsilent==false then
BossTalk:Print(L["Quote already in DB, skipped. "]..tostring(arg6))
end
return
end
end
dbd.useryell[#dbd.useryell+1]={["boss"]=tostring(arg2), ["zone"]=tostring(arg3), ["text"]=tostring(arg4), ["w"]=tostring(arg5), ["sound"]=""}
if dbd.syncsilent==false then
BossTalk:Print(sender..": "..tostring(arg2)..", "..tostring(arg6)..L[" quotes remaining."])
end
if arg1=="F" then BossTalk:Print(L["Synchronisation completed. Reload your UI in order to activate the new quotes."]) end
table.sort(BossTalk.db.global.useryell, function(a,b)
if(a["w"] ~= b["w"]) then
return tonumber(a["w"]) < tonumber(b["w"])
else
if(a["zone"] ~= b["zone"]) then
return a["zone"] < b["zone"]
else
if(a["boss"] ~= b["boss"]) then
return a["boss"] < b["boss"]
else
return a["text"] < b["text"]
end
end
end
end)
return
end
if arg4==nil then
arg4=0
end
BossTalk:VersionCheck(arg4, sender, arg5)
if arg1=="Y" then
return
end
if arg1=="X" then
BossTalk:SendCommMessage("BossTalkComm", "Y|X|X|"..tostring(BossTalk.version).."|"..GetLocale(), "WHISPER", sender, "BULK")
return
end
if (arg3 == "event" and dbd.syncevent == false) or (dbd.sync == false and arg3 ~= "event") then
return
end
if timer("sync", 5) then return end
for i=1,BossTalk:tcount(dbd.ignoppl) do
if sender == dbd.ignoppl[i] then
BossTalk:Print(L["Sync blocked."].." "..sender)
return
end
end
self:Print(sender..L[" quotes "].."|cffffff00"..arg1.."|r")
if arg3=="user" then
BossTalk:TextOut(arg2, "sync")
else
if arg2=="" then return end
for i=1,BossTalk:tcount(dbd.ignoyell) do
if arg2 == dbd.ignoyell[i].sound then
BossTalk:Print(L["Sync blocked."].."(#"..dbd.ignoyell[i].id.." "..string.sub(dbd.ignoyell[i].yell, 0, 20)..")")
return
end
end
if dbd.sound then
PlaySoundFile("Sound\\Creature\\"..arg2..".ogg")
end
for k=1,BossTalk:tcount(BossTalk.data) do
if string.find(BossTalk.data[k].sound, arg2) ~= nil then
BossTalk:TextOut(BossTalk.data[k].text, "sync")
end
end
end
end
function BossTalk:GenerateSync()
self.cmdtable.args.options.args.syncopt.args.showsync.args = nil
self.cmdtable.args.options.args.syncopt.args.showsync.args = {
listemachen = {
type = 'execute',
name = L[" \n |cffffff00Update List!|r \n "],
desc = L["Updates the user list."],
func = function() BossTalk:GenerateSync() end,
icon = "Interface\\Icons\\Spell_ChargePositive",
order = 1,
},
wieviele = {
type = 'header',
name = "|cff00ff00"..tostring(BossTalk:tcount(self.cmdtable.args.options.args.syncopt.args.showsync.args)+1).."|r "..L[" entrys."],
order = 2,
},
eigener = {
type = 'execute',
name = UnitName("player").." v|cff00ff00"..tostring(BossTalk.version).."|r".." "..GetLocale(),
desc = L["Guess who's that! :-)"],
func = function() end,
order = 3,
},
}
BossTalk:SendMessage("X", "X", "X")
end
function BossTalk:Play(id, arg2, arg3)
local M
if arg2 == "fav" then
M = dbd.favoriten[id]
elseif arg2 == "event" then
M = dbd.events[arg3][id]
elseif arg2 == "user" then
M = dbd.useryell[id]
M.sound="N2O"
else
M = self.data[id]
end
if arg2 ~= "event" then
self:Print(L["Quoted from "].."|cffffff00"..M.boss.."|r")
end
BossTalk:TextOut(M.text,M.boss)
if dbd.sound then
PlaySoundFile("Sound\\Creature\\"..M.sound..".ogg")
end
if arg2 == "event" then
self:SendMessage(M.boss,M.sound,"event")
elseif arg2 == "user" then
self:SendMessage(M.boss,M.text,"user")
else
self:SendMessage(M.boss,M.sound,"normal")
end
end
function BossTalk:COMBAT_LOG_EVENT_UNFILTERED(_, _, etype, _, srcGUID, _, sourceFlags, sourecRaidFlags, _, _, _, _, spellID, spellName, _, amount)
if srcGUID~=UnitGUID("player") then return end
if etype == "PARTY_KILL" then
if BossTalk:tcount(dbd.events.killingblow) == 0 then return end
if (bit.band(sourceFlags, COMBATLOG_OBJECT_AFFILIATION_MINE) == COMBATLOG_OBJECT_AFFILIATION_MINE) then
spamcount["killingblow"]=spamcount["killingblow"]+1
if spamcount["killingblow"] < dbd.eventspam.killingblow then return end
spamcount["killingblow"] = 0
local zufall = random(BossTalk:tcount(dbd.events.killingblow))
BossTalk:Play(zufall,"event","killingblow")
end
elseif etype=="SPELL_CAST_SUCCESS" and dbd.events[spellName] then
if BossTalk:tcount(dbd.events[spellName]) == 0 then return end
spamcount[spellName]=spamcount[spellName]+1
if spamcount[spellName] < dbd.eventspam[spellName] then return end
spamcount[spellName] = 0
local zufall = random(#dbd.events[spellName])
BossTalk:Play(zufall,"event",spellName)
end
end
function BossTalk:DUEL_REQUESTED()
spamcount["duell"]=spamcount["duell"]+1
if spamcount["duell"] < dbd.eventspam.duell then return end
spamcount["duell"] = 0
if BossTalk:tcount(dbd.events.duell) == 0 then return end
local zufall = random(BossTalk:tcount(dbd.events.duell))
BossTalk:Play(zufall,"event","duell")
end
function BossTalk:MountCheck()
if IsMounted() == 1 and UnitOnTaxi("player") == nil and BossTalk:tcount(dbd.events.mount) ~= 0 then
if mounty == 0 then
mounty = 1
spamcount["mount"]=spamcount["mount"]+1
if spamcount["mount"] < dbd.eventspam.mount then return end
spamcount["mount"] = 0
local zufall = random(BossTalk:tcount(dbd.events.mount))
BossTalk:Play(zufall,"event","mount")
end
else
mounty = 0
end
end
function BossTalk:PET_ATTACK_START()
spamcount["pet"]=spamcount["pet"]+1
if spamcount["pet"] < dbd.eventspam.pet then return end
spamcount["pet"] = 0
if BossTalk:tcount(dbd.events.pet) == 0 then return end
local zufall = random(BossTalk:tcount(dbd.events.pet))
BossTalk:Play(zufall,"event","pet")
end
function BossTalk:PLAYER_ALIVE()
BossTalk:PLAYER_UNGHOST()
end
function BossTalk:PLAYER_UNGHOST()
gradlebendig = 1
end
function BossTalk:UNIT_HEALTH()
if gradlebendig == 1 and (UnitHealth("player")/UnitHealthMax("player"))*100 < 35 then return end
gradlebendig = 0
if BossTalk:tcount(dbd.events.leben) == 0 then return end
if (UnitHealth("player")/UnitHealthMax("player"))*100 <= (dbd.leben*100) and (UnitHealth("player")/UnitHealthMax("player"))*100 > 1 then
if lifedone == 0 then
lifedone = 1
local zufall = random(BossTalk:tcount(dbd.events.leben))
BossTalk:Play(zufall,"event","leben")
end
else
lifedone = 0
end
end
function BossTalk:UNIT_MANA()
if gradlebendig == 1 and (UnitMana("player")/UnitManaMax("player"))*100 < 35 then return end
gradlebendig = 0
if BossTalk:tcount(dbd.events.mana) == 0 then return end
if (UnitMana("player")/UnitManaMax("player"))*100 < (dbd.mana*100)+1 and (UnitMana("player")/UnitManaMax("player"))*100 > 1 then
if manadone == false then
manadone = true
local zufall = random(BossTalk:tcount(dbd.events.mana))
BossTalk:Play(zufall,"event","mana")
end
else
manadone = false
end
end
function BossTalk:CHAT_MSG_MONSTER_WHISPER(dist, yell, boss)
if boss==nil then
boss="UNKNOWN"
end
if yell==nil then
yell="UNKNOWN"
end
BossTalk:CHAT_MSG_MONSTER_YELL(nil, yell, boss)
end
function BossTalk:CHAT_MSG_MONSTER_YELL(dist, yell, boss)
local inInstance, instanceType = IsInInstance()
local zony = tostring(GetRealZoneText())
if zony == nil then
zony = tostring(GetZoneText())
end
if zony == nil then
zony = tostring(GetMinimapZoneText())
end
if zony == nil then
zony = "UNKNOWN"
end
local typol="2"
if ( (inInstance ~= 1) or (instanceType ~= "raid" and instanceType ~= "party") ) then
typol="1"
end
if( ((dbd.yelllog ~= true) and (typol=="2")) or ((dbd.worldlog ~= true) and (typol=="1")) ) then
for i=1,BossTalk:tcount(dbd.useryell) do
if type(dbd.useryell[i].text) ~= "nil" then
if dbd.useryell[i].text == yell then
return
end
end
end
dbd.useryell[BossTalk:tcount(dbd.useryell)+1]={["boss"]=boss, ["zone"]=zony, ["text"]=yell, ["w"]=typol, ["sound"]=""}
BossTalk:Print(L["New yell collected!"])
end
end
function BossTalk:PLAYER_REGEN_DISABLED()
if BossTalk:tcount(dbd.events.kampf) == 0 then return end
spamcount["kampf"]=spamcount["kampf"]+1
if spamcount["kampf"] < dbd.eventspam.kampf then return end
spamcount["kampf"] = 0
local zufall = random(#dbd.events.kampf)
BossTalk:Play(zufall,"event","kampf")
end