commit 1c9120f5e62f19c94ca88dcea74c8042e2cc925e Author: Robin Date: Fri Jan 15 22:53:54 2021 +0100 Rewrite to use new LibCombatlog diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..560fe86 --- /dev/null +++ b/.gitmodules @@ -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 diff --git a/Common b/Common new file mode 160000 index 0000000..762c59c --- /dev/null +++ b/Common @@ -0,0 +1 @@ +Subproject commit 762c59c6c6abc6ecaa71f3e36bb2c6dd16b8e0ed diff --git a/LibCombatlog b/LibCombatlog new file mode 160000 index 0000000..1d4200b --- /dev/null +++ b/LibCombatlog @@ -0,0 +1 @@ +Subproject commit 1d4200bd9820474cae49c5ef26fb42e3eb621b5b diff --git a/README.md b/README.md new file mode 100644 index 0000000..0a0368b --- /dev/null +++ b/README.md @@ -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") \ No newline at end of file diff --git a/icon2.tga b/icon2.tga new file mode 100644 index 0000000..190d785 Binary files /dev/null and b/icon2.tga differ diff --git a/license.txt b/license.txt new file mode 100644 index 0000000..6d2e364 --- /dev/null +++ b/license.txt @@ -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. \ No newline at end of file diff --git a/taunted.lua b/taunted.lua new file mode 100644 index 0000000..585ea9e --- /dev/null +++ b/taunted.lua @@ -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) \ No newline at end of file diff --git a/zz_Taunted.toc b/zz_Taunted.toc new file mode 100644 index 0000000..42a7602 --- /dev/null +++ b/zz_Taunted.toc @@ -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