attempted optimizations

This commit is contained in:
Nostrademous
2021-02-19 15:58:03 -05:00
parent 699ed532da
commit 2cbaa22c57
2 changed files with 24 additions and 21 deletions

View File

@@ -19,24 +19,6 @@ local band = bit.band
local tempTable1 = { }
-- Generate a UUID for a skill
local function cacheSkillUUID(skill)
local strName = skill.activeEffect.grantedEffect.name:gsub("%s+", "") -- strip spaces
local strSlotName = (skill.slotName or "NO_SLOT"):gsub("%s+", "") -- strip spaces
local indx = 1
if skill.socketGroup and skill.socketGroup.gemList and skill.activeEffect.gemData then
for idx, gem in ipairs(skill.socketGroup.gemList) do
-- we compare table addresses rather than names since two of the same gem
-- can be socketed in the same slot
if gem.gemData == skill.activeEffect.gemData then
indx =idx
break
end
end
end
return strName.."_"..strSlotName.."_"..tostring(indx)
end
-- Identify the trigger action skill for trigger conditions, take highest Attack Per Second
local function findTriggerSkill(skill, source, triggerRate)
local uuid = cacheSkillUUID(skill)

View File

@@ -115,13 +115,34 @@ function calcs.getMiscCalculator(build)
end, baseOutput
end
-- Generate a UUID for a skill
function cacheSkillUUID(skill)
local strName = skill.activeEffect.grantedEffect.name:gsub("%s+", "") -- strip spaces
local strSlotName = (skill.slotName or "NO_SLOT"):gsub("%s+", "") -- strip spaces
local indx = 1
if skill.socketGroup and skill.socketGroup.gemList and skill.activeEffect.gemData then
for idx, gem in ipairs(skill.socketGroup.gemList) do
-- we compare table addresses rather than names since two of the same gem
-- can be socketed in the same slot
if gem.gemData == skill.activeEffect.gemData then
indx =idx
break
end
end
end
return strName.."_"..strSlotName.."_"..tostring(indx)
end
-- Build output for display in the side bar or calcs tab
function calcs.buildOutput(build, mode)
local fullEnv = calcs.initEnv(build, mode)
for _, activeSkill in ipairs(fullEnv.player.activeSkillList) do
fullEnv.player.mainSkill = activeSkill
calcs.perform(fullEnv)
fullEnv = calcs.initEnv(build, mode)
local uuid = cacheSkillUUID(activeSkill)
if not GlobalCache[uuid] then
fullEnv.player.mainSkill = activeSkill
calcs.perform(fullEnv)
fullEnv = calcs.initEnv(build, mode)
end
end
-- Build output