Skip to content

Commit

Permalink
Adding fix for issue where getting haste buffs in the middle of comba…
Browse files Browse the repository at this point in the history
…t would throw off the timers
  • Loading branch information
LeftHandedGlove committed Jun 5, 2019
1 parent dd2c009 commit 7b37dca
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
*.zip
17 changes: 15 additions & 2 deletions WeaponSwingTimer_Hunter.lua
Expand Up @@ -24,7 +24,7 @@ addon_data.hunter.default_settings = {
addon_data.hunter.shooting = false
addon_data.hunter.range_speed = 3.0
addon_data.hunter.auto_cast_time = 0.65
addon_data.hunter.shot_timer = 0.5
addon_data.hunter.shot_timer = 0.65
addon_data.hunter.last_shot_time = 0
addon_data.hunter.auto_shot_ready = true

Expand Down Expand Up @@ -151,7 +151,20 @@ end

addon_data.hunter.OnUpdate = function(elapsed)
-- Update the ranged attack speed
addon_data.hunter.range_speed, _, _, _, _, _ = UnitRangedDamage("player")
new_range_speed, _, _, _, _, _ = UnitRangedDamage("player")
if new_range_speed ~= addon_data.hunter.range_speed then
print(addon_data.hunter.range_speed)
print(new_range_speed)
print(addon_data.hunter.shot_timer)
if not addon_data.hunter.auto_shot_ready then
addon_data.hunter.shot_timer = addon_data.hunter.shot_timer *
(new_range_speed / addon_data.hunter.range_speed)
end
addon_data.hunter.range_speed = new_range_speed
print(addon_data.hunter.range_speed)
print(new_range_speed)
print(addon_data.hunter.shot_timer)
end
addon_data.hunter.UpdateRangeCastSpeedModifier()
-- Check to see if we have moved
addon_data.hunter.has_moved = (GetUnitSpeed("player") > 0)
Expand Down
18 changes: 16 additions & 2 deletions WeaponSwingTimer_Player.lua
Expand Up @@ -52,12 +52,26 @@ addon_data.player.UpdateInfo = function()
addon_data.player.class = UnitClass("player")[2]
addon_data.player.main_weapon_id = GetInventoryItemID("player", 16)
addon_data.player.off_weapon_id = GetInventoryItemID("player", 17)
addon_data.player.main_weapon_speed, addon_data.player.off_weapon_speed = UnitAttackSpeed("player")
if not addon_data.player.off_weapon_speed then
-- Update the weapon swing speed
new_main_speed, new_off_speed = UnitAttackSpeed("player")
if not new_off_speed then
addon_data.player.has_offhand = false
else
addon_data.player.has_offhand = true
end
if new_main_speed ~= addon_data.player.main_weapon_speed or
new_off_speed ~= addon_data.player.off_weapon_speed then
addon_data.player.main_swing_timer = addon_data.player.main_swing_timer *
(new_main_speed /addon_data.player.main_weapon_speed)
addon_data.player.main_weapon_speed = new_main_speed
if addon_data.player.has_offhand then
addon_data.player.off_swing_timer = addon_data.player.off_swing_timer *
(new_off_speed /addon_data.player.off_weapon_speed)
addon_data.player.off_weapon_speed = off_main_speed
end

end

addon_data.player.guid = UnitGUID("player")
end

Expand Down
17 changes: 15 additions & 2 deletions WeaponSwingTimer_Target.lua
Expand Up @@ -57,12 +57,25 @@ addon_data.target.UpdateInfo = function()
addon_data.target.class = UnitClass("target")[2]
addon_data.target.main_weapon_id = GetInventoryItemID("target", 16)
addon_data.target.off_weapon_id = GetInventoryItemID("target", 17)
addon_data.target.main_weapon_speed, addon_data.target.off_weapon_speed = UnitAttackSpeed("target")
if not addon_data.target.off_weapon_speed then
-- Update the weapon swing speed
new_main_speed, new_off_speed = UnitAttackSpeed("target")
if not new_off_speed then
addon_data.target.has_offhand = false
else
addon_data.target.has_offhand = true
end
if new_main_speed ~= addon_data.target.main_weapon_speed or
new_off_speed ~= addon_data.target.off_weapon_speed then
addon_data.target.main_swing_timer = addon_data.target.main_swing_timer *
(new_main_speed /addon_data.target.main_weapon_speed)
addon_data.target.main_weapon_speed = new_main_speed
if addon_data.target.has_offhand then
addon_data.target.off_swing_timer = addon_data.target.off_swing_timer *
(new_off_speed /addon_data.target.off_weapon_speed)
addon_data.target.off_weapon_speed = off_main_speed
end
end

addon_data.target.guid = UnitGUID("target")
end
end
Expand Down

0 comments on commit 7b37dca

Please sign in to comment.