Skip to content

Commit 5f3a6f8

Browse files
too many things
1 parent cd8d1d2 commit 5f3a6f8

23 files changed

Lines changed: 130 additions & 244 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
# IntelliJ settings
1212
.idea/
1313

14+
# vscode settings
15+
.vscode/
16+
1417
#This is used for the atom build package, enables the build to happen on each save.
1518
.atom-build.yml
1619

Modules/Config/DefenseSection.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,7 @@ function _Config:LoadDefenseSection()
190190
name = function() return i18n("Resilience") end,
191191
desc = function() return i18n("Shows/Hides the resilience value.") end,
192192
width = 1.5,
193-
hidden = function()
194-
return (not ECS.IsWotlk)
195-
end,
193+
hidden = function() return ECS.IsClassic end,
196194
disabled = function() return (not ExtendedCharacterStats.profile.defense.display); end,
197195
get = function () return ExtendedCharacterStats.profile.defense.resilience.display; end,
198196
set = function (_, value)

Modules/Config/MeleeSection.lua

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ function _Config:LoadMeleeSection()
5959
name = function() return i18n("Armor Pen.") end,
6060
desc = function() return i18n("Shows/Hides the armor penetration value.") end,
6161
width = 1.5,
62-
hidden = function()
63-
return (not ECS.IsWotlk)
64-
end,
6562
disabled = function() return (not ExtendedCharacterStats.profile.melee.display); end,
6663
get = function () return ExtendedCharacterStats.profile.melee.penetration.display; end,
6764
set = function (_, value)
@@ -89,9 +86,7 @@ function _Config:LoadMeleeSection()
8986
name = function() return i18n("Expertise") end,
9087
desc = function() return i18n("Shows/Hides the expertise value.") end,
9188
width = 1.5,
92-
hidden = function()
93-
return (not ECS.IsWotlk)
94-
end,
89+
hidden = function() return ECS.IsClassic end,
9590
disabled = function() return (not ExtendedCharacterStats.profile.melee.display); end,
9691
get = function () return ExtendedCharacterStats.profile.melee.expertise.display; end,
9792
set = function (_, value)
@@ -133,9 +128,6 @@ function _Config:LoadMeleeSection()
133128
name = function() return i18n("Haste Bonus") end,
134129
desc = function() return i18n("Shows/Hides the melee haste bonus value.") end,
135130
width = 1.5,
136-
hidden = function()
137-
return (not ECS.IsWotlk)
138-
end,
139131
disabled = function() return (not ExtendedCharacterStats.profile.melee.display); end,
140132
get = function () return ExtendedCharacterStats.profile.melee.hasteBonus.display; end,
141133
set = function (_, value)
@@ -310,7 +302,7 @@ function _Config:LoadMeleeSection()
310302
end,
311303
get = function () return ExtendedCharacterStats.profile.melee.glance.damageBossLevel.display; end,
312304
set = function (_, value)
313-
ExtendedCharacterStats.profile.melee.glance.damageSameLevel.display = value
305+
ExtendedCharacterStats.profile.melee.glance.damageBossLevel.display = value
314306
Stats.RebuildStatInfos()
315307
end,
316308
},

Modules/Config/RangeSection.lua

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ function _Config:LoadRangeSection()
5959
name = function() return i18n("Armor Pen.") end,
6060
desc = function() return i18n("Shows/Hides the armor penetration value.") end,
6161
width = 1.5,
62-
hidden = function()
63-
return (not ECS.IsWotlk)
64-
end,
6562
disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end,
6663
get = function () return ExtendedCharacterStats.profile.ranged.penetration.display; end,
6764
set = function (_, value)
@@ -103,9 +100,6 @@ function _Config:LoadRangeSection()
103100
name = function() return i18n("Haste Bonus") end,
104101
desc = function() return i18n("Shows/Hides the ranged haste bonus value.") end,
105102
width = 1.5,
106-
hidden = function()
107-
return (not ECS.IsWotlk)
108-
end,
109103
disabled = function() return (not ExtendedCharacterStats.profile.ranged.display); end,
110104
get = function () return ExtendedCharacterStats.profile.ranged.hasteBonus.display; end,
111105
set = function (_, value)

