Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zendil committed Mar 28, 2016
0 parents commit c75170a
Show file tree
Hide file tree
Showing 6 changed files with 291 additions and 0 deletions.
173 changes: 173 additions & 0 deletions Teds_PVP_Spelltimers.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
--Teds_PVP_Spelltimers.lua v1.0 by Zendil-The Underbog (US)
--Last updated WoW patch 6.2.4 (60200) %% 28 March 2016
function Teds_PVP_Spelltimers_Onload(self)
--Define variables
self.activealerts = {}
--Create list of all defensive cooldowns that alerts will be created for
--To add a spell, insert a new entry with the buff's spellid as the key and the name (or whatever text should be displayed) as the values
--To remove a spell just delete or comment out it's line
--Note when adding your own spells that the mechanism by which spells are tracked is as -BUFFS- on your -TARGET-
--i.e. if you wanted to track "Marked for Death", it would not work as this creates a -DEBUFF- on the -PLAYER-
self.filter_def = {
--Demon Hunter
--NYI
--Druid
[22812] = "Barkskin",
[102342] = "Ironbark",
[61336] = "Survival Instincts",
[33891] = "Incarnation: Tree of Life",
--Death Knight
[48792] = "Icebound Fortitude",
[48707] = "Anti-Magic Shell",
[49039] = "Lichborne",
[96268] = "Death's Advance",
[115018] = "Desecrated Ground",
[55233] = "Vampiric Blood",
[171039] = "Rune Tap",
--Hunter
[19263] = "Deterrence",
[109215] = "Posthaste",
[54216] = "Master's Call",
[53480] = "Roar of Sacrifice",
--Mage
[45438] = "Ice Block",
[110909] = "Alter Time",
[157913] = "Evanesce",
[110960] = "Greater Invisibility",
--Monk
[115203] = "Fortifying Brew",
[137562] = "Nimble Brew",
[115308] = "Elusive Brew",
[116849] = "Life Cocoon",
[122470] = "Touch of Karma",
[115176] = "Zen Meditation",
[122783] = "Diffuse Magic",
[122278] = "Dampen Harm",
[116844] = "Ring of Peace",
[116841] = "Tiger's Lust",
--Paladin
[642] = "Divine Shield",
[498] = "Divine Protection",
[1022] = "Hand of Protection",
[1044] = "Hand of Freedom",
[6940] = "Hand of Sacrifice",
[31850] = "Ardent Defender",
[31821] = "Devotion Aura",
[85499] = "Speed of Light",
--Priest
[81782] = "Power Word: Barrier",
[47585] = "Dispersion",
[47788] = "Guardian Spirit",
[33206] = "Pain Suppression",
[20711] = "Spirit of Redemption",
--Rogue
[5277] = "Evasion",
[1966] = "Feint",
[31224] = "Cloak of Shadows",
[108212] = "Burst of Speed",
[31230] = "Cheat Death",
[76577] = "Smoke Bomb",
--Shaman
[114052] = "Ascendance", --Restoration only
--Totems may or may not work; testing required
[108280] = "Healing Tide",
[8143] = "Tremor Totem",
[98008] = "Spirit Link",
[58875] = "Spirit Walk",
[79206] = "Spiritwalker's Grace",
[108271] = "Astral Shift",
[30884] = "Nature's Guardian",
[30823] = "Shamanistic Rage",
--Warlock
[48020] = "Soulburn Teleport",
[111397] = "Blood Horror",
[110913] = "Dark Bargain",
[108359] = "Dark Regeneration",
--Warrior
[23920] = "Spell Reflection",
[12975] = "Last Stand",
[97462] = "Rallying Cry",
[871] = "Shield Wall",
[46924] = "Bladestorm", --Added because you are immune to cc
[114028] = "Spell Reflection", --Mass Spell Reflection
[114030] = "Vigilance",
[46947] = "Safeguard",
}
--TODO: Offensive abilities, and give option to pick which filters are applied
--Register events
self:RegisterEvent("UNIT_AURA")
self:RegisterEvent("PLAYER_TARGET_CHANGED")
end
function Teds_PVP_Spelltimers_Event(self,event,...)
local F = Teds_PVP_Spelltimers_Frame
if event == "UNIT_AURA" or event == "PLAYER_TARGET_CHANGED" then
--first, fetch all buffs on target
local unit
if event == "UNIT_AURA" then
unit = ...
else
unit = "target"
end
if unit == "target" then --TODO: (maybe?) only update/active/show for hostile targets, not friendlies
--this event affects our target, so we want to update now
--clear out cached values for replacement with fresh ones
F.targetbuffs = {}
--store the old values to check when theres new ones
--TODO: this seems messy. maybe there is a better way?
F.activealerts_old = F.activealerts
F.activealerts = {}
--check all buffs
for i=1,40 do
local _,_,_,_,_,_,expire,_,_,_,id = UnitAura("target",i,"HELPFUL")
if id then
--if buff exists (id is within bounds) then cache it
F.targetbuffs[i] = {["id"] = id,["expire"] = expire}
end
end
end
--now, filter for the ones we want
if F.targetbuffs then
--if we have buffs on target
for _,v in pairs(F.targetbuffs) do
--iterate through the target's cached buffs
if F.filter_def[v.id] and (v.expire - GetTime()) > 0 then
--buff is in filter and has non-negative duration -> create alert
F.activealerts[v.id] = {["name"] = F.filter_def[v.id],["expire"] = v.expire}
if not F.activealerts_old[v.id] then
print(F.filter_def[v.id])
--this is the first detection (new buff). Play sound.
PlaySoundFile("Interface\\Addons\\Teds_PVP_Spelltimers\\media\\BoxingArenaSound.ogg","Master")
--KNOWN ISSUE: when multiple alerts are active, losing one will cause the sound to play. Somehow, the remaining aura is then seen as 'new'.
--Unknown how the check fails; both expired and remaining aura should still be in _old on the first iteration after the exired fades.
end
end
end
end
--now, check if we had any that matched filter
if next(F.activealerts) ~= nil then
--we did match some filters. show the frame (which will start updates)
F:Show()
else
--no alerts to show. hide the frame (which stops updates)
F:Hide()
end
end
end
function Teds_PVP_Spelltimers_Update(self)
--reset the output text
self.output = ""
local duration
for _,t in pairs(self.activealerts) do
--iterate through active alerts, adding each to the output text
if self.output ~= "" then
self.output = self.output.."\n"
end
duration = t.expire - GetTime()
if duration < 0 then
duration = 0
end
self.output = self.output..string.format("%.1f%s%.1f",duration," - "..t.name.." - ",duration)
end
--set the text once we have build the complete string
self.fontstring:SetText(self.output)
end
13 changes: 13 additions & 0 deletions Teds_PVP_Spelltimers.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Interface: 60200
## Title: Ted's PVP Spelltimers
## Notes: Shows alerts for enemy buffs. (Designed for PVP)
## Version: 1.0
## Author: Zendil-The Underbog
##
## X-Curse-Packaged-Version: 1.0
## X-Curse-Project-Name: Ted's PVP Spelltimers
## X-Curse-Project-ID: teds_pvp_spelltimers
## X-Curse-Repository-ID: wow/teds_pvp_spelltimers/mainline

