diff --git a/DKCrutch.lua b/DKCrutch.lua index 8fa8d8b..133a92c 100755 --- a/DKCrutch.lua +++ b/DKCrutch.lua @@ -1,5 +1,5 @@ ------------------------------------------------------------------------------- --- DKCrutch 1.1.1 +-- DKCrutch 1.1.2 -- -- Death Knight rune tracker and ability advisor ------------------------------------------------------------------------------- @@ -8,7 +8,7 @@ DKCrutch = {Locals = {}} local L = DKCrutch.Locals -DKCrutch.versionNumber = '1.1.1' +DKCrutch.versionNumber = '1.1.2' DKCrutch.talent = "" DKCrutch.talentUnsure = true DKCrutch.DebugMode = false @@ -42,7 +42,7 @@ DKCrutch.SpellList = { ["Death Strike"] = GetSpellInfo(49998), ["Blood Boil"] = GetSpellInfo(50842), ["Soul Reaper"] = GetSpellInfo(130736), --- talent specifig +-- talent specific ["Plague Leech"] = GetSpellInfo(123693), ["Blood Tap"] = GetSpellInfo(45529), ["Blood Charge"] = GetSpellInfo(114851), @@ -168,89 +168,6 @@ function DKCrutch.events.PLAYER_LOGIN() DKCrutch.eventFrame:UnregisterEvent("PLAYER_LOGIN") end -function DKCrutch:SetSwingBarWidth(element, time, speed, maxwidth) - --DKCrutch:Debug("SetSwingBarWidth" .. " t: " .. time .." s:" .. speed , maxwidth) - local width = ( time / speed * maxwidth ); - if ( width < 1 ) then - width = 1; - elseif ( width > maxwidth ) then - width = maxwidth; - end - element:SetValue(width); -end - -function DKCrutch:GetSwingSpeed(element) - local mainhand,offhand = UnitAttackSpeed("player"); - if ( DKCrutch.dualWield ) and ( element.SLOT == GetInventorySlotInfo("SecondaryHandSlot") ) then - return(offhand); - else - return(mainhand); - end -end - -function DKCrutch:SetSwingSpeed(element, speed) - if ( speed == nil ) then - element.speed = DKCrutch:GetSwingSpeed(element); - if ( element.speed == nil ) then - element:Hide(); - return(nil); - end - else - element.speed = speed; - end - _,_,element.latency = GetNetStats(); - element.latency = element.latency / 1000; - DKCrutch:Debug("SwingFrame l: " .. element.latency .." s:" .. element.speed , element.maxwidth) - DKCrutch:SetSwingBarWidth(element, element.latency, element.speed, element.maxwidth); -end - -function DKCrutch:ResetSwingFrame(element) - element:SetScript("OnUpdate", nil); - element.lastupdate = 0; - element.maxwidth = 128; - element.elapsed = 0; - DKCrutch:SetSwingSpeed(element); - element:SetMinMaxValues(0, element.maxwidth); - element:SetValue(0); - element.active = nil; - element:Show(); - element.vanish = 0; -end - -function DKCrutch.VanishFrame(element,elapsed) - --DKCrutch:Debug("VanishFrame", elapsed) - if ( element.vanish > 0 ) then - element.vanish = element.vanish - elapsed; - if ( element.vanish <= 0 ) then - element:SetScript("OnUpdate", nil); - element:Hide(); - end - end -end - -function DKCrutch.UpdateSwingFrame(element,elapsed) - -- performance throttle - element.lastupdate = element.lastupdate + elapsed; - if ( element.lastupdate < 0.03 ) then - return(nil); - end - element.elapsed = element.elapsed + element.lastupdate; - element.lastupdate = 0; - - -- flag the swing timer as inactive early to help account for lag - if ( element.elapsed > (element.speed - element.latency ) ) then - element.active = nil; - end - - if ( element.elapsed > element.speed ) then - DKCrutch:ResetSwingFrame(element); - element.vanish = 2.5; - element:SetScript("OnUpdate", DKCrutch.VanishFrame); - end - - DKCrutch:SetSwingBarWidth(element, element.elapsed, element.speed, element.maxwidth); -end - function DKCrutch.events.COMBAT_LOG_EVENT_UNFILTERED(timestamp, event, hideCaster, srcGUID, srcName, srcFlags, srcRaidFlags, dstGUID, dstName, dstFlags, dstRaidFlags, spellId, spellName, spellSchool, damage, ...) if(DKCrutchDB.enabled) and (srcName == DKCrutch.playerName) then DKCrutch:Update() @@ -258,13 +175,6 @@ function DKCrutch.events.COMBAT_LOG_EVENT_UNFILTERED(timestamp, event, hideCaste -- enemy count for AoE advise and multiple player in combat (for aggro warning) DKCrutch:CountPerson(timestamp, event, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags) end - if (not DKCrutchDB.swingDisable) then - if ( string.sub(event,1,5) == "SWING" ) and ( srcGUID == UnitGUID("player") ) then - -- reset the swing frame to 0 - DKCrutch:ResetSwingFrame(DKCrutch.swingFrame); - DKCrutch.swingFrame:SetScript("OnUpdate", DKCrutch.UpdateSwingFrame); - end - end end end @@ -597,7 +507,7 @@ function DKCrutch:ProcIcon(name,icon,d,e,value) end -- returns true, if diseases expires on target --- diseaseType : 0 for any, 1 for Frost Fever of Necrotic Plague, 2 for Blood Plague or Necrotic Plague +-- diseaseType : 0 for any, 1 for Frost Fever or Necrotic Plague, 2 for Blood Plague or Necrotic Plague, 3 for Necrotic Plage or Blood Plage and Frost Fever -- expirationTime : 0 for expired, otherwise check expiration time between 1 and expirationTime function DKCrutch:DiseaseExpires(diseaseType,expirationTime) diseaseType = diseaseType or 0; @@ -620,13 +530,20 @@ function DKCrutch:DiseaseExpires(diseaseType,expirationTime) expired = expired or (ffExpiration < 2); end end - if (diseaseType == 2) or (diseaseType == 0) then -- Check blood plague + if (diseaseType == 2) or (diseaseType == 0) then -- Check blood plagued if (expirationTime>0) then expired = expired or ((bpExpiration > 1) and (bpExpiration < expirationTime)); else expired = expired or (bpExpiration < 2); end end + if (diseaseType == 3) then -- Check both diseases + if (expirationTime>0) then + expired = expired or (((bpExpiration > 1) and (bpExpiration < expirationTime)) and ((ffExpiration > 1) and (ffExpiration < expirationTime))); + else + expired = expired or ((bpExpiration < 2) and (ffExpiration < 2)); + end + end return expired; end @@ -886,7 +803,7 @@ function DKCrutch:AdviseFrostAbilityDW() -- Frost DK DualWield priority end end if (DKCrutch.tier1talent == 19166) and (DKCrutch.SpellList["Plague Leech"]) then - if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) then + if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) and (DKCrutch:DiseaseExpires(3,99)) then return "Plague Leech"; end end @@ -976,10 +893,10 @@ function DKCrutch:AdviseFrostAbilityDW() -- Frost DK DualWield priority return "Howling Blast" end - -- Plague Leech if Outbreak available, and have on fully depleted rune + -- Plague Leech if Outbreak available, and have on fully depleted rune, and have disease on target if (DKCrutch.SpellList["Plague Leech"]) then if (obcd) and (obcd<=0) and (IsSpellInRange(DKCrutch.SpellList["Outbreak"], "target") == 1) and (DKCrutch.depletedCount>0) then - if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1 ) then + if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1 ) and (DKCrutch:DiseaseExpires(3,99)) then return "Plague Leech" end end @@ -1052,7 +969,7 @@ function DKCrutch:AdviseFrostAbility() end end if (DKCrutch.tier1talent == 19166) and (DKCrutch.SpellList["Plague Leech"]) then - if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) then + if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) and (DKCrutch:DiseaseExpires(3,99)) then return "Plague Leech"; end end @@ -1181,13 +1098,13 @@ function DKCrutch:AdviseUnholyAbility() if (DKCrutch.tier1talent == 19166) and (DKCrutch.SpellList["Plague Leech"]) then -- if outbreak available if (obcd) and (obcd<=1) and (IsSpellInRange(DKCrutch.SpellList["Outbreak"], "target") == 1) and (DKCrutch.depletedCount>0) then - if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) then + if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) and (DKCrutch:DiseaseExpires(3,99)) then return "Plague Leech"; end end -- or if diseases will expire in 2 sec on target if (DKCrutch:DiseaseExpires()) then - if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) then + if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) and (DKCrutch:DiseaseExpires(3,2)) then return "Plague Leech"; end end @@ -1291,7 +1208,7 @@ function DKCrutch:AdviseUnholyAbility() end end if (DKCrutch.tier1talent == 19166) and (DKCrutch.SpellList["Plague Leech"]) then - if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) then + if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) and (DKCrutch:DiseaseExpires(3,99)) then return "Plague Leech"; end end @@ -1402,7 +1319,7 @@ function DKCrutch:AdviseUnholyAbility() -- Plague Leech if (DKCrutch.tier1talent == 19166) and (DKCrutch.SpellList["Plague Leech"]) then - if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) then + if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) and (DKCrutch:DiseaseExpires(3,99)) then return "Plague Leech"; end end @@ -1470,6 +1387,9 @@ function DKCrutch:Update() if (not DKCrutchDB.advisorDisabled) then local spell = DKCrutch:AdviseAbility( not ((UnitHealth("target") == 0) or (guid == nil)) ) + if (spell == "Soul Reaper") and (DKCrutchDB.srSoundEnable) and (DKCrutch.lastSpell ~= "Soul Reaper") then + PlaySoundFile("Interface\\AddOns\\DKCrutch\\media\\soul_reaper.ogg"); + end DKCrutch:Debug("Advised: " .. spell, DKCrutch.SpellList[spell]) if (spell) and (spell ~= "") then local inRange = IsSpellInRange(DKCrutch.SpellList[spell],"target") diff --git a/DKCrutch.toc b/DKCrutch.toc index a3a1bbd..be36549 100755 --- a/DKCrutch.toc +++ b/DKCrutch.toc @@ -2,7 +2,7 @@ ## Title: DKCrutch ## Notes: Death Knight rune tracker and rotation helper ## Author: Taracque, Dgrovs of Arathor -## Version: 1.1.1 +## Version: 1.1.2 ## SavedVariables: DKCrutchDB ## OptionalDeps: ## Dependencies: diff --git a/DKCrutch_GUI.lua b/DKCrutch_GUI.lua index 2a8fb11..070e226 100755 --- a/DKCrutch_GUI.lua +++ b/DKCrutch_GUI.lua @@ -139,8 +139,6 @@ function DKCrutch:ApplySettings() DKCrutch.runicFrame:SetMovable(false) DKCrutch.debuffFrame:EnableMouse(false) DKCrutch.debuffFrame:SetMovable(false) - DKCrutch.swingFrame:EnableMouse(false) - DKCrutch.swingFrame:SetMovable(false) end end if ( DKCrutchDB.enabled ) then @@ -175,11 +173,6 @@ function DKCrutch:ApplySettings() else DKCrutch.displayFrame:Hide() end - if (not DKCrutchDB.swingDisabled) then - DKCrutch.swingFrame:Show() - else - DKCrutch.swingFrame:Hide() - end end else DKCrutch.eventFrame:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED") @@ -193,7 +186,6 @@ function DKCrutch:ApplySettings() DKCrutch.weaponFrame:Hide() DKCrutch.runicFrame:Hide() DKCrutch.debuffFrame:Hide() - DKCrutch.swingFrame:Hide() end end if (DKCrutch.displayFrame) then @@ -209,8 +201,6 @@ function DKCrutch:ApplySettings() DKCrutch.runicFrame:SetScale(DKCrutchDB.runic.scale) DKCrutch.debuffFrame:SetAlpha(DKCrutchDB.debuff.alpha) DKCrutch.debuffFrame:SetScale(DKCrutchDB.debuff.scale) - DKCrutch.swingFrame:SetAlpha(DKCrutchDB.swing.alpha or 1) - DKCrutch.swingFrame:SetScale(DKCrutchDB.swing.scale or 1) end end @@ -452,40 +442,8 @@ function DKCrutch:CreateConfig() local weaponDisableBtn = DKCrutch:CreateCheckButton(L.CONFIG_DISABLE_WEAPON, DKCrutch.configPanel, DKCrutchDB, "weaponDisabled", false) weaponDisableBtn:SetPoint('TOPLEFT', 10, -418) - local swingScale = DKCrutch:CreateSlider(L.CONFIG_SWING_SCALE, DKCrutch.configPanel, .25, 3, .1) - swingScale:SetScript('OnShow', function(self) - self.onShow = true - self:SetValue(DKCrutchDB.swing.scale) - self.onShow = nil - end) - swingScale:SetScript('OnValueChanged', function(self, value) - self.valText:SetText(format('%.1f', value)) - if not self.onShow then - DKCrutchDB.swing.scale=value - DKCrutch.swingFrame:SetScale(value) - end - end) - swingScale:SetPoint("TOPLEFT",10,-458) - swingScale:Show() - - local swingAlpha = DKCrutch:CreateSlider(L.CONFIG_SWING_ALPHA, DKCrutch.configPanel, .0, 1, .1) - swingAlpha:SetScript('OnShow', function(self) - self.onShow = true - self:SetValue(DKCrutchDB.swing.alpha) - self.onShow = nil - end) - swingAlpha:SetScript('OnValueChanged', function(self, value) - self.valText:SetText(format('%.1f', value)) - if not self.onShow then - DKCrutchDB.swing.alpha=value - DKCrutch.swingFrame:SetAlpha(value) - end - end) - swingAlpha:SetPoint("TOPLEFT",200,-458) - swingAlpha:Show() - - local swingDisableBtn = DKCrutch:CreateCheckButton(L.CONFIG_DISABLE_SWING, DKCrutch.configPanel, DKCrutchDB, "swingDisabled", false) - swingDisableBtn:SetPoint('TOPLEFT', 10, -478) + local srSoundEnableBtn = DKCrutch:CreateCheckButton(L.CONFIG_ENABLE_SRSOUND, DKCrutch.configPanel, DKCrutchDB, "srSoundEnable", false) + srSoundEnableBtn:SetPoint('TOPLEFT', 10, -438) local ResetBtn = DKCrutch:CreateButton(L.CONFIG_RESET_POSITIONS, DKCrutch.configPanel) ResetBtn:SetWidth(160) @@ -621,15 +579,6 @@ function DKCrutch:ResetDB() ["relativePoint"] = "CENTER", } end - if (not DKCrutchDB.swing) or (force) then - DKCrutchDB.swing = { - ["x"] = -20, - ["y"] = 180, - ["scale"] = 1, - ["alpha"] = 1, - ["relativePoint"] = "CENTER", - } - end if (force) then DKCrutchDB.locked = false DKCrutchDB.enabled = true @@ -638,7 +587,6 @@ function DKCrutch:ResetDB() DKCrutchDB.weaponDisabled = false DKCrutchDB.runicDisabled = false DKCrutchDB.debuffDisabled = false - DKCrutchDB.swingDisabled = false end end @@ -691,9 +639,6 @@ function DKCrutch:ResetPosition() DKCrutchDB.debuff.x = 0 DKCrutchDB.debuff.y = 180 DKCrutchDB.debuff.relativePoint = "CENTER" - DKCrutchDB.swing.x = -20 - DKCrutchDB.swing.y = 180 - DKCrutchDB.swing.relativePoint = "CENTER" DKCrutch.displayFrame:ClearAllPoints() DKCrutch.displayFrame:SetPoint(DKCrutchDB.runes.relativePoint,DKCrutchDB.runes.x,DKCrutchDB.runes.y) @@ -705,8 +650,6 @@ function DKCrutch:ResetPosition() DKCrutch.weaponFrame:SetPoint(DKCrutchDB.weapon.relativePoint,DKCrutchDB.weapon.x,DKCrutchDB.weapon.y) DKCrutch.debuffFrame:ClearAllPoints() DKCrutch.debuffFrame:SetPoint(DKCrutchDB.debuff.relativePoint,DKCrutchDB.debuff.x,DKCrutchDB.debuff.y) - DKCrutch.swingFrame:ClearAllPoints() - DKCrutch.swingFrame:SetPoint(DKCrutchDB.swing.relativePoint,DKCrutchDB.swing.x,DKCrutchDB.swing.y) end function DKCrutch:MakeDraggable(frame,store) @@ -756,7 +699,6 @@ function DKCrutch:ShowHideFrames( visible ) DKCrutch.weaponFrame:Show(); DKCrutch.runicFrame:Show(); DKCrutch.debuffFrame:Show(); - DKCrutch.swingFrame:Show(); else DKCrutch.displayFrame:Hide(); DKCrutch.advisorFrame:Hide(); @@ -764,7 +706,6 @@ function DKCrutch:ShowHideFrames( visible ) DKCrutch.weaponFrame:Hide(); DKCrutch.runicFrame:Hide(); DKCrutch.debuffFrame:Hide(); - DKCrutch.swingFrame:Hide(); end end @@ -775,7 +716,6 @@ function DKCrutch:UnLockFrames() DKCrutch:MakeDraggable(DKCrutch.weaponFrame,"weapon") DKCrutch:MakeDraggable(DKCrutch.runicFrame,"runic") DKCrutch:MakeDraggable(DKCrutch.debuffFrame,"debuff") - DKCrutch:MakeDraggable(DKCrutch.swingFrame,"swing") end function DKCrutch:CreateGUI() @@ -975,23 +915,6 @@ function DKCrutch:CreateGUI() DKCrutch.debuffFrame = debuffFrame - local swingFrame = CreateFrame("StatusBar", "DKCrutchSwingFrame", UIParent) - swingFrame:SetFrameStrata("BACKGROUND") - swingFrame:SetWidth(128) - swingFrame:SetHeight(8) - swingFrame:SetBackdrop({ - bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 32, - }) - swingFrame:SetOrientation("HORIZONTAL") - swingFrame:SetMinMaxValues(0, 128) - swingFrame:SetValue(0) - swingFrame:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar") - swingFrame:SetStatusBarColor(0,0,0,1) - swingFrame:SetAlpha(DKCrutchDB.swing.alpha or 1) - swingFrame:SetPoint(DKCrutchDB.swing.relativePoint or "CENTER",DKCrutchDB.swing.x or -20,DKCrutchDB.swing.y or 180) - - DKCrutch.swingFrame = swingFrame - if (not DKCrutchDB.locked) then DKCrutch:UnLockFrames() end diff --git a/locales/enUS.lua b/locales/enUS.lua index a346e6d..40a4f10 100755 --- a/locales/enUS.lua +++ b/locales/enUS.lua @@ -25,7 +25,5 @@ if GetLocale() then L.CONFIG_WEAPON_SCALE = "Weapon proc tracker scale" L.CONFIG_WEAPON_ALPHA = "Weapon proc tracker alpha" L.CONFIG_DISABLE_WEAPON = "Disable weapon proc tracker" - L.CONFIG_SWING_SCALE = "Swing frame scale" - L.CONFIG_SWING_ALPHA = "Swing frame alpha" - L.CONFIG_DISABLE_SWING = "Disable swing frame" + L.CONFIG_ENABLE_SRSOUND = "Play sound when Soul Repaer should be user" end \ No newline at end of file diff --git a/media/soul_reaper.ogg b/media/soul_reaper.ogg new file mode 100755 index 0000000..fa7c598 Binary files /dev/null and b/media/soul_reaper.ogg differ