Skip to content

Commit 5521336

Browse files
justjuanguijustjuangui
andauthored
View Gem level sources in calc sections (#8092)
* Gem Level stat was enabled and expose in Calc Sections * Use CalcActiveSkills to calculate Mods * Type was fixed in propertyModList * GemLevel Base was moved into CalcActiveSkill --------- Co-authored-by: justjuangui <servicios@juacarvajal.com>
1 parent 4697945 commit 5521336

4 files changed

Lines changed: 43 additions & 6 deletions

File tree

src/Modules/CalcActiveSkill.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,12 +497,20 @@ function calcs.buildActiveSkillModList(env, activeSkill)
497497
end
498498

499499
-- Apply gem/quality modifiers from support gems
500-
for _, value in ipairs(skillModList:List(activeSkill.skillCfg, "SupportedGemProperty")) do
500+
skillModList:NewMod("GemLevel", "BASE", activeSkill.activeEffect.srcInstance and activeSkill.activeEffect.srcInstance.level or activeSkill.activeEffect.level, "Max Level")
501+
for _, supportProperty in ipairs(skillModList:Tabulate("LIST", activeSkill.skillCfg, "SupportedGemProperty")) do
502+
local value = supportProperty.value
501503
if value.keyword == "grants_active_skill" and activeSkill.activeEffect.gemData and not activeSkill.activeEffect.gemData.tags.support then
502504
activeEffect[value.key] = activeEffect[value.key] + value.value
505+
skillModList:NewMod("GemSupport".. value.key:gsub("^%l", string.upper), "BASE", value.value, supportProperty.mod.source, #supportProperty.mod > 0 and supportProperty.mod[1] or nil)
503506
end
504507
end
505508

509+
for _, gemProperty in ipairs((activeSkill.activeEffect.gemPropertyInfo or {})) do
510+
local value = gemProperty.value
511+
skillModList:NewMod("GemItem".. value.key:gsub("^%l", string.upper), "BASE", value.value, gemProperty.mod.source, #gemProperty.mod > 0 and gemProperty.mod[1] or nil)
512+
end
513+
506514
-- Add active gem modifiers
507515
activeEffect.actorLevel = activeSkill.actor.minionData and activeSkill.actor.level
508516
calcs.mergeSkillInstanceMods(env, skillModList, activeEffect, skillModList:List(activeSkill.skillCfg, "ExtraSkillStat"))

src/Modules/CalcPerform.lua

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3239,5 +3239,30 @@ function calcs.perform(env, skipEHP)
32393239
env.build.partyTab:setBuffExports(buffExports)
32403240
end
32413241

3242+
-- calculate Gem Level of MainSkill
3243+
if env.player.mainSkill then
3244+
local mainSkill = env.player.mainSkill
3245+
if mainSkill.activeEffect and mainSkill.activeEffect.level and mainSkill.activeEffect.srcInstance then
3246+
local baseLevel = mainSkill.skillModList:Sum("BASE", mainSkill.skillCfg, "GemLevel")
3247+
local totalItemLevel = mainSkill.skillModList:Sum("BASE", mainSkill.skillCfg, "GemItemLevel")
3248+
local totalSupportLevel = mainSkill.skillModList:Sum("BASE", mainSkill.skillCfg, "GemSupportLevel")
3249+
3250+
output.GemHasLevel = true
3251+
output.GemLevel = baseLevel + totalSupportLevel + totalItemLevel
3252+
3253+
if env.player.breakdown then
3254+
env.player.breakdown.GemLevel = {}
3255+
t_insert(env.player.breakdown.GemLevel, s_format("%d ^8(level from gem)", baseLevel))
3256+
if totalSupportLevel > 0 then
3257+
t_insert(env.player.breakdown.GemLevel, s_format("+ %d ^8(level from support)", totalSupportLevel))
3258+
end
3259+
if totalItemLevel > 0 then
3260+
t_insert(env.player.breakdown.GemLevel, s_format("+ %d ^8(level from items)", totalItemLevel))
3261+
end
3262+
t_insert(env.player.breakdown.GemLevel, s_format("= %d", output.GemLevel))
3263+
end
3264+
end
3265+
end
3266+
32423267
cacheData(cacheSkillUUID(env.player.mainSkill, env), env)
32433268
end

src/Modules/CalcSections.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ return {
601601
} }
602602
} },
603603
{ 1, "SkillTypeStats", 1, colorCodes.OFFENCE, {{ defaultCollapsed = false, label = "Skill type-specific Stats", data = {
604+
{ label = "Gem Level", haveOutput = "GemHasLevel", { format = "{0:output:GemLevel}", { breakdown = "GemLevel" }, { modName = { "GemLevel" }, cfg = "skill" },{ modName = { "GemSupportLevel" }, cfg = "skill" }, { modName = { "GemItemLevel" }, cfg = "skill" }, }, },
604605
{ label = "Mana Cost", color = colorCodes.MANA, haveOutput = "ManaHasCost", { format = "{0:output:ManaCost}", { breakdown = "ManaCost" }, { modName = { "ManaCost", "Cost", "ManaCostNoMult" }, cfg = "skill" }, }, },
605606
{ label = "Mana % Cost", color = colorCodes.MANA, haveOutput = "ManaPercentHasCost", { format = "{0:output:ManaPercentCost}", { breakdown = "ManaPercentCost" }, { modName = { "ManaCost", "Cost", "ManaCostNoMult" }, cfg = "skill" }, }, },
606607
{ label = "Mana per second", color = colorCodes.MANA, haveOutput = "ManaPerSecondHasCost", { format = "{2:output:ManaPerSecondCost}", { breakdown = "ManaPerSecondCost" }, { modName = { "ManaCost", "Cost", "ManaCostNoMult" }, cfg = "skill" }, }, },

src/Modules/CalcSetup.lua

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,13 @@ local function getGemModList(env, groupCfg, socketColor, socketNum)
271271
local gemCfg = copyTable(groupCfg, true)
272272
gemCfg.socketColor = socketColor
273273
gemCfg.socketNum = socketNum
274-
return env.modDB:List(gemCfg, "GemProperty")
274+
return env.modDB:Tabulate("LIST", gemCfg, "GemProperty")
275275
end
276276

277277
local function applyGemMods(effect, modList)
278-
for _, value in ipairs(modList) do
278+
for _, mod in ipairs(modList) do
279279
local match = true
280+
local value = mod.value
280281
if value.keywordList then
281282
for _, keyword in ipairs(value.keywordList) do
282283
if not calcLib.gemIsType(effect.gemData, keyword, true) then
@@ -289,6 +290,8 @@ local function applyGemMods(effect, modList)
289290
end
290291
if match then
291292
effect[value.key] = (effect[value.key] or 0) + value.value
293+
effect.gemPropertyInfo = effect.gemPropertyInfo or {}
294+
t_insert(effect.gemPropertyInfo, mod)
292295
end
293296
end
294297
end
@@ -1330,7 +1333,7 @@ function calcs.initEnv(build, mode, override, specEnv)
13301333
groupCfgList[slotName or "noSlot"] = groupCfgList[slotName or "noSlot"] or {}
13311334
groupCfgList[slotName or "noSlot"][group] = groupCfgList[slotName or "noSlot"][group] or {
13321335
slotName = slotName,
1333-
propertyModList = env.modDB:List({slotName = slotName}, "GemProperty")
1336+
propertyModList = env.modDB:Tabulate("LIST", {slotName = slotName}, "GemProperty")
13341337
}
13351338
local groupCfg = groupCfgList[slotName or "noSlot"][group]
13361339
local propertyModList = groupCfg.propertyModList
@@ -1433,7 +1436,7 @@ function calcs.initEnv(build, mode, override, specEnv)
14331436
local slotName = group.slot and group.slot:gsub(" Swap","")
14341437
groupCfgList[slotName or "noSlot"][group] = groupCfgList[slotName or "noSlot"][group] or {
14351438
slotName = slotName,
1436-
propertyModList = env.modDB:List({slotName = slotName}, "GemProperty")
1439+
propertyModList = env.modDB:Tabulate("LIST", {slotName = slotName}, "GemProperty")
14371440
}
14381441
local groupCfg = groupCfgList[slotName or "noSlot"][group]
14391442
local propertyModList = groupCfg.propertyModList
@@ -1555,7 +1558,7 @@ function calcs.initEnv(build, mode, override, specEnv)
15551558
if index == env.mainSocketGroup or (group.enabled and group.slotEnabled) then
15561559
groupCfgList[slotName or "noSlot"][group] = groupCfgList[slotName or "noSlot"][group] or {
15571560
slotName = slotName,
1558-
propertyModList = env.modDB:List({slotName = slotName}, "GemProperty")
1561+
propertyModList = env.modDB:Tabulate("LIST", {slotName = slotName}, "GemProperty")
15591562
}
15601563
local groupCfg = groupCfgList[slotName or "noSlot"][group]
15611564
for _, value in ipairs(env.modDB:List(groupCfg, "GroupProperty")) do

0 commit comments

Comments
 (0)