Teds_PVP_Spelltimers.lua
Teds_PVP_Spelltimers.xml
32 changes: 32 additions & 0 deletions Teds_PVP_Spelltimers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
<Script File="Teds_PVP_Spelltimers.lua" />
<Frame name="Teds_PVP_Spelltimers_Frame" enableMouse="false" movable="false" parent="UIParent" enableKeyboard="false" hidden="false">
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="0" y="-50" />
</Offset>
</Anchor>
</Anchors>
<Size>
<AbsDimension x="1000" y="225" />
</Size>
<Scripts>
<OnLoad function="Teds_PVP_Spelltimers_Onload" />
<OnEvent function="Teds_PVP_Spelltimers_Event" />
<OnUpdate function="Teds_PVP_Spelltimers_Update" />
</Scripts>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentFontString" parentKey="fontstring" text="ALERT" outline="NORMAL" font="Fonts\FRIZQT__.TTF" justifyV="TOP" justifyH="CENTER">
<Anchors>
<Anchor point="TOPLEFT" relativepoint="TOPLEFT" />
<Anchor point="BOTTOMRIGHT" relativepoint="BOTTOMRIGHT" />
</Anchors>
<FontHeight val="45" />
<Color r="1.0" g="0.0" b="0.0" />
</FontString>
</Layer>
</Layers>
</Frame>
</Ui>
Binary file added media/BoxingArenaSound.ogg
Binary file not shown.
Loading

0 comments on commit c75170a

Please sign in to comment.