Rewrite to use new LibCombatlog

This commit is contained in:
Robin 2021-01-15 22:53:54 +01:00
commit 1c9120f5e6
8 changed files with 230 additions and 0 deletions

6
.gitmodules vendored Normal file
View File

@ -0,0 +1,6 @@
[submodule "Common"]
path = Common
url = https://git.grml.de/rilgamon/Common.git
[submodule "LibCombatlog"]
path = LibCombatlog
url = https://git.grml.de/rilgamon/LibCombatlog.git

1
Common Submodule

@ -0,0 +1 @@
Subproject commit 762c59c6c6abc6ecaa71f3e36bb2c6dd16b8e0ed

1
LibCombatlog Submodule

@ -0,0 +1 @@
Subproject commit 1d4200bd9820474cae49c5ef26fb42e3eb621b5b

22
README.md Normal file
View File

@ -0,0 +1,22 @@
# zz_Taunted
Taunted is a broker to display taunts and failed taunts.
Written mainly to see when I have to go slowly with my hunters pet
But it helps on real tanks, too that fail on a taunt or to see why the
damn dd gets aggro without doing enough damage to justify that :P
Supported taunts:
- Warrior Taunt, Challenging Roar
- Death Knight Death Grip, Dark Command
- Paladin Hand of Reckoning, Righteous Defense
- Druid Growl, Challenging Roar
- Hunter Distracting Shot
- Hunter Pet Growl Rank 1-9
- Warlock Challenging Howl
- Warlock Pet Torment Rank 1-8, Suffering rank 1-8
- Monk Provokate,Glyph
- Demon Hunter Torment
#### Links
[Releases](https://git.grml.de/rilgamon/zz_Taunted/releases "Releases") | [Source](https://git.grml.de/rilgamon/zz_Taunted "Source") | [Bugs&Comments](https://git.grml.de/rilgamon/zz_Taunted/issues "Bugs&Comments") | [Donate](https://liberapay.com/bundesloser "Donate") | [Contact](https://mastodon.grml.de/@robin "Contact")

BIN
icon2.tga Normal file

Binary file not shown.

6
license.txt Normal file
View File

@ -0,0 +1,6 @@
The following license excludes the libraries (Libs) included. See the libraries directory or website.
This AddOn is public domain. That means you can change it, rename it or paint it yellow.
My name (Rilgamon) is valid only for WoWInterface.com and curse.com.
If you use/offer this addon on another website please remove my name.
If you want to give me credit you can replace it with a link to my profile on WoWInterface.com.

186
taunted.lua Normal file
View File

@ -0,0 +1,186 @@
local name, addon = ...
local tank = UnitName("player")
local L = GetLocale() == 'deDE' and {
['New Tank'] = function(tank)
return string.format("Neuer Tank: |cffffff00%s|r",tank)
end,
["Taunted Fail"] = function(src,dest,spell)
dest = dest or ""
return string.format("|cffff0000Achtung!|r Spott von %s auf %s fehlgeschlagen (%s).",src or "",dest or "",spell or "")
end,
["Taunted"] = function(src,dest,spell)
dest = dest or ""
return string.format("%s hat %s mit %s gespottet.",src,dest,spell)
end,
['Tank'] = "Tank",
} or {
['New Tank'] = function(tank)
return string.format("New Tank: |cffffff00%s|r",tank)
end,
["Taunted Fail"] = function(src,dest,spell)
dest = dest or ""
return string.format("|cffff0000Danger!|r Taunt of %s failed on %s (%s).",src or "",dest or "",spell or "")
end,
["Taunted"] = function(src,dest,spell) dest = dest or ""
return string.format("%s taunted %s using %s.",src,dest,spell)
end,
['Tank'] = "Tank",
}
local spamDelay = 10
local spamShow = false
local realm = GetRealmName()
local taunts = {
[355] = true, -- Warrior taunt
[49576] = true, -- DK death grip
[56222] = true, -- DK dark command
[62124] = true, -- Paladin hand of reckoning
[31789] = true, -- Paladin righteous defense
[6795] = true, -- Druid growl
[20736] = true, -- Hunter distracting shot
[2649] = true,-- Hunter pet growl rank 1
[17735] = true, -- Warlock pet suffering rank 1
[115543] = true, -- Monk Glyph of the ox
[115546] = true, -- Monk provoke
[185245] = true, -- demon hunter Torment
}
local dontspam = {
[2649] = true,-- Hunter pet growl rank 1
[17735] = true, -- Warlock pet suffering rank 1
}
local spammer = {}
local function getUnitId(name)
if(GetNumGroupMembers() > 0) then
for i = 1,MAX_RAID_MEMBERS do
if(UnitName("raid"..i) == name) then
return "raid"..i
end
end
else
for i = 1,4 do
if(UnitName("party"..i) == name) then
return "party"..i
end
end
for i = 1,4 do
if(UnitName("partypet"..i) == name) then
return "partypet"..i
end
end
end
if(name == UnitName('pet')) then return 'pet' end
return "player"
end
local function nameCompare(n1,n2)
local name1,realm1 = UnitName(getUnitId(n1))
local name2,realm2 = UnitName(getUnitId(n2))
realm1 = realm1 or realm
realm2 = realm2 or realm
if(name1 == name2 and realm1 == realm2) then return true end
return false
end
local function OnUpdate()
local spots = 0
for k in pairs(spammer) do
spots = spots + spammer[k]['count']
end
addon:OnText(name, spots)
end
function addon:CLParse(data, prefix, suffix)
-- local event,timestamp, eventtype, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, spellId,spellName,spellSchool = ...
local dest = data[13]
if(not taunts[dest]) then return end
local name = data[6]
if not (UnitPlayerOrPetInParty(name) or UnitPlayerOrPetInRaid(name) or UnitIsUnit("player",name) or UnitIsUnit("pet",name)) then return end
if(data[3] == "SPELL_CAST_SUCCESS") then
spammer[name] = spammer[name] or { ['count'] = 0, ['lastMessage'] = - spamDelay}
spammer[name]['count'] = spammer[name]['count'] + 1
if(spammer[name]['count'] > spammer[name]['lastMessage'] + spamDelay) then
spamShow = true
spammer[name]['lastMessage'] = spammer[name]['count']
end
if nameCompare(name,tank) and addon['db']['profile']['ignoreTanks'] then return end
if(not dontspam[data[13]] or spamShow) then
addon:Print(L["Taunted"](name,data[10],data[14]))
end
spamShow = false
else
addon:Print(L["Taunted Fail"](name,data[10],data[14]))
end
OnUpdate()
end
function addon:RAID_ROSTER_UPDATE(event, ...)
local oldtank = tank
tank = nil
if(GetNumGroupMembers()) then
for i = 1,MAX_RAID_MEMBERS do
local name, _, _, _, _, _, _, _, _, role, _, combatRole = GetRaidRosterInfo(i)
if(name and (role == "maintank" or combatRole == 'TANK')) then
local c,r = UnitName(format("raid%i",i))
if(r and r~='') then
tank = format("%s-%s",c,r)
else
tank = c
end
break
end
end
else
for i = 1,4 do
local isTank, isHeal, isDPS = UnitGroupRolesAssigned(format("party%i",i))
if(isTank) then
local c,r = UnitName(format("party%i",i))
if(r and r~='') then
tank = format("%s-%s",c,r)
else
tank = c
end
break
end
end
end
if(not tank) then
local c,r = UnitName("player")
tank = c
end
if(oldtank and oldtank ~= tank) then
addon:Print(L["New Tank"](tank))
end
end
local function tooltip(GameTooltip)
GameTooltip:AddLine(name)
GameTooltip:AddDoubleLine("|cff00ff00"..L["Tank"].."|r","|cffffffff"..tank.."|r")
if(spammer) then
for k in pairs(spammer) do
GameTooltip:AddDoubleLine(k,"|cffffffff"..spammer[k]['count'].."|r")
end
end
end
function addon:PLAYER_ENTERING_WORLD(event,...)
self:UnregisterEvent(event)
addon['db'] = LibStub("AceDB-3.0"):New(name.."DB")
addon:InitConfig(name, true, {
['type'] = "data source",
['OnTooltipShow'] = tooltip,
})
addon:AddConfigEntry(name, 'toggle', 'ignoreTanks', 'Ignore Tanks', 'Dont show taunts of tanks.', 1)
LibStub("LibCombatLog"):Embed(addon)
addon:RegisterCLEvent("SPELL_CAST_SUCCESS","CLParse")
addon:RegisterCLEvent("SPELL_MISSED","CLParse")
self:RegisterEvent("RAID_ROSTER_UPDATE")
OnUpdate()
end
addon['frame'] = addon:RegisterFunc({'PLAYER_ENTERING_WORLD'},"OnEvent", function(self, event, ...)
if(type(addon[event]) == 'function') then
addon[event](self, event, ...)
end
end)

8
zz_Taunted.toc Normal file
View File

@ -0,0 +1,8 @@
## Interface: 90002
## X-Repository: https://git.grml.de/rilgamon/zz_Taunted
## X-WoWI-ID: 16973
## Title: Taunted
## SavedVariables: zz_TauntedDB
Common\common.xml
LibCombatlog\LibCombatlog.lua
taunted.lua