Modules/Config/SpellSection.lua

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ function _Config:LoadSpellSection()
6060
name = function() return i18n("Haste Bonus") end,
6161
desc = function() return i18n("Shows/Hides the spell haste bonus value.") end,
6262
width = 1.5,
63-
hidden = function()
64-
return (not ECS.IsWotlk)
65-
end,
6663
disabled = function() return (not ExtendedCharacterStats.profile.spell.display); end,
6764
get = function () return ExtendedCharacterStats.profile.spell.hasteBonus.display; end,
6865
set = function (_, value)

Modules/Data/Constants.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---@type Data
1+
---@class Data
22
local Data = ECSLoader:ImportModule("Data")
33

44
Data.PHYSICAL_SCHOOL = 1

Modules/Data/Data.lua

Lines changed: 19 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ local playerLevel = UnitLevel("player")
66
local enemyLevel = playerLevel + 3
77

88
---@param refName string
9-
---@return number | string
9+
---@return number | nil
1010
function Data.GetStatInfo(refName)
1111
local dataFunction = dataFunctionRefs[refName];
1212
if dataFunction then
1313
return dataFunction()
1414
else
1515
ECS:Print("Invalid data refName: " .. refName)
16+
return nil
1617
end
1718
end
1819

@@ -21,41 +22,11 @@ dataFunctionRefs = {
2122
-- Melee
2223
["MeleeAttackPower"] = function() return Data:GetMeleeAttackPower() end,
2324
["MeleeCritChance"] = function() return Data:MeleeCrit() end,
24-
["Expertise"] = function()
25-
if ECS.IsWotlk then
26-
return Data:GetExpertise()
27-
else
28-
return 0
29-
end
30-
end,
31-
["ExpertiseRating"] = function()
32-
if ECS.IsWotlk then
33-
return Data:GetExpertiseRating()
34-
else
35-
return 0
36-
end
37-
end,
38-
["MeleeArmorPenetration"] = function()
39-
if ECS.IsWotlk then
40-
return Data:GetArmorPenetration()
41-
else
42-
return 0
43-
end
44-
end,
45-
["MeleeArmorPenetrationRating"] = function()
46-
if ECS.IsWotlk then
47-
return Data:GetArmorPenetrationRating()
48-
else
49-
return 0
50-
end
51-
end,
52-
["MeleeHitRating"] = function()
53-
if ECS.IsWotlk then
54-
return Data:MeleeHitRating()
55-
else
56-
return 0
57-
end
58-
end,
25+
["Expertise"] = function() return ECS.IsClassic and 0 or Data:GetExpertise() end,
26+
["ExpertiseRating"] = function() return ECS.IsClassic and 0 or Data:GetExpertiseRating() end,
27+
["MeleeArmorPenetration"] = function() return Data:GetArmorPenetration() end,
28+
["MeleeArmorPenetrationRating"] = function() return ECS.IsClassic and 0 or Data:GetArmorPenetrationRating() end,
29+
["MeleeHitRating"] = function() return ECS.IsClassic and 0 or Data:MeleeHitRating() end,
5930
["MeleeHitBonus"] = function() return Data:MeleeHitBonus() end,
6031
["MeleeHitSameLevel"] = function() return Data:MeleeHitMissChanceSameLevel() end,
6132
["MeleeHitBossLevel"] = function() return Data:MeleeHitMissChanceBossLevel() end,
@@ -66,63 +37,21 @@ dataFunctionRefs = {
6637
["GlanceDamageSameLevel"] = function() return Data:GlanceDamageSameLevel() end,
6738
["GlanceDamageBossLevel"] = function() return Data:GlanceDamageBossLevel() end,
6839

69-
["MeleeHasteRating"] = function()
70-
if ECS.IsWotlk then
71-
return Data:GetMeleeHasteRating()
72-
else
73-
return 0
74-
end
75-
end,
76-
["MeleeHasteBonus"] = function()
77-
if ECS.IsWotlk then
78-
return Data:GetMeleeHasteBonus()
79-
else
80-
return 0
81-
end
82-
end,
40+
["MeleeHasteRating"] = function() return ECS.IsClassic and 0 or Data:GetMeleeHasteRating() end,
41+
["MeleeHasteBonus"] = function() return Data:GetMeleeHasteBonus() end,
8342
["MeleeAttackSpeedMainHand"] = function() return Data:GetMeleeAttackSpeedMainHand() end,
8443
["MeleeAttackSpeedOffHand"] = function() return Data:GetMeleeAttackSpeedOffHand() end,
8544
-- Ranged
8645
["RangeAttackpower"] = function() return Data:GetRangeAttackPower() end,
8746
["RangedCritChance"] = function() return Data:RangedCrit() end,
88-
["RangedHitRating"] = function()
89-
if ECS.IsWotlk then
90-
return Data:RangeHitRating()
91-
else
92-
return 0
93-
end
94-
end,
47+
["RangedHitRating"] = function() return ECS.IsClassic and 0 or Data:RangeHitRating() end,
9548
["RangedHitBonus"] = function() return Data:RangeHitBonus() end,
9649
["RangedHitSameLevel"] = function() return Data:RangeMissChanceSameLevel() end,
97-
["RangedArmorPenetration"] = function()
98-
if ECS.IsWotlk then
99-
return Data:GetArmorPenetration()
100-
else
101-
return 0
102-
end
103-
end,
104-
["RangedArmorPenetrationRating"] = function()
105-
if ECS.IsWotlk then
106-
return Data:GetArmorPenetrationRating()
107-
else
108-
return 0
109-
end
110-
end,
50+
["RangedArmorPenetration"] = function() return Data:GetArmorPenetration() end,
51+
["RangedArmorPenetrationRating"] = function() return ECS.IsClassic and 0 or Data:GetArmorPenetrationRating() end,
11152
["RangedHitBossLevel"] = function() return Data.RangeMissChanceBossLevel() end,
112-
["RangedHasteRating"] = function()
113-
if ECS.IsWotlk then
114-
return Data:GetRangedHasteRating()
115-
else
116-
return 0
117-
end
118-
end,
119-
["RangedHasteBonus"] = function()
120-
if ECS.IsWotlk then
121-
return Data:GetRangedHasteBonus()
122-
else
123-
return 0
124-
end
125-
end,
53+
["RangedHasteRating"] = function() return ECS.IsClassic and 0 or Data:GetRangedHasteRating() end,
54+
["RangedHasteBonus"] = function() return Data:GetRangedHasteBonus() end,
12655
["RangedAttackSpeed"] = function() return Data:GetRangedAttackSpeed() end,
12756
-- Defense
12857
["Armor"] = function() return Data:GetArmorValue() end,
@@ -131,51 +60,21 @@ dataFunctionRefs = {
13160
["SpellCritReduction"] = function() return Data:GetSpellCritReduction() end,
13261
["Avoidance"] = function() return Data:GetAvoidance(playerLevel) end,
13362
["AvoidanceBoss"] = function() return Data:GetAvoidance(enemyLevel) end,
134-
["DefenseRating"] = function()
135-
if ECS.IsWotlk then
136-
return Data:GetDefenseRating()
137-
else
138-
return 0
139-
end
140-
end,
63+
["DefenseRating"] = function() return ECS.IsClassic and 0 or Data:GetDefenseRating() end,
14164
["DefenseValue"] = function() return Data:GetDefenseValue() end,
14265
["DodgeChance"] = function() return Data:GetDodgeChance() end,
14366
["ParryChance"] = function() return Data:GetParryChance() end,
14467
["BlockChance"] = function() return Data:GetBlockChance() end,
14568
["BlockValue"] = function() return Data:GetBlockValue() end,
146-
["ResilienceValue"] = function()
147-
if ECS.IsWotlk then
148-
return Data:GetResilienceRating()
149-
else
150-
return 0
151-
end
152-
end,
69+
["ResilienceValue"] = function() return ECS.IsClassic and 0 or Data:GetResilienceRating() end,
15370
-- Spell
154-
["SpellHitRating"] = function()
155-
if ECS.IsWotlk then
156-
return Data:SpellHitRating()
157-
else
158-
return 0
159-
end
160-
end,
71+
["SpellHitRating"] = function() return ECS.IsClassic and 0 or Data:SpellHitRating() end,
16172
["SpellHitBonus"] = function() return Data.SpellHitBonus(Data.HOLY_SCHOOL) end,
16273
["SpellHitSameLevel"] = function() return Data:SpellMissChanceSameLevel(Data.HOLY_SCHOOL) end,
16374
["SpellHitBossLevel"] = function() return Data:SpellMissChanceBossLevel(Data.HOLY_SCHOOL) end,
16475
["SpellCritChance"] = function() return Data:GetSpellCrit(Data.HOLY_SCHOOL) end,
165-
["SpellHasteRating"] = function()
166-
if ECS.IsWotlk then
167-
return Data:GetSpellHasteRating()
168-
else
169-
return 0
170-
end
171-
end,
172-
["SpellHasteBonus"] = function()
173-
if ECS.IsWotlk then
174-
return Data:GetSpellHasteBonus()
175-
else
176-
return "0 %"
177-
end
178-
end,
76+
["SpellHasteRating"] = function() return ECS.IsClassic and 0 or Data:GetSpellHasteRating() end,
77+
["SpellHasteBonus"] = function() return Data:GetSpellHasteBonus() end,
17978
["SpellPenetration"] = function() return Data:GetSpellPenetration() end,
18079
-- MP5
18180
["MP5Items"] = function() return Data:GetMP5FromItems() end,

Modules/Data/DataUtils.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ end
105105
---@return number|nil
106106
function DataUtils:GetEnchantFromItemLink(itemLink)
107107
if itemLink then
108-
local _, itemStringLink = GetItemInfo(itemLink)
108+
local _, itemStringLink = C_Item.GetItemInfo(itemLink)
109109
if itemStringLink then
110110
local _, _, enchant = string.find(itemStringLink, "item:%d+:(%d*)")
111111
return tonumber(enchant)
@@ -129,10 +129,10 @@ function DataUtils.GetRuneForEquipSlot(equipSlot)
129129
end
130130

131131
---@param itemLink ItemLink
132-
---@return (number, number, number) | nil
132+
---@return number | nil, number | nil, number | nil
133133
function DataUtils:GetSocketedGemsFromItemLink(itemLink)
134134
if itemLink then
135-
local _, itemStringLink = GetItemInfo(itemLink)
135+
local _, itemStringLink = C_Item.GetItemInfo(itemLink)
136136
if itemStringLink then
137137
local _, _, gem1, gem2, gem3 = string.find(itemStringLink, "item:%d*:%d*:(%d*):(%d*):(%d*)")
138138
return gem1, gem2, gem3

Modules/Data/Defense.lua

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---@type Data
1+
---@class Data
22
local Data = ECSLoader:ImportModule("Data")
33
---@type DataUtils
44
local DataUtils = ECSLoader:ImportModule("DataUtils")
@@ -20,7 +20,7 @@ function Data:GetArmorValue()
2020
return DataUtils:Round(effectiveArmor, 2)
2121
end
2222

23-
---@return (number, number, number)
23+
---@return number, number, number
2424
function _Defense:GetCritReduction()
2525
local defBonus = Data:GetDefenseValue()
2626

@@ -68,29 +68,29 @@ function _Defense:GetCritReduction()
6868
end
6969
elseif classId == Data.PRIEST then
7070
if ECS.IsTBC then
71-
if IsPlayerSpell(33371) then -- Shadow Resilience 2/2
71+
if C_SpellBook.IsSpellKnown(33371) then -- Shadow Resilience 2/2
7272
spellCritReduction = spellCritReduction + 4
73-
elseif IsPlayerSpell(14910) then -- Shadow Resilience 1/2
73+
elseif C_SpellBook.IsSpellKnown(14910) then -- Shadow Resilience 1/2
7474
spellCritReduction = spellCritReduction + 2
7575
end
7676
end
7777
elseif classId == Data.ROGUE then
78-
if IsPlayerSpell(30893) then -- Sleight of Hand 2/2
78+
if C_SpellBook.IsSpellKnown(30893) then -- Sleight of Hand 2/2
7979
meleeCritReduction = meleeCritReduction + 2
8080
rangedCritReduction = rangedCritReduction + 2
81-
elseif IsPlayerSpell(30892) then -- Sleight of Hand 1/2
81+
elseif C_SpellBook.IsSpellKnown(30892) then -- Sleight of Hand 1/2
8282
meleeCritReduction = meleeCritReduction + 1
8383
rangedCritReduction = rangedCritReduction + 1
8484
end
8585
elseif classId == Data.WARLOCK then
8686
if ECS.IsTBC or ECS.IsWotlk then
87-
if IsPlayerSpell(30321) then -- Demonic Resilience 3/3
87+
if C_SpellBook.IsSpellKnown(30321) then -- Demonic Resilience 3/3
8888
meleeCritReduction = meleeCritReduction + 3
8989
spellCritReduction = spellCritReduction + 3
90-
elseif IsPlayerSpell(30320) then -- Demonic Resilience 2/3
90+
elseif C_SpellBook.IsSpellKnown(30320) then -- Demonic Resilience 2/3
9191
meleeCritReduction = meleeCritReduction + 2
9292
spellCritReduction = spellCritReduction + 2
93-
elseif IsPlayerSpell(30319) then -- Demonic Resilience 1/3
93+
elseif C_SpellBook.IsSpellKnown(30319) then -- Demonic Resilience 1/3
9494
meleeCritReduction = meleeCritReduction + 1
9595
spellCritReduction = spellCritReduction + 1
9696
end
@@ -158,7 +158,7 @@ end
158158
---@return number
159159
function _Defense:GetBlockChance()
160160
local block = 0
161-
if IsPlayerSpell(107) and C_PaperDollInfo.OffhandHasShield() then
161+
if C_SpellBook.IsSpellKnown(107) and C_PaperDollInfo.OffhandHasShield() then
162162
block = GetBlockChance()
163163
end
164164
return block
@@ -167,7 +167,7 @@ end
167167
---@return number
168168
function _Defense:GetParryChance()
169169
local parry = 0
170-
if IsPlayerSpell(3127) or IsPlayerSpell(18848) or IsPlayerSpell(3124) then
170+
if C_SpellBook.IsSpellKnown(3127) or C_SpellBook.IsSpellKnown(18848) or C_SpellBook.IsSpellKnown(3124) then
171171
parry = GetParryChance()
172172
end
173173
return parry
@@ -176,7 +176,7 @@ end
176176
---@return number
177177
function _Defense:GetDodgeChance()
178178
local dodge = 0
179-
if IsPlayerSpell(81) then
179+
if C_SpellBook.IsSpellKnown(81) then
180180
dodge = GetDodgeChance()
181181
end
182182
return dodge

Modules/Data/General.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---@type Data
1+
---@class Data
22
local Data = ECSLoader:ImportModule("Data")
33
---@type DataUtils
44
local DataUtils = ECSLoader:ImportModule("DataUtils")

0 commit comments

Comments
 (0)