Skip to content
Draft
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
20 changes: 20 additions & 0 deletions Modules/Data/Constants.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
-- keep-sorted start
local IsTBC = ECS.IsTBC
-- keep-sorted end

---@class Data
local Data = ECSLoader:ImportModule("Data")

Expand All @@ -21,6 +25,7 @@ Data.WARLOCK = 9
Data.DRUID = 11

Data.Aura = {
-- keep-sorted start block=yes case=no
AllowCastingManaRegeneration = {
[6117] = (ECS.IsWotlk and 0.5 or 0.3), -- Mage Armor rank 1
[12051] = 1, -- Evocation
Expand Down Expand Up @@ -284,6 +289,20 @@ Data.Aura = {
[25894] = (ECS.IsClassic and 1 or nil), -- Greater Blessing of Wisdom rank 1
[25918] = (ECS.IsClassic and 1 or nil), -- Greater Blessing of Wisdom rank 2
},
ReduceTargetArmor = {
-- keep-sorted start numeric=yes
[37174] = (IsTBC and 1000 or nil), -- Perceived Weakness
[37482] = (IsTBC and 600 or nil), -- Exploited Weakness
[40477] = (IsTBC and 300 or nil), -- Forceful Strike
[42976] = (IsTBC and 400 or nil), -- Executioner
[43817] = (IsTBC and 1000 or nil), -- Focused Assault
[47216] = 1092, -- Piercing Fangs
[54678] = 50000, -- Brute Force
[461252] = 2000, -- Shadowflame Fury
[1231894] = 1000, -- Ferocity of the Crocolisk
[1231896] = 500, -- Brilliance of Mr. Bigglesworth
-- keep-sorted end
},
SpellCrit = {
[24907] = ((not ECS.IsClassic) and 5 or nil), -- Moonkin Aura
[29177] = 6, -- Elemental Devastation Rank 2
Expand Down Expand Up @@ -355,6 +374,7 @@ Data.Aura = {
[1227200] = 20, -- Wickedness
[1236220] = -50, -- Slow
},
-- keep-sorted end
}
Data.Enchant = {
BlockValue = {
Expand Down
7 changes: 6 additions & 1 deletion Modules/Data/Data.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
-- keep-sorted start
local IsWotlk = ECS.IsWotlk
-- keep-sorted end

---@class Data
local Data = ECSLoader:CreateModule("Data")

Expand All @@ -24,7 +28,8 @@ dataFunctionRefs = {
["MeleeCritChance"] = function() return Data:MeleeCrit() end,
["Expertise"] = function() return ECS.IsClassic and 0 or Data:GetExpertise() end,
["ExpertiseRating"] = function() return ECS.IsClassic and 0 or Data:GetExpertiseRating() end,
["MeleeArmorPenetration"] = function() return Data:GetArmorPenetration() end,
["MeleeArmorPenetrationFlat"] = function() return Data:GetArmorPenetrationFlat() end,
["MeleeArmorPenetrationPercentage"] = function() return IsWotlk and Data:GetArmorPenetrationPercentage() or 0 end,
["MeleeArmorPenetrationRating"] = function() return ECS.IsWotlk and Data:GetArmorPenetrationRating() or 0 end,
["MeleeHitRating"] = function() return ECS.IsClassic and 0 or Data:MeleeHitRating() end,
["MeleeHitBonus"] = function() return Data:MeleeHitBonus() end,
Expand Down
75 changes: 75 additions & 0 deletions Modules/Data/General.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
-- keep-sorted start case=no
local GetArmorPenetration = GetArmorPenetration
local GetBuffDataByIndex = C_UnitAuras.GetBuffDataByIndex
local GetCombatRating = GetCombatRating
local GetShapeshiftFormInfo = GetShapeshiftFormInfo
local IsWotlk = ECS.IsWotlk
local UnitClass = UnitClass
local UnitLevel = UnitLevel
-- keep-sorted end

---@class Data
local Data = ECSLoader:ImportModule("Data")
---@type DataUtils
local DataUtils = ECSLoader:ImportModule("DataUtils")

-- keep-sorted start case=no
local _, _, classId = UnitClass("player")
local playerLevel = UnitLevel("player")
-- keep-sorted end

---@return string
function Data:GetMovementSpeed()
Expand All @@ -20,4 +34,65 @@ function Data:GetMovementSpeed()

currentSpeed = currentSpeed / 7 * 100
return DataUtils:Round(currentSpeed, 0) .. "%"
end

---@return number
function Data:GetArmorPenetrationFlat()
local armorPenetration = 0

if classId == Data.ROGUE and not IsWotlk then
armorPenetration = armorPenetration + playerLevel * 5/3 * DataUtils:GetActiveTalentSpell({14171,14172,14173}) -- Serrated Blades
end

local i = 1
repeat
local aura = GetBuffDataByIndex("player", i)
if aura and aura.spellId then
armorPenetration = armorPenetration + (Data.Aura.ReduceTargetArmor[aura.spellId] or 0)
if not ECS.IsWotlk then
if aura.spellId == 26481 then
armorPenetration = armorPenetration + 200 * aura.applications -- Insight of the Qiraji
elseif aura.spellId == 21153 then
armorPenetration = armorPenetration + 700 * aura.applications -- Bonereaver's Edge
elseif aura.spellId == 38307 then
armorPenetration = armorPenetration + 435 * aura.applications -- The Dark of Night
end
end
end
i = i + 1
until (not aura)

return DataUtils:Round(armorPenetration, 2)
end

---@return string
function Data:GetArmorPenetrationPercentage()
local armorPenetration = 0

if ECS.IsWotlk then
armorPenetration = GetArmorPenetration()
if classId == Data.WARRIOR then
local _, isActive = GetShapeshiftFormInfo(1)
if isActive then
armorPenetration = armorPenetration + 10 -- 10% from Battle Stance
end
-- TODO: mace specialization
elseif classId == Data.ROGUE then
armorPenetration = armorPenetration + 3 * DataUtils:GetActiveTalentSpell({14171,14172,14173}) -- Serrated Blades
-- TODO: mace specialization
elseif classId == Data.DEATHKNIGHT then
armorPenetration = armorPenetration + 2 * DataUtils:GetActiveTalentSpell({61274,61275,61276,61277,61278}) -- Blood Gorged
end
end

return DataUtils:Round(armorPenetration, 2) .. "%"
end

---@return number
function Data:GetArmorPenetrationRating()
local arpen = 0
if ECS.IsWotlk then
arpen = GetCombatRating(CR_ARMOR_PENETRATION)
end
return arpen
end
13 changes: 1 addition & 12 deletions Modules/Data/Melee.lua
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,6 @@ function Data:GetArmorPenetration()
return DataUtils:Round(armorPenetration, 2) .. "%"
end

---@return number
function Data:GetArmorPenetrationRating()
if (not CR_ARMOR_PENETRATION) then
return 0
end

local armorPenetrationRating = GetCombatRating(CR_ARMOR_PENETRATION)
return DataUtils:Round(armorPenetrationRating, 0)
end

---@return number
function Data:GetMeleeHasteRating()
if (not CR_HASTE_MELEE) then
Expand All @@ -253,5 +243,4 @@ function Data:GetMeleeHasteBonus()

local hasteBonus = GetCombatRatingBonus(CR_HASTE_MELEE)
return DataUtils:Round(hasteBonus, 2) .. "%"
end

end
Loading