--[[ Hunter Timers, by Sorren of Bleeding HollowVersion 1.2v1.2 -Added icons -Added a switch to append the name -Dynamic resizing to account for the name space -Added opacities -Added the ability to change the border opacity/color -Added the ability to change text colors -Added even more options, look for yourself -Moved some of the variables I had in localization to globals. These are mostly arrays that contain localised variables, so don't worry about them. -Should properly auto-cascade now.v1.1a -Fixed a trap error, thanks Malathis -Added an option to reset the position of the bars to the center of the screenv1.1 -Thank you Flimflam for helping me out. -Added per target debuffs! Stings etc. will now be added per target, mouseover a bar to see the target -Added support for fear beast -Fixed a bug with scatter shot -Quick shots will now properly refresh when you regain it during the buffv1.0d -The survival tree continues to mock me.v1.0c -Broke improved wingclip while trying to make it localisable, fixed -Broke improved concussive while trying to make it localisable, fixedv1.0b -Deterrence is 10 seconds. weee. -I broke the slash commands by accident. Fixed.v1.0a -Fixed Scorpid Sting -ALL macros should now work! -Fixed an issue with CT_mods casting barv1.0 -New Shiny gui configuration! -Fixed a crapton of bugs -Should now detect macros and casts from the spellbook -Should no longer explode during frenzy -You can now turn stuff on and off -You can now specify the precision of the time -You can now change the spacing between the bars -Fixed conflict with nurfed casting bar(hopefully discord too)v0.3 -Diminshing returns theoretically works! -Fixed an issue with scaling -Wyvern sting works in theory, couldn't find anyone to testv0.2a -Fixed some action bar issuesv0.2 -Fixed more bugs -Added color changing -Added flashing when the timer is about to expire -updated the slash commandsv0.1g -Fixed a bunch of bugs -Can now have it grow up or down -Can now lock/unlockv0.1f -Scaling through /sht scale 0-100 (100 being 100%) -Detect trap resists -can now set an extra delay on the aimed shot casting(for those of us who lag a bit) via /sht delay ## where # is miliseconds. -Fix some minor bugsv0.1d -Imp. Wing Clip -Imp. Conc shot -Counterattack -various bugs -minor fade detectionv0.1c fixed Bestial wrath, fixed conflict with CastingTimeBar -Added quick shots -added rapid fire -made both affect aimed shot cast timev0.1b fixed an conflict with CT_RaidTrackerv0.1a fixed an error with concussive shotv0.1 initial releaseSlash commands:/sht menu/sht on/off /sht aimed on/off --turns casting bar for aimed shot on/off/sht setbgcolor r g b a --sets the bg color where r, g, b, a are between 0 and 10/sht scale # --where # is the % you want to scale to eg 50 = 50%/sht reset --if the bars break, use this to clear them/sht delay #--delay added to aimed shot cast time(in miliseconds). Raise or lower this to make the aimed shot bar faster or slower based on your lag/sht up/down --sets whether it grows up or down/sht lock/unlock --lock or unlock the timer frame/sht barcolor r g b --NEW sets bar color to r, g, b where r, g, b are between 0 and 1/sht barendcolor --NEW sets the barcolor to change to when near completion/sht colorchange on/off --NEW enables/disables the color change feature(off by default)/sht flash <time> --NEW sets the timeleft for the flashing to start(5 seconds default), set to 0 to turn it off/sht step <step> --NEW larger numbers mean faster flashing( default 0.015 )--]]local checkForTargetDeath = 0;local checkForTarget = nil;local checkForSpell = 0;local targetDebuffs = {};local checkForSpellFail = nil;local checkForSpellName = nil;local trapTimer = nil;local sht_init = false;local dimin = {};function SHunterTimers_OnLoad() this:RegisterEvent("VARIABLES_LOADED"); this:RegisterEvent("UNIT_AURA"); this:RegisterEvent("SPELLCAST_STOP"); this:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE"); this:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE"); this:RegisterEvent("CHAT_MSG_SPELL_AURA_GONE_OTHER"); this:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE"); this:RegisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH"); this:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS"); this:RegisterEvent("CHAT_MSG_SPELL_PET_DAMAGE"); this:RegisterEvent("SPELLCAST_START"); --this:RegisterEvent("PLAYER_ENTERING_WORLD"); this:RegisterEvent("PLAYER_TARGET_CHANGED"); this:RegisterEvent("CHAT_MSG_MONSTER_EMOTE"); this:RegisterEvent("SPELLCAST_FAILED"); this:RegisterEvent("SPELLS_CHANGED"); if(DEFAULT_CHAT_FRAME) then DEFAULT_CHAT_FRAME:AddMessage("Sorren's Hunter Timers Loaded", 1, 0, 0 ); end SlashCmdList["SHUNTERTIMERS"] = function (msg) SHunterTimers_SlashCmd(msg); end SLASH_SHUNTERTIMERS1 = "/shuntertimers"; SLASH_SHUNTERTIMERS2 = "/sht"; targetDebuffs["numDebuffs"] = 0;endfunction SHunterTimers_SlashCmd(msg) if( msg == "showvars" ) then DEFAULT_CHAT_FRAME:AddMessage(numBars, 1, 0, 0 ); return; end if( msg == "menu" ) then SHunterTimers_ShowOptions(); return; end if( msg == "reset" ) then SHTvars["numBars"] = 0; for num = 1, 11, 1 do frame = getglobal("SHunterTimersStatus"..num); --frame:SetAlpha( 0 ); frame.endTime = 0; end return; end if( msg == "on" ) then if( SHTvars["on"] ) then DEFAULT_CHAT_FRAME:AddMessage("SHT already on", 1, 0, 0); return; else UseAction = SHunterTimers_OnUseAction; CastSpellByName = SHunterTimers_OnCastSpellByName; CastSpell = SHunterTimers_OnCastSpell; SHTvars["on"] = true; DEFAULT_CHAT_FRAME:AddMessage("SHT on", 1, 0, 0); return; end elseif( msg == "off" ) then if( SHTvars["on"] ) then UseAction = SHunterTimers_Real_UseAction; CastSpellByName = SHunterTimers_Real_CastSpellByName; CastSpell = SHunterTimers_Real_CastSpell; SHTvars["on"] = false; DEFAULT_CHAT_FRAME:AddMessage("SHT off", 1, 0, 0); return; else DEFAULT_CHAT_FRAME:AddMessage("SHT not on", 1, 0, 0); return; end elseif( string.find( msg, "setbgcolor" ) ) then for r, g, b, a in string.gfind( msg, "setcolor (%d+) (%d+) (%d+) (%d+)" ) do SHTvars["bg"].r = r/10; SHTvars["bg"].g = g/10; SHTvars["bg"].b = b/10; SHTvars["bg"].a = a/10; SHunterTimersFrame:SetBackdropColor( r/10, g/10, b/10, a/10 ); end return; elseif( string.find( msg, "aimed" ) )then if( string.find(msg, "on" ) )then SHTvars["Aimed Shot"] = true; DEFAULT_CHAT_FRAME:AddMessage("SHT: Aimed Shot Casting Bar on"); elseif( string.find( msg, "off" ) ) then SHTvars["Aimed Shot"] = false; DEFAULT_CHAT_FRAME:AddMessage("SHT: Aimed Shot Casting Bar off"); else if( SHTvars["Aimed Shot"] ) then SHTvars["Aimed Shot"] = false; DEFAULT_CHAT_FRAME:AddMessage("SHT: Aimed Shot Casting Bar off"); else SHTvars["Aimed Shot"] = true; DEFAULT_CHAT_FRAME:AddMessage("SHT: Aimed Shot Casting Bar on"); end end elseif( string.find(msg, "delay" ) ) then for ms in string.gfind(msg, "delay (%d+)") do SHTvars["aimeddelay"] = ms; DEFAULT_CHAT_FRAME:AddMessage("Delay set to "..ms.."ms"); end elseif( string.find(msg, "scale" ) ) then for scale in string.gfind( msg, "scale (%d+)" ) do if( (scale/100) < 0.1 ) then scale = 10; end scale = scale * UIParent:GetScale(); SHTvars["scale"] = scale/100; end SHunterTimersFrame:SetScale( SHTvars["scale"] ); for i=1, 11 do getglobal("SHunterTimersStatus"..i):SetScale( SHTvars["scale"] ); end elseif( string.find(msg, "down") ) then SHTvars["down"] = true; SHunterTimersFrame:ClearAllPoints(); SHunterTimersFrame:SetPoint( "TOPLEFT", "SHunterTimersAnchor", "BOTTOMRIGHT" ); DEFAULT_CHAT_FRAME:AddMessage("SHT: Growing down"); elseif( string.find(msg, "up" ) ) then SHTvars["down"] = false; SHunterTimersFrame:ClearAllPoints(); SHunterTimersFrame:SetPoint( "BOTTOMLEFT", "SHunterTimersAnchor", "TOPRIGHT" ); DEFAULT_CHAT_FRAME:AddMessage("SHT: Growing up"); elseif( msg == "unlock" ) then SHTvars["locked"] = false; SHunterTimersAnchor:Show(); elseif( msg == "lock" ) then SHTvars["locked"] = true; SHunterTimersAnchor:Hide(); elseif( string.find(msg, "colorchange" ) ) then for on in string.gfind(msg, "colorchange (%a+)") do if( on == "on" ) then SHTvars["colorchange"] = true; elseif( on == "off" ) then SHTvars["colorchange"] = false; end if( on == "on") or ( on == "off" ) then DEFAULT_CHAT_FRAME:AddMessage( "SHT: Colorchange is: "..on); end end elseif( string.find( msg, "barcolor" ) ) then for r, g, b in string.gfind(msg, "barcolor ([%d.]+) ([%d.]+) ([%d.]+)") do local red, green, blue = unpack( SHTvars["barstartcolor"] ); SHTvars["barstartcolor"][1] = r; SHTvars["barstartcolor"][2] = g; SHTvars["barstartcolor"][3] = b; local rd, gd, bd = unpack( SHTvars["bardelta"] ); red = rd + red; blue = bd + blue; green = gd + green; red = red - r; green = green - g; blue = blue - b; SHTvars["bardelta"][1] = red; SHTvars["bardelta"][2] = green; SHTvars["bardelta"][3] = blue; DEFAULT_CHAT_FRAME:AddMessage( "SHT: Barcolor set to: "..SHTColor(r, g, b)..r..", "..g..", "..b.."|r"); end elseif( string.find( msg, "barendcolor" ) ) then for red, green, blue in string.gfind(msg, "barendcolor ([%d.]+) ([%d.]+) ([%d.]+)") do local r, g, b = unpack( SHTvars["barstartcolor"] ); r = red - r; g = green - g; b = blue - b; SHTvars["bardelta"][1] = r; SHTvars["bardelta"][2] = g; SHTvars["bardelta"][3] = b; DEFAULT_CHAT_FRAME:AddMessage( "SHT: Barendcolor set to: "..SHTColor(red, green, blue)..red..", "..green..", "..blue.."|r"); end elseif( string.find( msg, "flash" ) ) then for flash in string.gfind( msg, "flash (%d+)" ) do flash = flash * 1; SHTvars["flash"] = flash; if( flash == 0 ) then DEFAULT_CHAT_FRAME:AddMessage("SHT: Bar flash off"); else DEFAULT_CHAT_FRAME:AddMessage("SHT: Bar flash set to: "..flash.." seconds"); end end elseif( string.find( msg, "step" ) ) then for step in string.gfind( msg, "step ([%d.]+)" ) do SHTvars["step"] = step DEFAULT_CHAT_FRAME:AddMessage("SHT: Step set to: "..step); end elseif( msg == "resetpos" ) then SHunterTimersAnchor:ClearAllPoints(); SHunterTimersAnchor:SetPoint("CENTER", "UIParent", "CENTER", 0, 0 ); elseif( string.find( msg, "(%a+) (%d+)" ) ) then for cmd1, cmd2 in string.gfind( msg, "(%a+) (%d+)" ) do --DEFAULT_CHAT_FRAME:AddMessage(cmd1.."-"..cmd2, 1, 0, 0); SHunterTimersFrame_add( cmd2, cmd1 ); end else --[[ DEFAULT_CHAT_FRAME:AddMessage("Sorren's Hunter Timers v0.1"); DEFAULT_CHAT_FRAME:AddMessage("Commands: /sht"); DEFAULT_CHAT_FRAME:AddMessage("/sht on/off"); DEFAULT_CHAT_FRAME:AddMessage("/sht aimed on/off"); DEFAULT_CHAT_FRAME:AddMessage("/sht setbgcolor r g b a (where r, g, b, a are between 0 and 10)"); DEFAULT_CHAT_FRAME:AddMessage("/sht delay <time> (time is in miliseconds)"); DEFAULT_CHAT_FRAME:AddMessage("/sht scale % (/sht scale 100 = 100% scale)"); DEFAULT_CHAT_FRAME:AddMessage("/sht lock/unlock"); DEFAULT_CHAT_FRAME:AddMessage("/sht up/down"); DEFAULT_CHAT_FRAME:AddMessage("/sht barcolor r g b (where r, g, b are between 0 and 1)"); DEFAULT_CHAT_FRAME:AddMessage("/sht barendcolor r g b (where r, g, b are between 0 and 1)"); DEFAULT_CHAT_FRAME:AddMessage("/sht colorchange on/off"); DEFAULT_CHAT_FRAME:AddMessage("/sht flash <timeleft> (timeleft in seconds to flash the bar, 0 for off)");]] for key,val in SHT_SLASH_HELP do DEFAULT_CHAT_FRAME:AddMessage(val); end local statusstring = "Satus: "; if( SHTvars["on"] ) then statusstring = statusstring.."on "; else statusstring = statusstring.."off "; end statusstring = statusstring.."Aimed Shot Casting Bar: "; if( SHTvars["Aimed Shot"] ) then statusstring = statusstring.."on "; else statusstring = statusstring.."off "; end DEFAULT_CHAT_FRAME:AddMessage(statusstring); statusstring = "Aimed Shot delay: "..SHTvars["aimeddelay"].."ms Flash time: "..SHTvars["flash"].." Step: "..SHTvars["step"]; DEFAULT_CHAT_FRAME:AddMessage(statusstring); local r, g, b = unpack( SHTvars["barstartcolor"] ); local rd, gd, bd = unpack( SHTvars["bardelta"] ); statusstring = "Barcolor: "..SHTColor(r,g,b)..r..", "..g..", "..b.."|r Barcolorend: "..SHTColor(r+rd, g+gd, b+bd)..(r+rd)..", "..(b+bd)..", "..(g+gd).."|r"; DEFAULT_CHAT_FRAME:AddMessage(statusstring); statusstring = "Colorchange: "; if( SHTvars["colorchange"] ) then statusstring = statusstring.."on"; else statusstring = statusstring.."off"; end statusstring = statusstring.." Growth: "; if( SHTvars["down"] ) then statusstring = statusstring.."down"; else statusstring = statusstring.."up"; end DEFAULT_CHAT_FRAME:AddMessage(statusstring); end --[[ bar debug stuff, uncomment if you want to be able to add your own bars via /sht Name time for cmd1, cmd2 in string.gfind( msg, "(%a+) (%d+)" ) do DEFAULT_CHAT_FRAME:AddMessage(cmd1.."-"..cmd2, 1, 0, 0); SHunterTimersFrame_add( cmd2, cmd1 ); end]]endfunction SHunterTimersFrame_add( spellDuration, spellName, target ) if( SHTvars["numBars"] < 0 ) then SHTvars["numBars"] = 0; end local allReadyActive = false; local bar; if( SHT_sfind( spellName, SHT_STING ) or string.find( spellName, SHT_CONC_SHOT ) ) then spellDuration = spellDuration + SHTvars["shotdelay"]; end if( spellName == SHT_INTIM ) then --DEFAULT_CHAT_FRAME:AddMessage("Intim", 1, 1, 0 ); if( SHTvars["petIntim"] ) then --DEFAULT_CHAT_FRAME:AddMessage("Pet Intim", 1, 1, 0 ); for num = 1, SHTvars["numBars"], 1 do local barframe = getglobal("SHunterTimersStatus"..num); local textBar = getglobal("SHunterTimersStatus"..num.."BarLeftText"):GetText(); --DEFAULT_CHAT_FRAME:AddMessage("Intim: "..textBar, 1, 1, 0 ); if( textBar == SHT_PET_INTIM ) then SHTvars["petIntim"] = nil; barframe.endTime = 0; bar = num; break; end end end end if( string.find( spellName, SHT_PRIMED ) ) then if( trapTimer ) then for num = 1, SHTvars["numBars"], 1 do local textBar = getglobal("SHunterTimersStatus"..num.."BarLeftText"):GetText(); --DEFAULT_CHAT_FRAME:AddMessage("Intim: "..textBar, 1, 1, 0 ); if( string.find(textBar, SHT_PRIMED ) ) then allReadyActive = true; bar = num; break; end end end elseif( SHT_sfind( spellName, SHT_STING ) ) then for num = 1, SHTvars["numBars"] do local barframe = getglobal("SHunterTimersStatus"..num); if( SHT_sfind( barframe.spell, SHT_STING ) and ( barframe.target == target ) ) then allReadyActive = true; bar = num; break; end end elseif( not string.find( spellName, SHT_FLARE ) ) then for num = 1, SHTvars["numBars"], 1 do local barframe = getglobal("SHunterTimersStatus"..num); if( barframe.spell == spellName ) and (barframe.target == target)then allReadyActive = true; bar = num; break; end end end local num = bar; if( not allReadyActive ) then if( SHTvars["numBars"] == 11 ) then return; end SHTvars["numBars"] = SHTvars["numBars"] + 1; num = SHTvars["numBars"]; end local icon = getglobal("SHunterTimersStatus"..num.."Icon"); local barframe = getglobal("SHunterTimersStatus"..num); local bar = getglobal("SHunterTimersStatus"..num.."Bar"); local leftText = getglobal("SHunterTimersStatus"..num.."BarLeftText"); local rightText = getglobal("SHunterTimersStatus"..num.."BarRightText"); if( not barframe ) then --DEFAULT_CHAT_FRAME:AddMessage("WTFBBQ line 214"); return; end local texture; if( spellName == SHT_IMP_CONC_SHORT ) then texture = SHTvars["textures"][SHT_CONC_SHOT]; elseif( spellName == SHT_IMP_WC_SHORT ) then texture = SHTvars["textures"][SHT_WING_CLIP]; elseif( string.find( spellName, SHT_TRAP ) ) then if( string.find( spellName, SHT_FREEZING_TRAP ) )then texture = SHTvars["textures"][SHT_FREEZING_TRAP] elseif( string.find( spellName, SHT_IMMO_TRAP ) ) then texture = SHTvars["textures"][SHT_IMMO_TRAP] elseif( string.find( spellName, SHT_FROST_TRAP ) ) then texture = SHTvars["textures"][SHT_FROST_TRAP] elseif( string.find( spellName, SHT_EXPL_TRAP ) ) then texture = SHTvars["textures"][SHT_EXPL_TRAP] end elseif( string.find( spellName, SHT_INTIM ) ) then texture = SHTvars["textures"][SHT_INTIM]; else texture = SHTvars["textures"][spellName]; end icon:SetTexture(texture); barframe.spell = spellName; barframe.texture = texture; barframe.target = target; barframe.startTime = GetTime(); barframe.duration = spellDuration / 1000; barframe.endTime = barframe.startTime + barframe.duration; bar:SetMinMaxValues(barframe.startTime, barframe.endTime); bar:SetValue( barframe.endTime ); local spellText = SHTColor(unpack(SHTvars["skillcolor"]))..spellName; if( SHTvars["append"] ) and (barframe.target) then spellText = spellText.."|r - "..SHTColor(unpack(SHTvars["targetcolor"]))..barframe.target; end leftText:SetText( spellText ); local text; if( SHTvars["mili"] == 0 ) then text = string.format( SHTColor(unpack(SHTvars["timecolor"])).."%ds", barframe.duration ); else text = string.format( SHTColor(unpack(SHTvars["timecolor"])).."%."..SHTvars["mili"].."f", barframe.duration ); end rightText:SetText( text ); barframe.channeling = true; barframe.fadeOut = false; SHunterTimersFrame:SetAlpha(1); SHT_SetHeight(); if( not SHunterTimersFrame:IsVisible() ) then SHunterTimersFrame:Show(); end local r, g, b, a = unpack( SHTvars["barstartcolor"] ); bar:SetStatusBarColor(r, g, b, a ); getglobal("SHunterTimersStatus"..num.."BGBar"):SetStatusBarColor(r, g, b, 0.25*a); barframe:SetAlpha(SHTvars["overallalpha"]); SHunterTimers_SetWidths(); barframe:Show();endfunction SHunterTimers_SetWidths() local largestwidth = 180; if( SHTvars["showtex"] ) then if( SHTvars["largetex"] ) and (SHTvars["barheight"] < 16 ) then largestwidth = largestwidth - 16; else largestwidth = largestwidth - SHTvars["barheight"]; end if( SHTvars["gap"] ) then largestwidth = largestwidth - 5; end end local tarwidth = largestwidth; local extrawidth = 0; for i=1, SHTvars["numBars"] do local width = getglobal("SHunterTimersStatus"..i.."BarLeftText"):GetWidth() + getglobal("SHunterTimersStatus"..i.."BarRightText"):GetWidth(); if( width > largestwidth ) then largestwidth = width; end end if( largestwidth > tarwidth ) and (not SHTvars["hidetext"]) then largestwidth = largestwidth + 40; if( SHTvars["showtex"] ) then extrawidth = SHTvars["barheight"]; if( SHTvars["largetex"] ) and ( SHTvars["barheight"] < 16 ) then extrawidth = 16; end if( SHTvars["gap"] ) then extrawidth = extrawidth + 5; end end for i=1, SHTvars["numBars"] do getglobal("SHunterTimersStatus"..i):SetWidth(largestwidth + extrawidth); getglobal("SHunterTimersStatus"..i.."Bar"):SetWidth(largestwidth); getglobal("SHunterTimersStatus"..i.."BGBar"):SetWidth(largestwidth); end if( SHTvars["padding"] ) then SHunterTimersFrame:SetWidth(largestwidth + extrawidth + 20); else SHunterTimersFrame:SetWidth(largestwidth + extrawidth + 10); end else if( SHTvars["padding"] ) then SHunterTimersFrame:SetWidth( 240 ); else SHunterTimersFrame:SetWidth( 230 ); end local width = 220; if( SHTvars["showtex"] ) then if( SHTvars["largetex"] ) and ( SHTvars["barheight"] < 16) then width = width - 16; else width = width - SHTvars["barheight"]; end if( SHTvars["gap"] ) then width = width - 5; end end for i=1, SHTvars["numBars"] do getglobal("SHunterTimersStatus"..i):SetWidth(220); getglobal("SHunterTimersStatus"..i.."Bar"):SetWidth(width); getglobal("SHunterTimersStatus"..i.."BGBar"):SetWidth(width); end endendfunction SHunterTimers_OnUpdateBar( id ) if( not SHunterTimersFrame:IsVisible() ) then SHunterTimersFrame:Show(); end local barframe = getglobal("SHunterTimersStatus"..id); if( barframe.channeling ) then local time = GetTime(); local bartext = getglobal( "SHunterTimersStatus"..id.."BarRightText"); if( time >= barframe.endTime ) then barframe.channeling = false; barframe.fadeOut = true; barframe.step = 0; barframe.target = nil; bartext:SetText( SHT_DONE ); SHTvars["numBars"] = SHTvars["numBars"] - 1; local text = barframe.spell --getglobal("SHunterTimersStatus"..id.."BarLeftText"):GetText(); if( SHTvars["concuss"] ) and ( text == SHT_CONC_SHOT ) then SHTvars["concuss"] = false; elseif( SHTvars["rapid"] ) and ( text == SHT_RAPID_FIRE ) then SHTvars["rapid"] = false; elseif( SHTvars["quick"] ) and ( text == SHT_QUICK_SHOTS ) then SHTvars["quick"] = false; elseif( SHTvars["petIntim"] ) and ( text == SHT_PET_INTIM ) then SHTvars["petIntim"] = false; elseif( SHTvars["deterrence"] ) and ( text == SHT_DETERRENCE ) then SHTvars["deterrence"] = false; elseif( trapTimer ) and string.find( text, SHT_PRIMED ) then trapTimer = false; elseif( SHTvars["wingclip"] ) and (text == SHT_WING_CLIP ) then SHTvars["wingclip"] = false; elseif( SHTvars["freezing"] ) and (text == SHT_FREEZING_TRAP ) then SHTvars["freezing"] = false; elseif( SHTvars["impwing"] ) and (text == SHT_IMP_WC_SHORT ) then SHTvars["impwing"] = false; elseif( SHTvars["scatter"] ) and (text == SHT_SCATTER ) then SHTvars["scatter"] = false; elseif( SHTvars["wyvern"] ) and ( text == SHT_WYVERN_TEXT ) then SHTvars["wyvern"] = false; elseif( SHTvars["fearbeast"] ) and ( text == SHT_FEAR_BEAST ) then SHTvars["fearbeast"] = false; elseif( SHTvars["impconc"] ) and ( text == SHT_IMP_CONC_SHORT ) then SHTvars["impconc"] = false; end return; end local bar = getglobal("SHunterTimersStatus"..id.."Bar"); local value = barframe.startTime + barframe.endTime - time; bar:SetValue( value ); local timeleft = barframe.duration - (time - barframe.startTime); local timeleftstring; if( SHTvars["mili"] == 0 ) then timeleftstring = string.format( SHTColor(unpack(SHTvars["timecolor"])).."%ds", timeleft ); else timeleftstring = string.format( SHTColor(unpack(SHTvars["timecolor"])).."%."..SHTvars["mili"].."f", timeleft ); end getglobal("SHunterTimersStatus"..id.."BarRightText"):SetText(timeleftstring); if( SHTvars["colorchange"] ) then local percent = (time - barframe.startTime)/(barframe.endTime - barframe.startTime); local r, g, b, a = unpack( SHTvars["barstartcolor"] ); local redd, greend, blued, alphad = unpack( SHTvars["bardelta"] ); redd = r + redd*percent; greend = g + greend*percent; blued = b + blued*percent; alphad = a + alphad*percent; bar:SetStatusBarColor( redd, greend, blued, alphad ); getglobal("SHunterTimersStatus"..id.."BGBar"):SetStatusBarColor( redd, greend, blued, 0.25*alphad ); end if( timeleft < SHTvars["flash"] ) then if( barframe.step == 0 ) then barframe.step = -SHTvars["step"]; end local alpha = barframe:GetAlpha() + barframe.step; if( alpha < 0.2 ) then barframe.step = SHTvars["step"]; elseif( alpha > SHTvars["overallalpha"]*1 ) then barframe.step = -SHTvars["step"]; end barframe:SetAlpha(alpha); end elseif( barframe.fadeOut ) then if( trapTimer ) then local textBar = getglobal("SHunterTimersStatus"..id.."BarLeftText"):GetText(); if( string.find( textBar, "primed" ) ) then trapTimer = false; end end local alpha = barframe:GetAlpha() - 0.05; if( alpha > 0 ) then barframe:SetAlpha(alpha); else barframe.fadeOut = false; barframe:Hide(); SHunterTimers_AutoCascade( 1, false ); --SHunterTimers_cascadeBar( id ); end endendfunction SHunterTimersFrame_OnUpdate(elapsed) if( (elapsed - this.updateTime) > 1 ) then this.updateTime = elapsed; local shown = false; local numbars = 0; for i=1, SHT_NUM_BARS do if( getglobal("SHunterTimersStatus"..i):IsVisible() ) then if( getglobal("SHunterTimersStatus"..i).channeling ) then numbars = numbars + 1; end shown = true; end end --SHunterTimers_AutoCascade(1, false); --SHunterTimers_SetWidths(); if( not shown ) then SHTvars["numBars"] = 0; else SHTvars["numBars"] = numbars; end SHunterTimersFrame:SetScale( SHTvars["scale"] ); for i=1, SHT_NUM_BARS do getglobal("SHunterTimersStatus"..i):SetScale( SHTvars["scale"] ); end for key, val in dimin do if( (elapsed - dimin[key]["time"]) > 20 ) then dimin[key] = nil; end end SHT_SetHeight(); end if not ( SHTvars["numBars"] > 0 ) then local alpha = SHunterTimersFrame:GetAlpha() - 0.05; if( alpha > 0 ) then SHunterTimersFrame:SetAlpha(alpha); else SHunterTimersFrame:Hide(); end endendfunction SHT_init() if( not SHTvars ) then SHTvars = {}; SHTvars["bg"] = { r=0, g=0, b=0, a=7 }; end if( SHTvars["on"] == nil ) then SHTvars["on"] = true; end if( not SHTvars["borderalpha"] ) then SHTvars["borderalpha"] = { [1] = 1; [2] = 1; [3] = 1; [4] = 1; }; end SHunterTimersFrame:SetBackdropColor( SHTvars["bg"].r, SHTvars["bg"].g, SHTvars["bg"].b, SHTvars["bg"].a ); SHunterTimersFrame:SetBackdropBorderColor( unpack(SHTvars["borderalpha"]) ); SHTvars["numBars"] = 0; SHunterTimers_Real_UseAction = UseAction; SHunterTimers_Real_CastSpellByName = CastSpellByName; SHunterTimers_Real_CastSpell = CastSpell; if( not SHTvars["skills"] ) then SHTvars["skills"] = {}; for i=1, 19 do SHTvars["skills"][SHT_OPTIONS_CHECK[i]] = true; --woot lazy end end if( SHTvars["skills"][SHT_OPTIONS_CHECK[23]] == nil ) then SHTvars["skills"][SHT_OPTIONS_CHECK[23]] = true; end if( SHTvars["Aimed Shot"] == nil ) then SHTvars["Aimed Shot"] = true; end if( not SHTvars["aimeddelay"] ) then SHTvars["aimeddelay"] = 400; end if( not SHTvars["scale"] ) then SHTvars["scale"] = UIParent:GetScale(); end if( SHTvars["locked"] == nil ) then SHTvars["locked"] = false; end if( not SHTvars["down"] == nil ) then SHTvars["down"] = true; end if( not SHTvars["locked"] ) then SHunterTimersAnchor:Show(); else SHunterTimersAnchor:Hide(); end if( not SHTvars["mili"] ) then SHTvars["mili"] = 2; end if( SHTvars["flash"] == nil ) then SHTvars["flash"] = 5; end if( not SHTvars["skillcolor"] ) then local r, g, b = SHunterTimersStatus1BarLeftText:GetTextColor(); --local a = SHunterTimersStatus1BarLeftText:GetAlpha(); SHTvars["skillcolor"] = { [1] = r, [2] = g, [3] = b, [4] = 1 }; end if( not SHTvars["timecolor"] ) then local r, g, b = SHunterTimersStatus1BarRightText:GetTextColor(); --local a = SHunterTimersStatus1BarRightText:GetAlpha(); SHTvars["timecolor"] = { [1] = r, [2] = g, [3] = b, [4] = 1 }; end if( not SHTvars["targetcolor"] ) then local r, g, b = SHunterTimersStatus1BarLeftText:GetTextColor(); --local a = SHunterTimersStatus1BarRightText:GetAlpha(); SHTvars["targetcolor"] = { [1] = r, [2] = g, [3] = b, [4] = 1 }; end if( not SHTvars["barstartcolor"] ) then SHTvars["barstartcolor"] = { [1] = 0, [2] = 0.8, [3] = 0, [4] = 1 }; end if( not SHTvars["barstartcolor"][4] ) then SHTvars["barstartcolor"][4] = 1; end if( not SHTvars["bardelta"] ) then SHTvars["bardelta"] = { [1] = 0.8, [2] = -0.8, [3] = 0, [4] = 0}; end if( not SHTvars["bardelta"][4] ) then SHTvars["bardelta"][4] = 0; end if( not SHTvars["shotdelay"] ) then SHTvars["shotdelay"] = 550; end if( SHTvars["step"] == nil ) then SHTvars["step"] = 0.015; end if( SHTvars["colorchange"] == nil ) then SHTvars["colorchange"] = false; end if( not SHTvars["bardistance"] ) then SHTvars["bardistance"] = 10; end if( SHTvars["down"] ) then SHunterTimersFrame:ClearAllPoints(); SHunterTimersFrame:SetPoint( "TOPLEFT", "SHunterTimersAnchor", "BOTTOMRIGHT" ); else SHunterTimersFrame:ClearAllPoints(); SHunterTimersFrame:SetPoint( "BOTTOMLEFT", "SHunterTimersAnchor", "TOPRIGHT" ); end if( SHTvars["append"] == nil ) then SHTvars["append"] = false; end if( not SHTvars["overallalpha"] ) then SHTvars["overallalpha"] = 1; end SHTvars["concuss"] = false; SHTvars["rapid"] = false; SHTvars["quick"] = false; SHTvars["petIntim"] = false; SHTvars["deterrence"] = false; SHTvars["wingclip"] = false; SHTvars["freezing"] = false; SHTvars["impwing"] = false; SHTvars["scatter"] = false; SHTvars["wyvern"] = false; for i=1, SHT_NUM_OPTIONS_CHECK do --Check boxes if( i < 19 ) or ( i == 23 ) then getglobal("SHunterTimersOptionsTimersCheckButton"..i.."Text"):SetText(SHT_OPTIONS_CHECK[i]); else getglobal("SHunterTimersOptionsBarCheckButton"..i.."Text"):SetText(SHT_OPTIONS_CHECK[i]); end end --SHunterTimersOptionsTimersCheckButton23Text:SetText(SHT_OPTIONS_CHECK[23]); for i=1, SHT_NUM_SLIDERS do --Sliders getglobal("SHunterTimersOptionsBarSlider"..i.."SliderTitle"):SetText(SHT_OPTIONS_SLIDER[i]); getglobal("SHunterTimersOptionsBarSlider"..i.."SliderLow"):SetText(SHT_OPTIONS_SLIDER_ENDS[i][1]) getglobal("SHunterTimersOptionsBarSlider"..i.."SliderHigh"):SetText(SHT_OPTIONS_SLIDER_ENDS[i][2]); end if( not SHTvars["textures"] ) then SHTvars["textures"] = {}; end if( SHTvars["showtex"] == nil ) then SHTvars["showtex"] = true; end if( SHTvars["largetex"] == nil ) then SHTvars["largetex"] = false; end if( SHTvars["hidetext"] == nil ) then SHTvars["hidetext"] = false; end if( SHTvars["hidetime"] == nil ) then SHTvars["hidetime"] = false; end if( SHTvars["gap"] == nil ) then SHTvars["gap"] = true; end if( SHTvars["padding"] == nil ) then SHTvars["padding"] = true; end if( not SHTvars["barheight"] ) then SHTvars["barheight"] = 10; end for i=1, SHT_NUM_LABLES do if( i ~= 5 ) then getglobal("SHunterTimersOptionsBarLabel"..i.."Label"):SetText(SHT_OPTIONS_LABELS[i]); else getglobal("SHunterTimersOptionsTimersLabel"..i.."Label"):SetText(SHT_OPTIONS_LABELS[i]); end end SHunterTimers_SetSettings(); SHunterTimersOptions:SetScale(UIParent:GetScale()*0.9);endfunction SHunterTimersFrame_OnEvent(event) if( event == "VARIABLES_LOADED" ) then SHT_init(); return; end if( event == "SPELLS_CHANGED" ) then if( not sht_init ) then sht_init = true; for key,val in SHTvars["skills"] do local i = 1; while( GetSpellTexture(i, BOOKTYPE_SPELL) ) do local spellName = GetSpellName(i, BOOKTYPE_SPELL); if( spellName == key ) then SHTvars["textures"][key] = GetSpellTexture(i, BOOKTYPE_SPELL); break; end i = i + 1; end end end SHTvars["textures"][SHT_QUICK_SHOTS] = "Interface\\Icons\\Ability_Warrior_InnerRage"; SHTvars["textures"][SHT_FRENZY] = "Interface\\Icons\\INV_Misc_MonsterClaw_03"; local _, _, _, _, rank = GetTalentInfo( 3, 7 ); --Clever traps SHTvars["traptimemult"] = 1 + (rank*0.15); return; end if( not SHTvars["on"] ) then return; end if( event == "CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE" ) or ( event == "CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE" ) then if( string.find( arg1, SHT_TRAP ) ) then if( trapTimer ) then for mob, effect in string.gfind( arg1, SHT_TRAP_AFFLICT_STRING ) do --DEFAULT_CHAT_FRAME:AddMessage(effect.." "..mob); SHunterTimers_addDebuff( effect, mob ); end end elseif( string.find( arg1, SHT_FEAR_BEAST ) ) then for mob, effect in string.gfind( arg1, SHT_AFFLICT_STRING ) do --DEFAULT_CHAT_FRAME:AddMessage(effect.." "..mob); if( effect == SHT_FEAR_BEAST ) and ( mob == UnitName("target") ) then SHTvars["fearbeast"] = true; SHunterTimers_addDebuff( effect, mob ); end end end elseif( event == "CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS" ) then if( string.find( arg1, SHT_QUICK_SHOTS ) ) then SHTvars["quick"] = true; SHTvars["quicktime"] = GetTime(); --local duration = GetPlayerBuffTimeLeft(i) * 1000; if(SHTvars["skills"][SHT_QUICK_SHOTS]) then SHunterTimersFrame_add( 12000, SHT_QUICK_SHOTS ); end elseif( string.find( arg1, SHT_RAPID_FIRE ) ) then SHTvars["rapid"] = true; SHTvars["rapidtime"] = GetTime(); --local duration = GetPlayerBuffTimeLeft(i) * 1000; if (SHTvars["skills"][SHT_RAPID_FIRE]) then SHunterTimersFrame_add( 15000, SHT_RAPID_FIRE ); end elseif( string.find( arg1, SHT_DETERRENCE ) and SHTvars["skills"][SHT_DETERRENCE] ) then SHTvars["deterrence"] = true; --local duration = GetPlayerBuffTimeLeft(i) * 1000; SHunterTimersFrame_add( 10000, SHT_DETERRENCE ); end elseif( event == "CHAT_MSG_SPELL_PET_DAMAGE" ) then if( string.find( arg1, SHT_RESIST ) or string.find( arg1, SHT_IMMUNE) ) then if( string.find( arg1, SHT_INTIM ) ) then for i=1, SHTvars["numBars"] do local text = getglobal("SHunterTimersStatus"..i).spell --.."BarLeftText"):GetText(); if( text == SHT_PET_INTIM ) then getglobal("SHunterTimersStatus"..i).endTime = 0; end end else for trap in string.gfind( arg1, SHT_FIND_TRAP_FAILED ) do if( trapTimer ) and ( (trap ~= SHT_FROST_TRAP) or (trap ~= SHT_EXPL_TRAP) )then for i=1, SHTvars["numBars"] do local text = getglobal("SHunterTimersStatus"..i.."BarLeftText"):GetText(); if( string.find( text, trap.." "..SHT_PRIMED ) ) then getglobal("SHunterTimersStatus"..i).endTime = 0; end end end end end end elseif( event == "CHAT_MSG_SPELL_SELF_DAMAGE" ) then if(SHTvars["skills"][SHT_WING_CLIP]) and ( string.find( arg1, SHT_YOUR..SHT_WING_CLIP ) ) and ( string.find( arg1, SHT_HITS ) or string.find(arg1, SHT_CRITS ) ) then SHTvars["wingclip"] = true; local name = UnitName("target"); SHunterTimersFrame_add( 10000, SHT_WING_CLIP, name ); elseif( string.find( arg1, SHT_FAILED ) ) then local name = UnitName("target"); for spell in string.gfind( arg1, SHT_FAILED_STRING) do --DEFAULT_CHAT_FRAME:AddMessage(spell); for i=1, SHTvars["numBars"] do local barframe = getglobal("SHunterTimersStatus"..i); --local text = getglobal("SHunterTimersStatus"..i.."BarLeftText"):GetText(); if( barframe.spell == spell ) and ( barframe.target == name )then getglobal("SHunterTimersStatus"..i).endTime = 0; end end end elseif( string.find(arg1, SHT_MISSES ) ) then local name = UnitName("target"); for spell in string.gfind( arg1, SHT_MISSES_STRING ) do for i=1, SHTvars["numBars"] do local barframe = getglobal("SHunterTimersStatus"..i); --local text = getglobal("SHunterTimersStatus"..i.."BarLeftText"):GetText(); if( barframe.spell == spell ) and ( barframe.target == name )then getglobal("SHunterTimersStatus"..i).endTime = 0; end end end elseif(SHTvars["skills"][SHT_COUNTER]) and ( string.find( arg1, SHT_YOUR..SHT_COUNTER ) and (string.find( arg1, SHT_HITS ) or string.find( arg1, SHT_CRITS )) )then SHunterTimersFrame_add( 5000, "Counterattack", UnitName("target") ); end elseif( event == "CHAT_MSG_SPELL_SELF_DAMAGE" ) then if( trapTimer ) and string.find( arg1, SHT_EXPL_TRAP ) then SHunterTimers_addDebuff( SHT_EXPL_TRAP ); end; elseif( event == "CHAT_MSG_COMBAT_HOSTILE_DEATH" ) then if( SHTvars["numBars"] > 0 ) then for target in string.gfind( arg1, "([%a%s]+) dies." ) do checkForTarget = target; end checkForTargetDeath = GetTime(); end elseif( event == "CHAT_MSG_MONSTER_EMOTE" ) then if( SHTvars["frenzy"] and (string.find(arg1, SHT_FRENZY_EMOTE ) or string.find(arg1, SHT_FRENZY_FLAMEGOR ) )) then if( arg2 == SHT_CHROMAGGUS ) then SHunterTimersFrame_add( 15000, SHT_FRENZY, SHT_CHROMAGGUS ); elseif( arg2 == SHT_FLAMEGOR ) then SHunterTimersFrame_add( 11500, SHT_FRENZY, SHT_FLAMEGOR ); elseif( arg2 == SHT_MAGMADAR ) then SHunterTimersFrame_add( 15000, SHT_FRENZY, SHT_MAGMADAR ); end end elseif( event == "PLAYER_TARGET_CHANGED" ) then if(SHTvars["numBars"]== 0 ) then return; end local time = GetTime(); if( time - checkForTargetDeath < 1 ) then for num = 1, SHTvars["numBars"], 1 do --local text = getglobal("SHunterTimersStatus"..num.."BarLeftText"):GetText(); local barframe = getglobal("SHunterTimersStatus"..num); if( barframe.target == checkForTarget ) then barframe.endTime = 0; end end end elseif( event == "SPELLCAST_START" ) then checkForSpellFail = true; checkForTarget = UnitName("target"); checkForSpellName = arg1; elseif( event == "SPELLCAST_FAIL" ) then if( checkForSpellFail) then checkForSpellFail = false; checkForSpellName = nil; end elseif( event == "SPELLCAST_STOP" ) then if( checkForSpellFail) then checkForSpellFail = false; if( SHT_sfind( checkForSpellName, SHT_STING ) ) then local name = UnitName("target"); SHunterTimers_addDebuff( checkForSpellName, name ); elseif(SHTvars["skills"][SHT_INTIM]) and ( string.find( checkForSpellName, SHT_INTIM ) ) then SHTvars["petIntim"] = true; SHunterTimersFrame_add( 15000, SHT_PET_INTIM ); elseif(SHTvars["skills"][SHT_BW]) and ( string.find( checkForSpellName, SHT_BW ) ) then SHunterTimersFrame_add( 15000, checkForSpellName ); elseif(SHTvars["skills"][SHT_FLARE]) and ( string.find( checkForSpellName, SHT_FLARE ) ) then SHunterTimersFrame_add( 30000, checkForSpellName ); elseif( string.find( checkForSpellName, SHT_TRAP ) ) then if( SHTvars["skills"][checkForSpellName]) then trapTimer = true; SHunterTimersFrame_add( 60000, checkForSpellName.." "..SHT_PRIMED ); end elseif(SHTvars["skills"][SHT_SCATTER]) and ( string.find( checkForSpellName, SHT_SCATTER ) ) then local duration = 4000; local name = UnitName("target"); if(name) and ( dimin[name] ) and ((GetTime() - dimin[name]["time"]) < 20) then for i=1, dimin[name]["times"] do duration = duration/2; end end SHTvars["scatter"] = true; SHunterTimersFrame_add( duration, checkForSpellName, name ); elseif(SHTvars["skills"][SHT_FEAR_BEAST]) and ( checkForSpellName == SHT_FEAR_BEAST ) then SHTvars["fearbeast"] = true; else local name = UnitName("target"); SHunterTimers_addDebuff( checkForSpellName, name ); end checkForSpellName = nil; end --DEFAULT_CHAT_FRAME:AddMessage(checkForSpell, 1, 0, 0 ); elseif( event == "UNIT_AURA" ) then if( arg1 == "player" ) then --[[local i = 1; while( UnitBuff("player", i ) ) do SHuntersTooltip:SetUnitBuff("player", i ); local text = SHuntersTooltipTextLeft1:GetText() if( not SHTvars["rapid"] ) and ( text == SHT_RAPID_FIRE ) then SHTvars["rapid"] = true; SHTvars["rapidtime"] = GetTime(); --local duration = GetPlayerBuffTimeLeft(i) * 1000; if (SHTvars["skills"][SHT_RAPID_FIRE]) then SHunterTimersFrame_add( 15000, SHT_RAPID_FIRE ); end end if( not SHTvars["quick"] ) and ( text == SHT_QUICK_SHOTS ) then SHTvars["quick"] = true; SHTvars["quicktime"] = GetTime(); --local duration = GetPlayerBuffTimeLeft(i) * 1000; if(SHTvars["skills"][SHT_QUICK_SHOTS]) then SHunterTimersFrame_add( 8000, SHT_QUICK_SHOTS ); end end if(SHTvars["skills"][SHT_DETERRENCE]) and ( not SHTvars["deterrence"] ) and ( text == SHT_DETERRENCE ) then SHTvars["deterrence"] = true; --local duration = GetPlayerBuffTimeLeft(i) * 1000; SHunterTimersFrame_add( 10000, SHT_DETERRENCE ); end --DEFAULT_CHAT_FRAME:AddMessage(i.." "..targetDebuffs[i], 1, 0, 0 ); i = i + 1; end]] local time = GetTime(); if( SHTvars["rapid"] ) and ( (time - SHTvars["rapidtime"]) >= 15 ) then SHTvars["rapid"] = false; end if( SHTvars["quick"] ) and ( (time - SHTvars["quicktime"]) >= 8 ) then SHTvars["quick"] = false; end return; end if( arg1 == "target" ) then local time = GetTime(); local name = UnitName("target"); --DEFAULT_CHAT_FRAME:AddMessage(time, 1, 0, 0 ); local i = 1; while( UnitDebuff("target", i ) ) do SHuntersTooltip:SetUnitDebuff("target", i ); targetDebuffs[i] = SHuntersTooltipTextLeft1:GetText(); --DEFAULT_CHAT_FRAME:AddMessage(i.." "..targetDebuffs[i], 1, 0, 0 ); i = i + 1; end i = i - 1; if( SHTvars["petIntim"] ) then for j = 1, i, 1 do if( string.find( targetDebuffs[i], SHT_INTIM ) ) then SHunterTimers_addDebuff( SHT_INTIM, name ); return; end end end if( SHTvars["concuss"] ) then for j = 1, i do if( not SHTvars["impconc"] ) and ( string.find( targetDebuffs[i], SHT_IMP_CONC ) ) then SHTvars["impconc"] = true; SHunterTimers_addDebuff( SHT_IMP_CONC_SHORT, name ); end end end if( SHTvars["wingclip"] ) and not( SHTvars["impwing"] ) then for j = 1, i do if( string.find( targetDebuffs[i], SHT_IMP_WC ) ) then SHTvars["impwing"] = true; SHunterTimersFrame_add( 5000, SHT_IMP_WC_SHORT, name ); end end end end elseif( event == "CHAT_MSG_SPELL_AURA_GONE_OTHER" ) then for effect, target in string.gfind(arg1, SHT_FADE_STRING ) do if( SHTvars["freezing"] ) and string.find(effect, SHT_FREEZING_TRAP ) then for i=1, SHTvars["numBars"] do local barframe = getglobal( "SHunterTimersStatus"..i); --local text = getglobal( "SHunterTimersStatus"..i.."BarLeftText"):GetText(); if( barframe.spell == SHT_FREEZING_TRAP ) and ( barframe.target == target ) then --SHunterTimersFrame_add( 20000, "Diminishing Returns" ); getglobal("SHunterTimersStatus"..i).endTime = 0; end end if( not dimin[target] ) then dimin[target] = {}; end dimin[target]["time"] = GetTime(); if( dimin[target]["times"] == nil ) then dimin[target]["times"] = 1; else dimin[target]["times"] = dimin[target]["times"] + 1; end end if( SHTvars["scatter"] ) and string.find( effect, SHT_SCATTER ) then for i=1, SHTvars["numBars"] do local barframe = getglobal( "SHunterTimersStatus"..i) --local text = getglobal("SHunterTimersStatus"..i.."BarLeftText"):GetText(); if( barframe.spell == SHT_SCATTER ) and ( barframe.target == target ) then getglobal("SHunterTimersStatus"..i).endTime = 0; end end if( not dimin[target] ) then dimin[target] = {}; end dimin[target]["time"] = GetTime(); if( dimin[target]["times"] == nil ) then dimin[target]["times"] = 1; else dimin[target]["times"] = dimin[target]["times"] + 1; end end if( SHTvars["scatter"] ) and string.find( effect, SHT_SCATTER ) then for i=1, SHTvars["numBars"] do local barframe = getglobal( "SHunterTimersStatus"..i) --local text = getglobal("SHunterTimersStatus"..i.."BarLeftText"):GetText(); if( barframe.spell == SHT_SCATTER ) and ( barframe.target == target ) then getglobal("SHunterTimersStatus"..i).endTime = 0; end end if( not dimin[target] ) then dimin[target] = {}; end dimin[target]["time"] = GetTime(); if( dimin[target]["times"] == nil ) then dimin[target]["times"] = 1; else dimin[target]["times"] = dimin[target]["times"] + 1; end end if( SHTvars["fearbeast"] ) and string.find( effect, SHT_FEAR_BEAST ) then for i=1, SHTvars["numBars"] do local barframe = getglobal( "SHunterTimersStatus"..i); --local text = getglobal("SHunterTimersStatus"..i.."BarLeftText"):GetText(); if( barframe.spell == SHT_FEAR_BEAST ) and (barframe.target == target ) then getglobal("SHunterTimersStatus"..i).endTime = 0; end end end if( SHTvars["wyvern"] ) and string.find( effect, SHT_WYVERN ) then for i=1, SHTvars["numBars"] do local barframe = getglobal( "SHunterTimersStatus"..i); local text = getglobal("SHunterTimersStatus"..i.."BarLeftText"):GetText(); if( text == SHT_WYVERN_TEXT ) and (barframe.target == target ) then getglobal("SHunterTimersStatus"..i).endTime = 0; end end if( not dimin[target] ) then dimin[target] = {}; end dimin[target]["time"] = GetTime(); if( dimin[target]["times"] == nil ) then dimin[target]["times"] = 1; else dimin[target]["times"] = dimin[target]["times"] + 1; end end if( SHTvars["wingclip"] ) and string.find( effect, SHT_WING_CLIP ) then for i=1, SHTvars["numBars"] do --local text = getglobal( "SHunterTimersStatus"..i.."BarLeftText"):GetText(); local barframe = getglobal( "SHunterTimersStatus"..i); if( barframe.spell == SHT_WING_CLIP ) and ( barframe.target == target ) then getglobal("SHunterTimersStatus"..i).endTime = 0; end end end end endendfunction SHunterTimers_addDebuff( debuff, mob ) if (SHTvars["skills"][SHT_SERPENT]) and ( debuff == SHT_SERPENT ) then SHunterTimersFrame_add( 15000, SHT_SERPENT, mob ); --currentSting = "Serpent Sting"; elseif(SHTvars["skills"][SHT_SCORPID]) and ( debuff == SHT_SCORPID ) then SHunterTimersFrame_add( 20000, SHT_SCORPID, mob ); --currentSting = "Scorpid Sting"; elseif(SHTvars["skills"][SHT_VIPER]) and ( debuff == SHT_VIPER ) then SHunterTimersFrame_add( 8000, SHT_VIPER, mob ); --currentSting = "Viper Sting"; elseif(SHTvars["skills"][SHT_WYVERN]) and ( debuff == SHT_WYVERN ) then local duration = 12000; local name = UnitName("target"); if( dimin[name] ) and ( ( GetTime() - dimin[name]["time"]) < 20 )then for i=1, dimin[name]["times"] do duration = duration / 2; end end SHTvars["wyvern"] = true; SHunterTimersFrame_add( duration, SHT_WYVERN_TEXT, name ); elseif(SHTvars["skills"][SHT_CONC_SHOT]) and ( debuff == SHT_IMP_CONC_SHORT ) then SHunterTimersFrame_add( 3000, SHT_IMP_CONC_SHORT, mob ); elseif(SHTvars["skills"][SHT_FEAR_BEAST] ) and ( debuff == SHT_FEAR_BEAST ) then SHunterTimersFrame_add( 20000, SHT_FEAR_BEAST, mob ); elseif(SHTvars["skills"][SHT_CONC_SHOT]) and ( debuff == SHT_CONC_SHOT ) then SHTvars["concuss"] = true; SHunterTimersFrame_add( 4000, SHT_CONC_SHOT, mob ); elseif(SHTvars["skills"][SHT_INTIM]) and ( debuff == SHT_INTIM ) then SHunterTimersFrame_add( 3000, SHT_INTIM, mob ); elseif( string.find( debuff, SHT_TRAP ) ) then if( trapTimer ) then trapTimer = false; for num = 1, SHTvars["numBars"] do local barframe = getglobal( "SHunterTimersStatus"..num); local text = getglobal("SHunterTimersStatus"..num.."BarLeftText"):GetText(); if( string.find( text, SHT_PRIMED ) ) then barframe.endTime = 0; end end if(SHTvars["skills"][SHT_FREEZING_TRAP]) and ( string.find( debuff, SHT_FREEZING_TRAP ) ) then SHTvars["freezing"] = true; local _, _, _, _, rank = GetTalentInfo( 3, 7 ); --Clever traps local duration = 20000*SHTvars["traptimemult"]; if(mob) and ( dimin[mob] ) and ( ( GetTime() - dimin[mob]["time"]) < 20 )then for i=1, dimin[mob]["times"] do duration = duration / 2; end end SHunterTimersFrame_add( duration, SHT_FREEZING_TRAP, mob ); elseif(SHTvars["skills"][SHT_IMMO_TRAP]) and ( string.find( debuff, SHT_IMMO_TRAP ) ) then SHunterTimersFrame_add( 15000*SHTvars["traptimemult"], SHT_IMMO_TRAP, mob ); elseif(SHTvars["skills"][SHT_FROST_TRAP]) and ( string.find( debuff, SHT_FROST_TRAP ) ) then SHunterTimersFrame_add( 30000*SHTvars["traptimemult"], SHT_FROST_TRAP.." "..SHT_AURA ); elseif(SHTvars["skills"][SHT_EXPL_TRAP]) and ( string.find( debuff, SHT_EXPL_TRAP ) ) then SHunterTimersFrame_add( 20000*SHTvars["traptimemult"], SHT_EXPL_TRAP.." "..SHT_AURA ); end end endendfunction SHunterTimers_cascadeBar( id ) local barframefrom = getglobal("SHunterTimersStatus"..(id+1)); if( not barframefrom ) or not ( barframefrom:IsVisible() and (barframefrom.channeling or barframefrom.fadeOut) )then getglobal("SHunterTimersStatus"..id):Hide(); SHunterTimers_SetWidths(); SHT_SetHeight(); return; end local barframeto = getglobal("SHunterTimersStatus"..id); local barto = getglobal("SHunterTimersStatus"..id.."Bar"); local textLeftto = getglobal("SHunterTimersStatus"..id.."BarLeftText"); local textRightto = getglobal("SHunterTimersStatus"..id.."BarRightText"); local iconto = getglobal("SHunterTimersStatus"..id.."Icon"); id = id + 1; local barfrom = getglobal("SHunterTimersStatus"..id.."Bar"); local textLeftfrom = getglobal("SHunterTimersStatus"..id.."BarLeftText"); local textRightfrom = getglobal("SHunterTimersStatus"..id.."BarRightText"); barframeto.texture = barframefrom.texture; iconto:SetTexture(barframeto.texture); barframeto.startTime = barframefrom.startTime; barframeto.endTime = barframefrom.endTime; barframeto.duration = barframefrom.duration; barframeto.channeling = barframefrom.channeling; barframeto.fadeOut = barframefrom.fadeOut; barframeto.target = barframefrom.target; barframeto.spell = barframefrom.spell; barto:SetMinMaxValues(barframeto.startTime, barframeto.endTime); barto:SetValue(barfrom:GetValue()); textLeftto:SetText(textLeftfrom:GetText()); textRightto:SetText(textRightfrom:GetText()); barframeto:SetAlpha(barframefrom:GetAlpha()); barframeto:Show(); SHunterTimers_cascadeBar( id );endfunction SHunterTimers_AutoCascade(id, last) if( id == SHT_NUM_BARS ) then return; end if( id == 0 ) then id = 1; end local barframe = getglobal("SHunterTimersStatus"..id); if( barframe:IsVisible() ) then SHunterTimers_AutoCascade(id+1, false); else local barframenext = getglobal("SHunterTimersStatus"..id+1); if( barframenext:IsVisible() ) then SHunterTimers_cascadeBar(id); if( last ) then SHunterTimers_AutoCascade( id-1, true ); else SHunterTimers_AutoCascade( id+1, false ); end else SHunterTimers_AutoCascade(id+1, true); end endendfunction SHunterTimers_OnUseAction( slot, checkFlags, checkSelf ) SHuntersTooltip:SetAction(slot); local text = SHuntersTooltipTextLeft1:GetText(); SHunterTimers_SetStates(text); SHunterTimers_Real_UseAction( slot, checkFlags, checkSelf );endfunction SHunterTimers_OnCastSpell(spellID, spellTab) SHuntersTooltip:SetSpell(spellID, spellTab); local text = SHuntersTooltipTextLeft1:GetText(); SHunterTimers_SetStates(text); SHunterTimers_Real_CastSpell(spellID, spellTab);endfunction SHunterTimers_OnCastSpellByName(spellName) SHunterTimers_SetStates(spellName); SHunterTimers_Real_CastSpellByName(spellName);endfunction SHunterTimers_SetStates(text) if( text ) then for spell in string.gfind( text, SHT_SPELL_RANK_STRIP ) do --strip the (Rank #) portion --DEFAULT_CHAT_FRAME:AddMessage(text.." "..spell); text = spell; end if( string.find( text, SHT_AIMED_SHOT ) ) then if( SHTvars["Aimed Shot"] ) then local duration = 3; if( SHTvars["rapid"] ) then duration = duration / 1.4; end if( SHTvars["quick"] ) then duration = duration / 1.3; end if( eCastingBar ) then eCastingBar_SpellcastStart( "", SHT_AIMED_SHOT, duration*1000 + SHTvars["aimeddelay"] ) elseif(otravi_CastingBar) then otravi_CastingBar:SpellStart(SHT_AIMED_SHOT, duration*1000 + SHTvars["aimeddelay"]) else if( CastingBarTimeFrame ) then --apparantly this futzes castingbartime local oldarg1 = arg1; local oldevent = event; arg1 = SHT_AIMED_SHOT; event = "SPELLCAST_START"; oldthis = this; this = CastingBarTimeFrame; CastingBarTime_OnEvent() this = oldthis; arg1 = oldarg1; event = oldevent; end if( CT_CastBarFrame ) then CT_CastBarFrame.spellName = SHT_AIMED_SHOT; end CastingBarFrameStatusBar:SetStatusBarColor(1.0, 0.7, 0.0); CastingBarSpark:Show(); CastingBarFrame.startTime = GetTime(); CastingBarFrame.maxValue = CastingBarFrame.startTime + duration; CastingBarFrameStatusBar:SetMinMaxValues(CastingBarFrame.startTime, CastingBarFrame.maxValue); CastingBarFrameStatusBar:SetValue(CastingBarFrame.startTime); CastingBarText:SetText(SHT_AIMED_SHOT); CastingBarFrame:SetAlpha(1.0); CastingBarFrame.holdTime = 0; CastingBarFrame.casting = 1; CastingBarFrame.fadeOut = nil; CastingBarFrame:Show(); CastingBarFrame.mode = "casting"; end end end if( SHT_sfind( text, SHT_STING ) or string.find( text, SHT_TRAP ) or string.find( text, SHT_INTIM ) or string.find(text, SHT_BW ) or string.find(text, SHT_FLARE) or string.find(text, SHT_CONC_SHOT ) or string.find( text, SHT_SCATTER ) )then checkForSpellFail = true; checkForSpellName = text; else checkForSpellFail = false; checkForSpellName = nil; --DEFAULT_CHAT_FRAME:AddMessage("Button pressed: "..text, 1, 1, 0 ); end endendfunction SHunterTimers_ShowOptions() for i=1, 18 do if( SHTvars["skills"][SHT_OPTIONS_CHECK[i]] ) then getglobal("SHunterTimersOptionsTimersCheckButton"..i):SetChecked(1); else getglobal("SHunterTimersOptionsTimersCheckButton"..i):SetChecked(0); end end if( SHTvars["on"] ) then SHunterTimersOptionsBarCheckButtonOn:SetChecked(1); else SHunterTimersOptionsBarCheckButtonOn:SetChecked(0); end if( SHTvars["Aimed Shot"] ) then SHunterTimersOptionsBarCheckButton19:SetChecked(1); else SHunterTimersOptionsBarCheckButton19:SetChecked(0); end if( SHTvars["frenzy"] ) then SHunterTimersOptionsBarCheckButton20:SetChecked(1); else SHunterTimersOptionsBarCheckButton20:SetChecked(0); end if( SHTvars["locked"] ) then SHunterTimersOptionsBarCheckButton21:SetChecked(1); else SHunterTimersOptionsBarCheckButton21:SetChecked(0); end if( SHTvars["skills"][SHT_OPTIONS_CHECK[23]] ) then SHunterTimersOptionsTimersCheckButton23:SetChecked(1) else SHunterTimersOptionsTimersCheckButton23:SetChecked(0) end if( SHTvars["colorchange"] ) then SHunterTimersOptionsBarCheckButton22:SetChecked(1); else SHunterTimersOptionsBarCheckButton22:SetChecked(0); end if( SHTvars["showtex"] ) then SHunterTimersOptionsBarCheckButton24:SetChecked(1); else SHunterTimersOptionsBarCheckButton24:SetChecked(0); end if( SHTvars["largetex"] ) then SHunterTimersOptionsBarCheckButton25:SetChecked(1); else SHunterTimersOptionsBarCheckButton25:SetChecked(0); end if( SHTvars["append"] ) then SHunterTimersOptionsBarCheckButton26:SetChecked(1); else SHunterTimersOptionsBarCheckButton26:SetChecked(0); end if( SHTvars["hidetext"] ) then SHunterTimersOptionsBarCheckButton27:SetChecked(1); else SHunterTimersOptionsBarCheckButton27:SetChecked(0); end if( SHTvars["hidetime"] ) then SHunterTimersOptionsBarCheckButton28:SetChecked(1); else SHunterTimersOptionsBarCheckButton28:SetChecked(0); end if( SHTvars["gap"] ) then SHunterTimersOptionsBarCheckButton29:SetChecked(0); else SHunterTimersOptionsBarCheckButton29:SetChecked(1); end if( SHTvars["padding"] ) then SHunterTimersOptionsBarCheckButton30:SetChecked(0); else SHunterTimersOptionsBarCheckButton30:SetChecked(1); end SHunterTimersOptionsBarEditBox1:SetText(SHTvars["aimeddelay"]); SHunterTimersOptionsBarEditBox2:SetText(SHTvars["shotdelay"]); local r, g, b, a = unpack(SHTvars["barstartcolor"]); local rd, gd, bd, ad = unpack( SHTvars["bardelta"] ); rd = rd + r; gd = gd + g; bd = bd + b; ad = ad + a; SHunterTimersOptionsBarColor1Swatch:SetVertexColor(r, g, b); SHunterTimersOptionsBarColor1Swatch.r = r; SHunterTimersOptionsBarColor1Swatch.g = g; SHunterTimersOptionsBarColor1Swatch.b = b; SHunterTimersOptionsBarColor1Swatch.a = a; SHunterTimersOptionsBarColor2Swatch:SetVertexColor(rd, gd, bd); SHunterTimersOptionsBarColor2Swatch.r = rd; SHunterTimersOptionsBarColor2Swatch.g = gd; SHunterTimersOptionsBarColor2Swatch.b = bd; SHunterTimersOptionsBarColor2Swatch.a = ad; SHunterTimersOptionsBarColor3Swatch:SetVertexColor(SHTvars["bg"].r, SHTvars["bg"].g, SHTvars["bg"].b, SHTvars["bg"].a); SHunterTimersOptionsBarColor3Swatch.r = SHTvars["bg"].r; SHunterTimersOptionsBarColor3Swatch.g = SHTvars["bg"].g; SHunterTimersOptionsBarColor3Swatch.b = SHTvars["bg"].b; SHunterTimersOptionsBarColor3Swatch.a = SHTvars["bg"].a; SHunterTimersOptionsBarColor4Swatch:SetVertexColor( unpack( SHTvars["borderalpha"]) ); SHunterTimersOptionsBarColor4Swatch.r, SHunterTimersOptionsBarColor4Swatch.g, SHunterTimersOptionsBarColor4Swatch.b, SHunterTimersOptionsBarColor4Swatch.a = unpack( SHTvars["borderalpha"] ); SHunterTimersOptionsBarColor5Swatch:SetVertexColor(unpack(SHTvars["skillcolor"])); SHunterTimersOptionsBarColor5Swatch.r, SHunterTimersOptionsBarColor5Swatch.g, SHunterTimersOptionsBarColor5Swatch.b, SHunterTimersOptionsBarColor5Swatch.a = unpack( SHTvars["skillcolor"] ); SHunterTimersOptionsBarColor6Swatch:SetVertexColor(unpack(SHTvars["timecolor"])); SHunterTimersOptionsBarColor6Swatch.r, SHunterTimersOptionsBarColor6Swatch.g, SHunterTimersOptionsBarColor6Swatch.b, SHunterTimersOptionsBarColor6Swatch.a = unpack( SHTvars["timecolor"] ); SHunterTimersOptionsBarColor7Swatch:SetVertexColor(unpack(SHTvars["targetcolor"])); SHunterTimersOptionsBarColor7Swatch.r, SHunterTimersOptionsBarColor7Swatch.g, SHunterTimersOptionsBarColor7Swatch.b, SHunterTimersOptionsBarColor7Swatch.a = unpack( SHTvars["targetcolor"] ); SHunterTimersOptionsBarSlider1Slider:SetValue(SHTvars["bardistance"]); SHunterTimersOptionsBarSlider2Slider:SetValue(SHTvars["scale"]/UIParent:GetScale()); SHunterTimersOptionsBarSlider3Slider:SetValue(SHTvars["flash"]); SHunterTimersOptionsBarSlider4Slider:SetValue(SHTvars["step"]); SHunterTimersOptionsBarSlider5Slider:SetValue(SHTvars["mili"]); SHunterTimersOptionsBarSlider6Slider:SetValue(SHTvars["overallalpha"]); SHunterTimersOptionsBarSlider7Slider:SetValue(SHTvars["barheight"]); SHunterTimersOptions:Show();endfunction SHunterTimers_SaveOptions() for i=1, 18 do if( getglobal("SHunterTimersOptionsTimersCheckButton"..i):GetChecked() == 1 ) then SHTvars["skills"][SHT_OPTIONS_CHECK[i]] = true; else SHTvars["skills"][SHT_OPTIONS_CHECK[i]] = false; end end if( SHunterTimersOptionsBarCheckButtonOn:GetChecked() == 1 ) then SHTvars["on"] = true; else SHTvars["on"] = false; end if( SHunterTimersOptionsBarCheckButton19:GetChecked() == 1 ) then SHTvars["Aimed Shot"] = true; else SHTvars["Aimed Shot"] = false; end if( SHunterTimersOptionsBarCheckButton20:GetChecked() == 1 ) then SHTvars["frenzy"] = true; else SHTvars["frenzy"] = false; end if( SHunterTimersOptionsBarCheckButton21:GetChecked() == 1 ) then SHTvars["locked"] = true; SHunterTimersAnchor:Hide(); else SHTvars["locked"] = false; SHunterTimersAnchor:Show(); end if( SHunterTimersOptionsTimersCheckButton23:GetChecked() == 1) then SHTvars["skills"][SHT_OPTIONS_CHECK[23]] = true; else SHTvars["skills"][SHT_OPTIONS_CHECK[23]] = false; end if( SHunterTimersOptionsBarCheckButton22:GetChecked() == 1 ) then SHTvars["colorchange"] = true; else SHTvars["colorchange"] = false; end if( SHunterTimersOptionsBarCheckButton24:GetChecked() == 1 ) then SHTvars["showtex"] = true; else SHTvars["showtex"] = false; end if( SHunterTimersOptionsBarCheckButton25:GetChecked() == 1 ) then SHTvars["largetex"] = true; else SHTvars["largetex"] = false; end if( SHunterTimersOptionsBarCheckButton26:GetChecked() == 1 ) then SHTvars["append"] = true; else SHTvars["append"] = false; end if( SHunterTimersOptionsBarCheckButton27:GetChecked() == 1 ) then SHTvars["hidetext"] = true; else SHTvars["hidetext"] = false; end if( SHunterTimersOptionsBarCheckButton28:GetChecked() == 1 ) then SHTvars["hidetime"] = true; else SHTvars["hidetime"] = false; end if( SHunterTimersOptionsBarCheckButton29:GetChecked() == 1 ) then SHTvars["gap"] = false; else SHTvars["gap"] = true; end if( SHunterTimersOptionsBarCheckButton30:GetChecked() == 1 ) then SHTvars["padding"] = false; else SHTvars["padding"] = true; end SHTvars["aimeddelay"] = 1*SHunterTimersOptionsBarEditBox1:GetText(); SHTvars["shotdelay"] = 1*SHunterTimersOptionsBarEditBox2:GetText(); --[[ old if( SHTvars["showtex"] ) then local barwidth; if( SHTvars["largetex"] ) then barwidth = 199; else barwidth = 205; end for i=1, 11 do getglobal("SHunterTimersStatus"..i.."Icon"):Show(); local barframe = getglobal("SHunterTimersStatus"..i.."Bar"); barframe:SetWidth( barwidth ); barframe:ClearAllPoints(); barframe:SetPoint("LEFT", "SHunterTimersStatus"..i.."Icon", "RIGHT", 5, 0 ); barframe = getglobal("SHunterTimersStatus"..i.."BGBar"); barframe:SetWidth( barwidth ); barframe:ClearAllPoints(); barframe:SetPoint("LEFT", "SHunterTimersStatus"..i.."Icon", "RIGHT", 5, 0 ); if( SHTvars["largetex"] ) then barframe:GetParent():SetHeight(16); getglobal("SHunterTimersStatus"..i.."Icon"):SetHeight(16); getglobal("SHunterTimersStatus"..i.."Icon"):SetWidth(16); else barframe:GetParent():SetHeight(10); getglobal("SHunterTimersStatus"..i.."Icon"):SetHeight(10); getglobal("SHunterTimersStatus"..i.."Icon"):SetWidth(10); end end else for i=1, 11 do getglobal("SHunterTimersStatus"..i.."Icon"):Hide(); local barframe = getglobal("SHunterTimersStatus"..i.."Bar"); barframe:SetWidth( 220 ); barframe:ClearAllPoints(); barframe:SetPoint("CENTER", "SHunterTimersStatus"..i, "CENTER", 0, 0 ); barframe = getglobal("SHunterTimersStatus"..i.."BGBar"); barframe:SetWidth( 220 ); barframe:ClearAllPoints(); barframe:SetPoint("CENTER", "SHunterTimersStatus"..i, "CENTER", 0, 0 ); barframe:GetParent():SetHeight(10); getglobal("SHunterTimersStatus"..i.."Icon"):SetHeight(10); getglobal("SHunterTimersStatus"..i.."Icon"):SetWidth(10); end end ]] SHTvars["barstartcolor"][1] = SHunterTimersOptionsBarColor1Swatch.r; SHTvars["barstartcolor"][2] = SHunterTimersOptionsBarColor1Swatch.g; SHTvars["barstartcolor"][3] = SHunterTimersOptionsBarColor1Swatch.b; SHTvars["barstartcolor"][4] = SHunterTimersOptionsBarColor1Swatch.a; SHTvars["bardelta"][1] = SHunterTimersOptionsBarColor2Swatch.r - SHunterTimersOptionsBarColor1Swatch.r; SHTvars["bardelta"][2] = SHunterTimersOptionsBarColor2Swatch.g - SHunterTimersOptionsBarColor1Swatch.g; SHTvars["bardelta"][3] = SHunterTimersOptionsBarColor2Swatch.b - SHunterTimersOptionsBarColor1Swatch.b; SHTvars["bardelta"][4] = SHunterTimersOptionsBarColor2Swatch.a - SHunterTimersOptionsBarColor1Swatch.a; SHTvars["borderalpha"][1] = SHunterTimersOptionsBarColor4Swatch.r; SHTvars["borderalpha"][2] = SHunterTimersOptionsBarColor4Swatch.g; SHTvars["borderalpha"][3] = SHunterTimersOptionsBarColor4Swatch.b; SHTvars["borderalpha"][4] = SHunterTimersOptionsBarColor4Swatch.a; SHTvars["skillcolor"][1] = SHunterTimersOptionsBarColor5Swatch.r; SHTvars["skillcolor"][2] = SHunterTimersOptionsBarColor5Swatch.g; SHTvars["skillcolor"][3] = SHunterTimersOptionsBarColor5Swatch.b; SHTvars["skillcolor"][4] = SHunterTimersOptionsBarColor5Swatch.a; SHTvars["timecolor"][1] = SHunterTimersOptionsBarColor6Swatch.r; SHTvars["timecolor"][2] = SHunterTimersOptionsBarColor6Swatch.g; SHTvars["timecolor"][3] = SHunterTimersOptionsBarColor6Swatch.b; SHTvars["timecolor"][4] = SHunterTimersOptionsBarColor6Swatch.a; SHTvars["targetcolor"][1] = SHunterTimersOptionsBarColor7Swatch.r; SHTvars["targetcolor"][2] = SHunterTimersOptionsBarColor7Swatch.g; SHTvars["targetcolor"][3] = SHunterTimersOptionsBarColor7Swatch.b; SHTvars["targetcolor"][4] = SHunterTimersOptionsBarColor7Swatch.a; SHTvars["bg"].r = SHunterTimersOptionsBarColor3Swatch.r; SHTvars["bg"].g = SHunterTimersOptionsBarColor3Swatch.g; SHTvars["bg"].b = SHunterTimersOptionsBarColor3Swatch.b; SHTvars["bg"].a = SHunterTimersOptionsBarColor3Swatch.a; SHTvars["bardistance"] = SHunterTimersOptionsBarSlider1Slider:GetValue(); SHTvars["scale"] = SHunterTimersOptionsBarSlider2Slider:GetValue()*UIParent:GetScale(); SHTvars["flash"] = SHunterTimersOptionsBarSlider3Slider:GetValue(); SHTvars["step"] = SHunterTimersOptionsBarSlider4Slider:GetValue(); SHTvars["mili"] = SHunterTimersOptionsBarSlider5Slider:GetValue(); SHTvars["overallalpha"] = SHunterTimersOptionsBarSlider6Slider:GetValue(); SHTvars["barheight"] = SHunterTimersOptionsBarSlider7Slider:GetValue(); SHunterTimers_SetSettings(); SHunterTimersOptions:Hide();endfunction SHunterTimers_SetSettings() if( SHTvars["on"] ) then UseAction = SHunterTimers_OnUseAction; CastSpellByName = SHunterTimers_OnCastSpellByName; CastSpell = SHunterTimers_OnCastSpell; else UseAction = SHunterTimers_Real_UseAction; CastSpellByName = SHunterTimers_Real_CastSpellByName; CastSpell = SHunterTimers_Real_CastSpell; end SHunterTimersFrame:SetBackdropColor(SHTvars["bg"].r, SHTvars["bg"].g, SHTvars["bg"].b, SHTvars["bg"].a); SHunterTimersFrame:SetBackdropBorderColor(unpack(SHTvars["borderalpha"] ) ); for i=1, SHT_NUM_BARS do local barframe = getglobal("SHunterTimersStatus"..i); local bar = getglobal( "SHunterTimersStatus"..i.."Bar"); local bg = getglobal( "SHunterTimersStatus"..i.."BGBar"); local barwidth = 220; barframe:SetHeight( SHTvars["barheight"] ); bar:SetHeight( SHTvars["barheight"] ); bg:SetHeight( SHTvars["barheight"] ); local icon = getglobal("SHunterTimersStatus"..i.."Icon"); if( SHTvars["showtex"] ) then icon:Show(); if( SHTvars["gap"] ) then barwidth = barwidth - 5; end if( SHTvars["largetex"] ) and ( SHTvars["barheight"] < 16) then barframe:SetHeight(16); icon:SetHeight(16); icon:SetWidth(16); barwidth = barwidth - 16; else icon:SetHeight( SHTvars["barheight"] ); icon:SetWidth( SHTvars["barheight"] ); barwidth = barwidth - SHTvars["barheight"]; end bar:ClearAllPoints(); if( SHTvars["gap"] ) then bar:SetPoint("LEFT", "SHunterTimersStatus"..i.."Icon", "RIGHT", 5, 0 ); else bar:SetPoint("LEFT", "SHunterTimersStatus"..i.."Icon", "RIGHT", 0, 0 ); end bg:ClearAllPoints(); if( SHTvars["gap"] ) then bg:SetPoint("LEFT", "SHunterTimersStatus"..i.."Icon", "RIGHT", 5, 0 ); else bg:SetPoint("LEFT", "SHunterTimersStatus"..i.."Icon", "RIGHT", 0, 0 ); end else icon:Hide(); bar:SetPoint("LEFT", "SHunterTimersStatus"..i, "LEFT", 0, 0 ); bg:SetPoint("LEFT", "SHunterTimersStatus"..i, "LEFT", 0, 0 ); end barframe:SetWidth(220); bar:SetWidth(barwidth); bg:SetWidth(barwidth); if( SHTvars["hidetext"] ) then getglobal("SHunterTimersStatus"..i.."BarLeftText"):Hide(); else getglobal("SHunterTimersStatus"..i.."BarLeftText"):Show(); end if( SHTvars["hidetime"] ) then getglobal("SHunterTimersStatus"..i.."BarRightText"):Hide(); else getglobal("SHunterTimersStatus"..i.."BarRightText"):Show(); end end local height; if( not SHTvars["largetex"] ) or ( SHTvars["barheight"] >= 16 ) then height = SHTvars["numBars"] * (SHTvars["barheight"] + SHTvars["bardistance"]) - SHTvars["bardistance"] + 10; else height = SHTvars["numBars"] * (16 + SHTvars["bardistance"]) - SHTvars["bardistance"] + 10; end if( SHTvars["padding"] ) then SHunterTimersFrame:SetWidth( 240 ); SHunterTimersStatus1:SetPoint( "TOPLEFT", "SHunterTimersFrame", "TOPLEFT", 10, -10 ); height = height + 10; else SHunterTimersFrame:SetWidth( 230 ); SHunterTimersStatus1:SetPoint( "TOPLEFT", "SHunterTimersFrame", "TOPLEFT", 5, -5 ); end SHunterTimersFrame:SetHeight(height); for i=2, SHT_NUM_BARS do getglobal("SHunterTimersStatus"..i):ClearAllPoints(); getglobal("SHunterTimersStatus"..i):SetPoint("TOP", "SHunterTimersStatus"..(i-1), "BOTTOM", 0, -SHTvars["bardistance"]); end SHunterTimersFrame:SetScale( SHTvars["scale"] ); SHunterTimersFrame:SetAlpha( SHTvars["overallalpha"] ); for i=1, SHT_NUM_BARS do getglobal("SHunterTimersStatus"..i):SetScale( SHTvars["scale"] ); getglobal("SHunterTimersStatus"..i):SetAlpha( SHTvars["overallalpha"] ); endendfunction SHT_SetHeight() local height; if( not SHTvars["largetex"] ) or ( SHTvars["barheight"] >= 16 ) then height = SHTvars["numBars"] * (SHTvars["barheight"] + SHTvars["bardistance"]) - SHTvars["bardistance"] + 10; else height = SHTvars["numBars"] * (16 + SHTvars["bardistance"]) - SHTvars["bardistance"] + 10; end if( SHTvars["padding"] ) then height = height + 10; end SHunterTimersFrame:SetHeight(height); SHunterTimers_SetWidths();endlocal SHTSetColorFunc = { [1] = function() SHTSetColor(1) end, [2] = function() SHTSetColor(2) end, [3] = function() SHTSetColor(3) end, [4] = function() SHTSetColor(4) end, [5] = function() SHTSetColor(5) end, [6] = function() SHTSetColor(6) end, [7] = function() SHTSetColor(7) end};local SHTSetOpacityFunc = { [1] = function() SHTSetOpacity(1) end, [2] = function() SHTSetOpacity(2) end, [3] = function() SHTSetOpacity(3) end, [4] = function() SHTSetOpacity(4) end, [5] = function() SHTSetOpacity(5) end, [6] = function() SHTSetOpacity(6) end, [7] = function() SHTSetOpacity(7) end};local SHTCancelFunc = { [1] = function(x) SHTCancelColor(1, x) end, [2] = function(x) SHTCancelColor(2, x) end, [3] = function(x) SHTCancelColor(3, x) end, [4] = function(x) SHTCancelColor(4, x) end, [5] = function(x) SHTCancelColor(5, x) end, [6] = function(x) SHTCancelColor(6, x) end, [7] = function(x) SHTCancelColor(7, x) end};function SHT_ColorPicker(id) CloseMenus(); local texture = getglobal("SHunterTimersOptionsBarColor"..id.."Swatch"); ColorPickerFrame.func = SHTSetColorFunc[id]; ColorPickerFrame:SetColorRGB(texture.r, texture.g, texture.b); ColorPickerFrame.previousValues = {r = texture.r, g = texture.g, b = texture.b, opacity =texture.a}; ColorPickerFrame.cancelFunc = SHTCancelFunc[id]; if( id < 5 ) then ColorPickerFrame.hasOpacity = true; ColorPickerFrame.opacity = 1 - texture.a; ColorPickerFrame.opacityFunc = SHTSetOpacityFunc[id]; else ColorPickerFrame.hasOpacity = false; end --OpacityFrame.opacityFunc = SHTSetOpacityFunc[id]; ColorPickerFrame:Show();endfunction SHTSetOpacity(id) local a = 1 - OpacitySliderFrame:GetValue(); local texture = getglobal("SHunterTimersOptionsBarColor"..id.."Swatch"); --DEFAULT_CHAT_FRAME:AddMessage(id); texture:SetAlpha(a); texture.a = a;endfunction SHTSetColor(id) local r, g, b = ColorPickerFrame:GetColorRGB(); local texture = getglobal("SHunterTimersOptionsBarColor"..id.."Swatch"); --SHTSetOpacity(id); texture:SetVertexColor(r, g, b); texture.r = r; texture.g = g; texture.b = b;endfunction SHTCancelColor(id, prev) local texture = getglobal("SHunterTimersOptionsBarColor"..id.."Swatch"); local r = prev.r; local g = prev.g; local b = prev.b; local a = prev.opacity; texture:SetVertexColor(r, g, b); texture:SetAlpha( a ); texture.r = r; texture.g = g; texture.b = b; texture.a = a;endfunction SHTColor(r, g, b, a) if( not a ) then a = 1; end return string.format("|c%02x%02x%02x%02x", (a*255), (r*255), (g*255), (b*255));endfunction SHunterTimers_Tooltip(barframe) --DEFAULT_CHAT_FRAME:AddMessage(barframe:GetName()); if( barframe.target ) then GameTooltip_SetDefaultAnchor(GameTooltip, barframe); GameTooltip:ClearLines(); GameTooltip:AddLine( barframe.target ); GameTooltip:Show(); endendfunction SHT_sfind( s, pattern ) for p in string.gfind( pattern, "([^|]+)" ) do if( string.find( s, p ) )then return string.find( s, p ); end end return false;end