Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions Modules/Config/RangeSection.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ function _Config:LoadRangeSection()
inline = false,
width = 2,
name = function() return i18n("Ranged") end,
hidden = function() return UnitHasRelicSlot("player") end,
args = {
showRangeStats = {
type = "toggle",
order = 0,
name = function() return i18n("Show Ranged Stats") end,
desc = function() return i18n("Shows/Hides all ranged stats.") end,
width = 1.5,
hidden = function() return UnitHasRelicSlot("player") end,
get = function () return ExtendedCharacterStats.profile.ranged.display; end,
set = function (_, value)
ExtendedCharacterStats.profile.ranged.display = value
Expand All @@ -33,6 +35,7 @@ function _Config:LoadRangeSection()
name = function() return i18n("Ranged Attack Power") end,
desc = function() return i18n("Shows/Hides the ranged attack power value.") end,
width = 1.5,
hidden = function() return UnitHasRelicSlot("player") end,
disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end,
get = function () return ExtendedCharacterStats.profile.ranged.attackPower.display; end,
set = function (_, value)
Expand All @@ -46,6 +49,7 @@ function _Config:LoadRangeSection()
name = function() return i18n("Ranged Crit") end,
desc = function() return i18n("Shows/Hides the ranged crit chance.") end,
width = 1.5,
hidden = function() return UnitHasRelicSlot("player") end,
disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end,
get = function () return ExtendedCharacterStats.profile.ranged.crit.display; end,
set = function (_, value)
Expand All @@ -59,9 +63,7 @@ function _Config:LoadRangeSection()
name = function() return i18n("Armor Pen.") end,
desc = function() return i18n("Shows/Hides the armor penetration value.") end,
width = 1.5,
hidden = function()
return (not ECS.IsWotlk)
end,
hidden = function() return ECS.IsClassic or UnitHasRelicSlot("player") end,
disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end,
get = function () return ExtendedCharacterStats.profile.ranged.penetration.display; end,
set = function (_, value)
Expand All @@ -75,9 +77,7 @@ function _Config:LoadRangeSection()
name = function() return i18n("Armor Pen. Rating") end,
desc = function() return i18n("Shows/Hides the armor penetration rating value.") end,
width = 1.5,
hidden = function()
return (not ECS.IsWotlk)
end,
hidden = function() return (not ECS.IsWotlk) or UnitHasRelicSlot("player") end,
disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end,
get = function () return ExtendedCharacterStats.profile.ranged.penetrationRating.display; end,
set = function (_, value)
Expand All @@ -91,9 +91,7 @@ function _Config:LoadRangeSection()
name = function() return i18n("Haste Rating") end,
desc = function() return i18n("Shows/Hides the ranged haste rating.") end,
width = 1.5,
hidden = function()
return (not ECS.IsWotlk)
end,
hidden = function() return ECS.IsClassic or UnitHasRelicSlot("player") end,
disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end,
get = function () return ExtendedCharacterStats.profile.ranged.hasteRating.display; end,
set = function (_, value)
Expand All @@ -107,9 +105,7 @@ function _Config:LoadRangeSection()
name = function() return i18n("Haste Bonus") end,
desc = function() return i18n("Shows/Hides the ranged haste bonus value.") end,
width = 1.5,
hidden = function()
return (not ECS.IsWotlk)
end,
hidden = function() return UnitHasRelicSlot("player") end,
disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end,
get = function () return ExtendedCharacterStats.profile.ranged.hasteBonus.display; end,
set = function (_, value)
Expand All @@ -123,6 +119,7 @@ function _Config:LoadRangeSection()
name = function() return i18n("Attack Speed") end,
desc = function() return i18n("Shows/Hides the ranged attack speed.") end,
width = 1.5,
hidden = function() return UnitHasRelicSlot("player") end,
disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end,
get = function () return ExtendedCharacterStats.profile.ranged.attackSpeed.display; end,
set = function (_, value)
Expand All @@ -136,6 +133,7 @@ function _Config:LoadRangeSection()
name = function() return i18n("Ranged Hit") end,
desc = function() return i18n("Shows/Hides all ranged hit chance.") end,
width = 1.5,
hidden = function() return UnitHasRelicSlot("player") end,
disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end,
get = function () return ExtendedCharacterStats.profile.ranged.hit.display; end,
set = function (_, value)
Expand All @@ -155,9 +153,7 @@ function _Config:LoadRangeSection()
name = function() return i18n("Hit Rating") end,
desc = function() return i18n("Shows/Hides the ranged hit rating.") end,
width = 1.5,
hidden = function()
return (not ECS.IsWotlk)
end,
hidden = function() return ECS.IsClassic or UnitHasRelicSlot("player") end,
disabled = function()
return ((not ExtendedCharacterStats.profile.ranged.display) or
(not ExtendedCharacterStats.profile.ranged.hit.display))
Expand All @@ -174,6 +170,7 @@ function _Config:LoadRangeSection()
name = function() return i18n("Hit Bonus") end,
desc = function() return i18n("Shows/Hides the ranged hit bonus.") end,
width = 1.5,
hidden = function() return UnitHasRelicSlot("player") end,
disabled = function()
return ((not ExtendedCharacterStats.profile.ranged.display) or
(not ExtendedCharacterStats.profile.ranged.hit.display))
Expand All @@ -190,6 +187,7 @@ function _Config:LoadRangeSection()
name = function() return i18n("Miss Chance") end,
desc = function() return i18n("Shows/Hides the ranged miss chance against enemies on the same level.") end,
width = 1.5,
hidden = function() return UnitHasRelicSlot("player") end,
disabled = function()
return ((not ExtendedCharacterStats.profile.ranged.display) or
(not ExtendedCharacterStats.profile.ranged.hit.display))
Expand All @@ -206,6 +204,7 @@ function _Config:LoadRangeSection()
name = function() return i18n("Miss Chance Boss") end,
desc = function() return i18n("Shows/Hides the ranged miss chance against boss enemies (+3 Level).") end,
width = 1.5,
hidden = function() return UnitHasRelicSlot("player") end,
disabled = function()
return ((not ExtendedCharacterStats.profile.ranged.display) or
(not ExtendedCharacterStats.profile.ranged.hit.display))
Expand Down
7 changes: 1 addition & 6 deletions Modules/Data/Ranged.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,14 @@ local _, _, classId = UnitClass("player")

---@return number
function Data:GetRangeAttackPower()
if not _Ranged:IsRangeAttackClass() then
if UnitHasRelicSlot("player") then
return 0
end

local melee, posBuff, negBuff = UnitRangedAttackPower("player")
return melee + posBuff + negBuff
end

---@return boolean
function _Ranged:IsRangeAttackClass()
return classId == Data.WARRIOR or classId == Data.ROGUE or classId == Data.HUNTER
end

---@return number
function Data:GetRangedHasteRating()
local hasteRating = GetCombatRating(CR_HASTE_RANGED)
Expand Down
19 changes: 13 additions & 6 deletions Modules/Stats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,19 @@ _CreateStatInfos = function()
_CreateStatInfo(category, category.mainHand, category.offHand)
end

category = profile.ranged
if ECS.IsWotlk then
_CreateStatInfo(category, category.attackPower, category.crit, category.penetration, category.penetrationRating,
category.hasteRating, category.hasteBonus, category.attackSpeed)
else
_CreateStatInfo(category, category.attackPower, category.crit, category.attackSpeed)
if not UnitHasRelicSlot("player") then
category = profile.ranged
_CreateStatInfo(
category,
category.attackPower,
ECS.IsClassic and nil or category.critRating,
category.crit,
ECS.IsWotlk and category.penetrationRating or nil,
ECS.IsClassic and nil or category.penetration,
ECS.IsClassic and nil or category.hasteRating,
category.hasteBonus,
category.attackSpeed
)
end

if category.display then
Expand Down
Loading