Skip to content
45 changes: 32 additions & 13 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ stds.ecs = {
read_globals = {}, -- these globals can only be accessed.
globals = {
"----> GlobalAPI",
-- keep-sorted start case=no
"AbandonQuest",
"AbandonSkill",
"AcceptAreaSpiritHeal",
Expand Down Expand Up @@ -117,8 +118,8 @@ stds.ecs = {
"C_ActionBar.IsEnabledAutoCastPetAction",
"C_ActionBar.IsOnBarOrSpecialBar",
"C_ActionBar.ToggleAutoCastPetAction",
"C_AddOns.GetAddOnInfo",
"C_AddOns",
"C_AddOns.GetAddOnInfo",
"C_AreaPoiInfo.GetAreaPOIForMap",
"C_AreaPoiInfo.GetAreaPOIInfo",
"C_AreaPoiInfo.IsAreaPOITimed",
Expand All @@ -135,6 +136,7 @@ stds.ecs = {
"C_CharacterServices.SetAutomaticBoostCharacter",
"C_CharacterServicesPublic.ShouldSeeControlPopup",
"C_ChatBubbles.GetAllChatBubbles",
"C_ChatInfo",
"C_ChatInfo.GetChannelRosterInfo",
"C_ChatInfo.GetNumActiveChannels",
"C_ChatInfo.GetRegisteredAddonMessagePrefixes",
Expand All @@ -145,7 +147,6 @@ stds.ecs = {
"C_ChatInfo.ReportServerLag",
"C_ChatInfo.SendAddonMessage",
"C_ChatInfo.SendAddonMessageLogged",
"C_ChatInfo",
"C_Club.AcceptInvitation",
"C_Club.AddClubStreamChatChannel",
"C_Club.AdvanceStreamViewMarker",
Expand Down Expand Up @@ -389,6 +390,7 @@ stds.ecs = {
"C_GuildInfo.RemoveFromGuild",
"C_GuildInfo.SetGuildRankOrder",
"C_GuildInfo.SetNote",
"C_Item",
"C_Item.DoesItemExist",
"C_Item.DoesItemExistByID",
"C_Item.GetCurrentItemLevel",
Expand All @@ -411,7 +413,6 @@ stds.ecs = {
"C_Item.RequestLoadItemData",
"C_Item.RequestLoadItemDataByID",
"C_Item.UnlockItem",
"C_Item",
"C_KeyBindings.GetCustomBindingType",
"C_LootHistory.CanMasterLoot",
"C_LootHistory.GetExpiration",
Expand All @@ -424,6 +425,7 @@ stds.ecs = {
"C_LossOfControl.GetNumEvents",
"C_Mail.HasInboxMoney",
"C_Mail.IsCommandPending",
"C_Map",
"C_Map.GetAreaInfo",
"C_Map.GetBestMapForUnit",
"C_Map.GetBountySetIDForMap",
Expand All @@ -449,10 +451,9 @@ stds.ecs = {
"C_Map.GetWorldPosFromMapPos",
"C_Map.MapHasArt",
"C_Map.RequestPreloadMap",
"C_Map",
"C_MapExplorationInfo",
"C_MapExplorationInfo.GetExploredAreaIDsAtPosition",
"C_MapExplorationInfo.GetExploredMapTextures",
"C_MapExplorationInfo",
"C_MerchantFrame.GetBuybackItemID",
"C_ModelInfo.AddActiveModelScene",
"C_ModelInfo.AddActiveModelSceneActor",
Expand All @@ -462,6 +463,7 @@ stds.ecs = {
"C_ModelInfo.GetModelSceneActorInfoByID",
"C_ModelInfo.GetModelSceneCameraInfoByID",
"C_ModelInfo.GetModelSceneInfoByID",
"C_NamePlate",
"C_NamePlate.GetNamePlateEnemyClickThrough",
"C_NamePlate.GetNamePlateEnemyPreferredClickInsets",
"C_NamePlate.GetNamePlateEnemySize",
Expand All @@ -485,16 +487,15 @@ stds.ecs = {
"C_NamePlate.SetNamePlateSelfPreferredClickInsets",
"C_NamePlate.SetNamePlateSelfSize",
"C_NamePlate.SetTargetClampingInsets",
"C_NamePlate",
"C_NewItems.ClearAll",
"C_NewItems.IsNewItem",
"C_NewItems.RemoveNewItem",
"C_PaperDollInfo",
"C_PaperDollInfo.GetArmorEffectiveness",
"C_PaperDollInfo.GetArmorEffectivenessAgainstTarget",
"C_PaperDollInfo.GetMinItemLevel",
"C_PaperDollInfo.OffhandHasShield",
"C_PaperDollInfo.OffhandHasWeapon",
"C_PaperDollInfo",
"C_PartyInfo.GetActiveCategories",
"C_PartyInfo.GetInviteConfirmationInvalidQueues",
"C_PlayerInfo.GetClass",
Expand All @@ -507,13 +508,13 @@ stds.ecs = {
"C_ProductChoice.GetProducts",
"C_ProductChoice.MakeSelection",
"C_PvP.IsPVPMap",
"C_QuestLog",
"C_QuestLog.GetMaxNumQuests",
"C_QuestLog.GetMaxNumQuestsCanAccept",
"C_QuestLog.GetQuestInfo",
"C_QuestLog.GetQuestObjectives",
"C_QuestLog.IsOnQuest",
"C_QuestLog.ShouldShowQuestRewards",
"C_QuestLog",
"C_RecruitAFriend.CheckEmailEnabled",
"C_RecruitAFriend.GetRecruitInfo",
"C_RecruitAFriend.IsSendingEnabled",
Expand Down Expand Up @@ -544,15 +545,15 @@ stds.ecs = {
"C_Spell.DoesSpellExist",
"C_Spell.IsSpellDataCached",
"C_Spell.RequestLoadSpellData",
"C_SpellBook.IsSpellKnown",
"C_SpellBook",
"C_SpellBook.IsSpellKnown",
"C_StorePublic.DoesGroupHavePurchaseableProducts",
"C_StorePublic.IsDisabledByParentalControls",
"C_StorePublic.IsEnabled",
"C_TaxiMap.GetAllTaxiNodes",
"C_TaxiMap.GetTaxiNodesForMap",
"C_Timer.After",
"C_Timer",
"C_Timer.After",
"C_UI.Reload",
"C_UIWidgetManager.GetAllWidgetsBySetID",
"C_UIWidgetManager.GetBelowMinimapWidgetSetID",
Expand Down Expand Up @@ -819,6 +820,8 @@ stds.ecs = {
"CR_HIT_RANGED",
"CR_HIT_SPELL",
"CR_PARRY",
"CR_RESILIENCE_CRIT_TAKEN",
"CR_RESILIENCE_PLAYER_DAMAGE_TAKEN",
"CR_WEAPON_SKILL",
"CreateFont",
"CreateFrame",
Expand Down Expand Up @@ -1196,6 +1199,7 @@ stds.ecs = {
"GetMirrorTimerProgress",
"GetModifiedClick",
"GetModifiedClickAction",
"GetModResilienceDamageReduction",
"GetMoney",
"GetMonitorAspectRatio",
"GetMonitorCount",
Expand Down Expand Up @@ -2268,14 +2272,16 @@ stds.ecs = {
"UseHearthstone",
"UseInventoryItem",
"UseItemByName",
-- keep-sorted end
"----------------------------------------------------->LUA API",
"bit",
-- keep-sorted start case=no
"abs",
"acos",
"asin",
"assert",
"atan",
"atan2",
"bit",
"bit.arshift",
"bit.band",
"bit.bnot",
Expand Down Expand Up @@ -2415,7 +2421,9 @@ stds.ecs = {
"unpack",
"wipe",
"xpcall",
-- keep-sorted end
"------------------------------------------------------> FRAMES",
-- keep-sorted start case=no
"ActionBarActionEventsFrame",
"ActionBarButtonEventsFrame",
"ActionBarController",
Expand Down Expand Up @@ -2474,7 +2482,6 @@ stds.ecs = {
"ChatConfigFrame",
"ChatEdit_GetActiveWindow",
"ChatEdit_InsertLink",
"ChatFrame_AddMessageEventFilter",
"ChatFrame1",
"ChatFrame10",
"ChatFrame10EditBox",
Expand Down Expand Up @@ -2503,6 +2510,7 @@ stds.ecs = {
"ChatFrame9",
"ChatFrame9EditBox",
"ChatFrame9Tab",
"ChatFrame_AddMessageEventFilter",
"ChatFrameChannelButton",
"ChatFrameMenuButton",
"ChatMenu",
Expand Down Expand Up @@ -2696,11 +2704,11 @@ stds.ecs = {
"SpellBookFrame",
"StackSplitFrame",
"STANDARD_TEXT_FONT",
"StaticPopup_Show",
"StaticPopup1",
"StaticPopup2",
"StaticPopup3",
"StaticPopup4",
"StaticPopup_Show",
"StaticPopupDialogs",
"StatsFrame",
"StopwatchFrame",
Expand Down Expand Up @@ -2752,7 +2760,9 @@ stds.ecs = {
"WorldMapTooltip",
"WorldStateScoreFrame",
"ZoneTextFrame",
-- keep-sorted end
"-----------------------------------------------------> Blizzard Data",
-- keep-sorted start case=no
"CALENDAR_FULLDATE_MONTH_NAMES",
"CALENDAR_WEEKDAY_NAMES",
"QUEST_ITEMS_NEEDED",
Expand All @@ -2765,19 +2775,27 @@ stds.ecs = {
"WOW_PROJECT_ID",
"WOW_PROJECT_MAINLINE",
"WOW_PROJECT_WRATH_CLASSIC",
-- keep-sorted end
"-----------------------------------------------------> Enums",
-- keep-sorted start case=no
"LE_EXPANSION_BURNING_CRUSADE",
-- keep-sorted end
"-----------------------------------------------------> GlobalStrings",
-- keep-sorted start case=no
"CLOSE",
"DEFENSE",
-- keep-sorted end
"-----------------------------------------------------> External Addons",
-- keep-sorted start case=no
"LeaPlusDB",
"LibStub",
"OutfitterButton",
"OutfitterButtonFrame",
"OutfitterFrame",
"PawnInitialize",
-- keep-sorted end
"-----------------------------------------------------> Project Specific",
-- keep-sorted start case=no
"assert.are_same",
"assert.is_nil",
"assert.spy",
Expand All @@ -2791,6 +2809,7 @@ stds.ecs = {
"SLASH_ECS1",
"SlashCmdList",
"spy",
-- keep-sorted end
}
}
std = "max+ecs"
20 changes: 19 additions & 1 deletion Modules/Config/DefenseSection.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
-- keep-sorted start case=no
local IsClassic = ECS.IsClassic
-- keep-sorted end

---@class Config
local Config = ECSLoader:ImportModule("Config")
local _Config = Config.private
Expand Down Expand Up @@ -215,9 +219,23 @@ function _Config:LoadDefenseSection()
Stats.RebuildStatInfos()
end,
},
resilience = {
resilienceRating = {
type = "toggle",
order = 7,
name = function() return i18n("Resilience Rating") end,
desc = function() return i18n("Shows/Hides the resilience rating.") end,
width = 1.5,
hidden = function() return IsClassic end,
disabled = function() return (not ExtendedCharacterStats.profile.defense.display); end,
get = function () return ExtendedCharacterStats.profile.defense.resilienceRating.display; end,
set = function (_, value)
ExtendedCharacterStats.profile.defense.resilienceRating.display = value
Stats.RebuildStatInfos()
end,
},
resilience = {
type = "toggle",
order = 8,
name = function() return i18n("Resilience") end,
desc = function() return i18n("Shows/Hides the resilience value.") end,
width = 1.5,
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 case=no
local IsClassic = ECS.IsClassic
-- keep-sorted end

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

Expand Down Expand Up @@ -68,7 +72,8 @@ dataFunctionRefs = {
["ParryChance"] = function() return Data:GetParryChance(playerLevel) end,
["BlockChance"] = function() return Data:GetBlockChance(playerLevel) end,
["BlockValue"] = function() return Data:GetBlockValue() end,
["ResilienceValue"] = function() return ECS.IsClassic and 0 or Data:GetResilienceRating() end,
["ResilienceRating"] = function() return IsClassic and 0 or Data:GetResilienceRating() end,
["Resilience"] = function() return IsClassic and 0 or Data:GetResilience() end,
-- Spell
["SpellHitRating"] = function() return ECS.IsClassic and 0 or Data:SpellHitRating() end,
["SpellHitBonus"] = function() return Data.SpellHitBonus(Data.HOLY_SCHOOL) end,
Expand Down
22 changes: 20 additions & 2 deletions Modules/Data/Defense.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-- keep-sorted start case=no
local GetCombatRating = GetCombatRating
local GetCombatRatingBonus = GetCombatRatingBonus
local GetModResilienceDamageReduction = GetModResilienceDamageReduction
-- keep-sorted end

---@class Data
local Data = ECSLoader:ImportModule("Data")
---@type DataUtils
Expand Down Expand Up @@ -31,6 +37,7 @@ function _Defense:GetCritReduction()
local meleeCritReduction = 0
local rangedCritReduction = 0
local spellCritReduction = 0
local critReducingFromResilience = 0
local i = 1
repeat
local aura = C_UnitAuras.GetAuraDataByIndex("player", i, "HELPFUL")
Expand Down Expand Up @@ -64,7 +71,9 @@ function _Defense:GetCritReduction()
if critReductionFromDefense < 0 then
critReductionFromDefense = 0
end
local critReducingFromResilience = GetCombatRatingBonus(15)
if CR_RESILIENCE_CRIT_TAKEN then
critReducingFromResilience = GetCombatRatingBonus(CR_RESILIENCE_CRIT_TAKEN)
end

if classId == DRUID then
local coeff = ECS.IsWotlk and 2 or 1
Expand Down Expand Up @@ -240,7 +249,16 @@ end

---@return number
function Data:GetResilienceRating()
return DataUtils:Round(GetCombatRating(15), 2)
local rating = 0
if CR_RESILIENCE_PLAYER_DAMAGE_TAKEN then
rating = GetCombatRating(CR_RESILIENCE_PLAYER_DAMAGE_TAKEN)
end
return DataUtils:Round(rating, 2)
end

---@return number
function Data:GetResilience()
return DataUtils:Round(GetModResilienceDamageReduction(), 2)
end

---@return number
Expand Down
11 changes: 4 additions & 7 deletions Modules/Migration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@ function Migration:ToLatestProfileVersion(profileVersion)

local defaultProfile = Profile:GetDefaultProfile()

if profileVersion < 24 then
ExtendedCharacterStats.profile.defense.resilienceRating = ExtendedCharacterStats.profile.defense.resilience
ExtendedCharacterStats.profile.defense.resilience = nil
end
if profileVersion < 25 then
ExtendedCharacterStats.profile.defense.resilience = nil
end
if profileVersion < 26 then
ExtendedCharacterStats.profile.spellBonus.baseSpellDmg = defaultProfile.profile.spellBonus.baseSpellDmg
ExtendedCharacterStats.profile.defense.enemyMissChance = defaultProfile.profile.defense.enemyMissChance
ExtendedCharacterStats.profile.defense.enemyMissChanceBoss = defaultProfile.profile.defense.enemyMissChanceBoss
end
if profileVersion < 27 then
ExtendedCharacterStats.profile.defense.resilience = defaultProfile.profile.defense.resilience
ExtendedCharacterStats.profile.defense.resilienceRating = defaultProfile.profile.defense.resilienceRating
end
end
9 changes: 7 additions & 2 deletions Modules/Profile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local Utils = ECSLoader:ImportModule("Utils")

---@return number
function Profile.GetProfileVersion()
return 26
return 27
end

---@return ECSProfile
Expand Down Expand Up @@ -288,7 +288,12 @@ local function GetDefaultStatsProfile()
dodge = { display = true, refName = "DodgeChance", text = "Dodge Chance" },
resilienceRating = {
display = true,
refName = "ResilienceValue",
refName = "ResilienceRating",
text = "Resilience Rating"
},
resilience = {
display = true,
refName = "Resilience",
text = "Resilience"
},
},
Expand Down
Loading
Loading