Minor tweaks and cleanup

This commit is contained in:
Openarl
2016-11-01 17:03:11 +10:00
parent 79c37b1128
commit 3f371e3d6d
11 changed files with 52 additions and 46 deletions

View File

@@ -93,7 +93,7 @@ function CalcBreakdownClass:SetBreakdownData(displayData, pinned)
end
function CalcBreakdownClass:AddBreakdownSection(sectionData)
local breakdown = self.calcsTab.gridEnv.breakdown[sectionData.breakdown]
local breakdown = self.calcsTab.calcsEnv.breakdown[sectionData.breakdown]
if not breakdown then
return
end
@@ -164,7 +164,7 @@ function CalcBreakdownClass:AddBreakdownSection(sectionData)
end
function CalcBreakdownClass:AddModSection(sectionData)
local env = self.calcsTab.gridEnv
local env = self.calcsTab.calcsEnv
local build = self.calcsTab.build
local cfg = (sectionData.cfg and copyTable(env.mainSkill[sectionData.cfg.."Cfg"])) or { }
cfg.source = sectionData.modSource
@@ -187,9 +187,9 @@ function CalcBreakdownClass:AddModSection(sectionData)
{ label = "Value", key = "value" },
{ label = "Stat", key = "name" },
{ label = "Skill types", key = "flags" },
{ label = "Tags", key = "tags" },
{ label = "Notes", key = "tags" },
{ label = "Source", key = "source" },
{ label = "Name", key = "sourceName" },
{ label = "Source Name", key = "sourceName" },
},
}
t_insert(self.sectionList, section)
@@ -283,8 +283,8 @@ function CalcBreakdownClass:AddModSection(sectionData)
elseif row.mod.source == "Tree:Jewel" then
row.sourceName = "Jewel conversion"
end
elseif sourceType == "Gem" then
row.sourceName = row.mod.source:match("Gem:(.+)")
elseif sourceType == "Skill" then
row.sourceName = row.mod.source:match("Skill:(.+)")
end
if row.mod.flags ~= 0 or row.mod.keywordFlags ~= 0 then
local flagNames = { }

View File

@@ -73,7 +73,7 @@ function CalcSectionClass:IsMouseOver()
end
function CalcSectionClass:UpdateSize()
local skillFlags = self.calcsTab.gridEnv.mainSkill.skillFlags
local skillFlags = self.calcsTab.calcsEnv.mainSkill.skillFlags
self.enabled = not self.flag or skillFlags[self.flag]
if self.collapsed or not self.enabled then
self.height = 22
@@ -138,7 +138,7 @@ function CalcSectionClass:FormatStr(str, output, colData)
end)
str = str:gsub("{(%d+):mod:(%d+)}", function(p, n)
local sectionData = colData[tonumber(n)]
local env = self.calcsTab.gridEnv
local env = self.calcsTab.calcsEnv
local modCfg = (sectionData.cfg and env.mainSkill[sectionData.cfg.."Cfg"]) or { }
if sectionData.modSource then
modCfg.source = sectionData.modSource
@@ -161,8 +161,8 @@ function CalcSectionClass:Draw(viewPort)
local x, y = self:GetPos()
local width, height = self:GetSize()
local cursorX, cursorY = GetCursorPos()
local env = self.calcsTab.gridEnv
local output = self.calcsTab.gridOutput
local env = self.calcsTab.calcsEnv
local output = self.calcsTab.calcsOutput
SetDrawLayer(nil, -10)
SetDrawColor(self.col)
DrawImage(nil, x, y, width, height)

View File

@@ -323,9 +323,9 @@ function CalcsTabClass:BuildOutput()
self.mainEnv = self.calcs.buildOutput(self.build, "MAIN")
self.mainOutput = self.mainEnv.output
self.gridEnv = self.calcs.buildOutput(self.build, "GRID")
self.gridOutput = self.gridEnv.output
self.gridBreakdown = self.gridEnv.breakdown
self.calcsEnv = self.calcs.buildOutput(self.build, "CALCS")
self.calcsOutput = self.calcsEnv.output
self.calcsBreakdown = self.calcsEnv.breakdown
if self.displayData then
self.controls.breakdown:SetBreakdownData()

View File

@@ -256,10 +256,10 @@ end
function ConfigTabClass:ImportCalcSettings()
local input = self.input
local gridInput = self.build.calcsTab.input
local calcsInput = self.build.calcsTab.input
local function import(old, new)
input[new] = gridInput[old]
gridInput[old] = nil
input[new] = calcsInput[old]
calcsInput[old] = nil
end
import("Cond_LowLife", "conditionLowLife")
import("Cond_FullLife", "conditionFullLife")

View File

@@ -195,7 +195,7 @@ function buildMode:Init(dbFileName, buildName)
{ mod = "AverageHit", label = "Average Hit", fmt = ".1f", compPercent = true },
{ mod = "Speed", label = "Attack/Cast Rate", fmt = ".2f", compPercent = true },
{ mod = "CritChance", label = "Crit Chance", fmt = ".2f%%" },
{ mod = "CritMultiplier", label = "Crit Multiplier", fmt = "d%%", pc = true },
{ mod = "CritMultiplier", label = "Crit Multiplier", fmt = "d%%", pc = true, condFunc = function(v,o) return o.CritChance > 0 end },
{ mod = "HitChance", label = "Hit Chance", fmt = "d%%", condFunc = function(v,o) return v < 100 end },
{ mod = "TotalDPS", label = "Total DPS", fmt = ".1f", compPercent = true },
{ mod = "TotalDot", label = "DoT DPS", fmt = ".1f", compPercent = true },

View File

@@ -7,6 +7,7 @@
return {
{ 3, "HitDamage", 1, "Skill Hit Damage", data.colorCodes.OFFENCE, {
extra = "{output:DisplayDamage}",
flag = "hit",
colWidth = 95,
{
{ format = "All Types:", },
@@ -154,6 +155,7 @@ return {
} },
{ 1, "Crit", 1, "Crits", data.colorCodes.OFFENCE, {
extra = "{2:output:CritChance}% x{2:output:CritMultiplier}",
flag = "hit",
{ label = "Inc. Crit Chance", { format = "{0:mod:1}%", { modName = "CritChance", modType = "INC", cfg = "skill" }, }, },
{ label = "Crit Chance", { format = "{2:output:CritChance}%", { breakdown = "CritChance" }, { modName = "CritChance", cfg = "skill" }, }, },
{ label = "Crit Multiplier", { format = "x {2:output:CritMultiplier}", { modName = "CritMultiplier", cfg = "skill"}, }, },
@@ -211,6 +213,7 @@ return {
{ label = "Ignite Duration", { format = "{2:output:IgniteDuration}s", { breakdown = "IgniteDuration" }, { label = "Player modifiers", modName = "EnemyIgniteDuration", cfg = "skill" }, { label = "Enemy modifiers", modName = "SelfIgniteDuration", enemy = true }, }, },
} },
{ 1, "MiscEffects", 1, "Other Effects", data.colorCodes.OFFENCE, {
flag = "hit",
{ label = "Chance to Shock", flag = "shock", { format = "{0:output:ShockChance}%", { label = "Player modifiers", modName = "EnemyShockChance", cfg = "skill" }, { label = "Enemy modifiers", modName = "SelfShockChance", enemy = true }, }, },
{ label = "Shock Dur. Mod", flag = "shock", { format = "x {2:output:ShockDurationMod}", { label = "Player modifiers", modName = "EnemyShockDuration", cfg = "skill" }, { label = "Enemy modifiers", modName = "SelfShockDuration", enemy = true }, }, },
{ label = "Chance to Freeze", flag = "freeze", { format = "{0:output:FreezeChance}%", { label = "Player modifiers", modName = "EnemyFreezeChance", cfg = "skill" }, { label = "Enemy modifiers", modName = "SelfFreezeChance", enemy = true }, }, },

View File

@@ -187,6 +187,7 @@ local function buildActiveSkillModList(env, activeSkill)
-- Initialise skill flag set
local skillFlags = copyTable(activeSkill.baseFlags)
skillFlags.hit = activeSkill.skillTypes[SkillType.Attack] or activeSkill.skillTypes[SkillType.Hit]
-- Set weapon flags
local weapon1Type = env.itemList["Weapon 1"] and env.itemList["Weapon 1"].type or "None"
@@ -215,7 +216,9 @@ local function buildActiveSkillModList(env, activeSkill)
-- Build skill mod flag set
local skillModFlags = 0
skillModFlags = bor(skillModFlags, ModFlag.Hit)
if skillFlags.hit then
skillModFlags = bor(skillModFlags, ModFlag.Hit)
end
if skillFlags.spell then
skillModFlags = bor(skillModFlags, ModFlag.Spell)
elseif skillFlags.attack then
@@ -557,7 +560,7 @@ local function initEnv(build, mode)
local env = { }
env.build = build
env.configInput = build.configTab.input
env.gridInput = build.calcsTab.input
env.calcsInput = build.calcsTab.input
env.mode = mode
env.classId = build.spec.curClassId
@@ -790,11 +793,11 @@ local function mergeMainMods(env, repSlotName, repItem)
env.modDB:AddList(buildNodeModList(env, build.spec.allocNodes, true))
-- Determine main skill group
if env.mode == "GRID" then
env.gridInput.skill_number = m_min(m_max(#build.skillsTab.socketGroupList, 1), env.gridInput.skill_number or 1)
env.mainSocketGroup = env.gridInput.skill_number
env.skillPart = env.gridInput.skill_part or 1
env.buffMode = env.gridInput.misc_buffMode
if env.mode == "CALCS" then
env.calcsInput.skill_number = m_min(m_max(#build.skillsTab.socketGroupList, 1), env.calcsInput.skill_number or 1)
env.mainSocketGroup = env.calcsInput.skill_number
env.skillPart = env.calcsInput.skill_part or 1
env.buffMode = env.calcsInput.misc_buffMode
else
build.mainSocketGroup = m_min(m_max(#build.skillsTab.socketGroupList, 1), build.mainSocketGroup or 1)
env.mainSocketGroup = build.mainSocketGroup
@@ -861,9 +864,9 @@ local function mergeMainMods(env, repSlotName, repItem)
if index == env.mainSocketGroup and #socketGroupSkillList > 0 then
-- Select the main skill from this socket group
local activeSkillIndex
if env.mode == "GRID" then
env.gridInput.skill_activeNumber = m_min(#socketGroupSkillList, env.gridInput.skill_activeNumber or 1)
activeSkillIndex = env.gridInput.skill_activeNumber
if env.mode == "CALCS" then
env.calcsInput.skill_activeNumber = m_min(#socketGroupSkillList, env.calcsInput.skill_activeNumber or 1)
activeSkillIndex = env.calcsInput.skill_activeNumber
else
socketGroup.mainActiveSkill = m_min(#socketGroupSkillList, socketGroup.mainActiveSkill or 1)
activeSkillIndex = socketGroup.mainActiveSkill
@@ -923,7 +926,7 @@ local function performCalcs(env)
env.output = output
modDB.stats = output
local breakdown
if env.mode == "GRID" then
if env.mode == "CALCS" then
breakdown = { }
env.breakdown = breakdown
end
@@ -1733,7 +1736,7 @@ local function performCalcs(env)
local hitSource = (env.mode_skillType == "ATTACK") and env.weaponData1 or env.mainSkill.skillData
for _, damageType in ipairs(dmgTypeList) do
local min, max
if canDeal[damageType] then
if skillFlags.hit and canDeal[damageType] then
if breakdown then
breakdown[damageType] = {
damageComponents = { }
@@ -1771,7 +1774,7 @@ local function performCalcs(env)
local mult = (1 - (resist - pen) / 100) * (1 + taken / 100)
min = min * mult
max = max * mult
if env.mode == "GRID" then
if env.mode == "CALCS" then
output[damageType.."EffMult"] = mult
end
if breakdown and mult ~= 1 then
@@ -1807,7 +1810,7 @@ local function performCalcs(env)
}
end
end
if env.mode == "GRID" then
if env.mode == "CALCS" then
output[damageType.."Min"] = min
output[damageType.."Max"] = max
end
@@ -1865,7 +1868,7 @@ local function performCalcs(env)
output.AverageHit = (totalMin + totalMax) / 2 * output.CritEffect
output.AverageDamage = output.AverageHit * output.HitChance / 100
output.TotalDPS = output.AverageDamage * output.Speed * (skillData.dpsMultiplier or 1)
if env.mode == "GRID" then
if env.mode == "CALCS" then
if env.mode_average then
output.DisplayDamage = s_format("%.1f average damage", output.AverageDamage)
else
@@ -2429,7 +2432,7 @@ function calcs.getItemCalculator(build)
end)
end
-- Build output for display in the grid or side bar
-- Build output for display in the side bar or calcs tab
function calcs.buildOutput(build, mode)
-- Build output
local env = initEnv(build, mode)
@@ -2447,7 +2450,7 @@ function calcs.buildOutput(build, mode)
for _, stat in pairs({"Life", "Mana", "Armour", "Evasion", "EnergyShield"}) do
output["Spec:"..stat.."Inc"] = env.modDB:Sum("INC", specCfg, stat)
end
elseif mode == "GRID" then
elseif mode == "CALCS" then
-- Calculate XP modifier
--[[ FIXME
if input.monster_level and input.monster_level > 0 then

View File

@@ -152,7 +152,7 @@ for gemName, gemData in pairs(data.gems) do
-- Add sources for gem mods
for _, list in pairs({gemData.baseMods, gemData.qualityMods, gemData.levelMods}) do
for _, mod in pairs(list) do
mod.source = "Gem:"..gemName
mod.source = "Skill:"..gemName
end
end
end

View File

@@ -49,7 +49,7 @@ Head over to the [Releases](https://github.com/Openarl/PathOfBuilding/releases)
![ss3](https://cloud.githubusercontent.com/assets/19189971/18089780/f0ff234a-6f04-11e6-8c88-6193fe59a5c4.png)
## Changelog
### 1.2.0 - 2016/10/00
### 1.2.0 - 2016/11/01
With this update, the program's internal modifier system has been completely overhauled.
On its own this overhaul doesn't change much from the user's perspective, but it has opened the way for some
significant upgrades:

View File

@@ -1,4 +1,4 @@
VERSION[1.2.0][2016/10/00]
VERSION[1.2.0][2016/11/01]
With this update, the program's internal modifier system has been completely overhauled.
On its own this overhaul doesn't change much from the user's perspective, but it has opened the way for some
significant upgrades:

View File

@@ -7,14 +7,14 @@
<File sha1="6bb074e0d3a4043f0e5dcbd25c33f8e5e1f5cfe0" name="Launch.lua" part="program"/>
<File sha1="93e19c2a160eb49993d50d9e2b47ea79962373d9" name="UpdateCheck.lua" part="program"/>
<File sha1="4f17937f2b37784e169a3792b235f2a0a3961e61" name="UpdateApply.lua" part="program"/>
<File sha1="151fa58abc1ab806de7742a68f5cc94892177929" name="changelog.txt" part="program"/>
<File sha1="603844f95685ac389597c11c0bf32eb5887fb3d3" name="changelog.txt" part="program"/>
<File sha1="aef7145f378d0a1d5dc6f5f2d3c08d2a1b6ef264" name="Classes/BuildListControl.lua" part="program"/>
<File sha1="f41793d6cbf037cddab2079bf9445cf096e295cf" name="Classes/ButtonControl.lua" part="program"/>
<File sha1="80f5029697247f7afe010f04eac5aba942497e09" name="Classes/CalcBreakdownControl.lua" part="program"/>
<File sha1="967f17911451b9509c948ffb54ece9c626c06e1f" name="Classes/CalcSectionControl.lua" part="program"/>
<File sha1="d2c123f393573c9a2914fa1c471b6720a94b67e8" name="Classes/CalcsTab.lua" part="program"/>
<File sha1="f53350ff705cafc3088a13740faf8106d1b8ec93" name="Classes/CalcBreakdownControl.lua" part="program"/>
<File sha1="5bb6ef0eb3a0fa5f7ef88fecffadddd95013cd2a" name="Classes/CalcSectionControl.lua" part="program"/>
<File sha1="dd707e5d9fefe00cbbbd51cefa94b6de04347b65" name="Classes/CalcsTab.lua" part="program"/>
<File sha1="c8c603b9cae464de06f04dd6ab2e0530dc897bbc" name="Classes/CheckBoxControl.lua" part="program"/>
<File sha1="60f51845e92d3fcbd32307541fad2526a73ae9f6" name="Classes/ConfigTab.lua" part="program"/>
<File sha1="130c54c6f5ea929d90128fbd576191833b995dab" name="Classes/ConfigTab.lua" part="program"/>
<File sha1="e71f8367d62de41b0b80b764ddced8fb80f50ce7" name="Classes/Control.lua" part="program"/>
<File sha1="ae55fe1093e727872bc01cc94fa987395f944313" name="Classes/ControlHost.lua" part="program"/>
<File sha1="8305ea8d306a13160c369c474d19b05024a1f5ef" name="Classes/DropDownControl.lua" part="program"/>
@@ -41,12 +41,12 @@
<File sha1="844b8915ca0f2e6af82f2d15978af131a33ad50e" name="Classes/TextListControl.lua" part="program"/>
<File sha1="8b8fbea27b00c702ea7bcffa6945cc814cc2fa41" name="Classes/TreeTab.lua" part="program"/>
<File sha1="4b7675c8b4fe71cade7dd3d70793df1ed8022d01" name="Classes/UndoHandler.lua" part="program"/>
<File sha1="526d37e35b2d26cb798e91f7c873a86ca02438a7" name="Modules/Build.lua" part="program"/>
<File sha1="11f9b77ce58cd280d93aacbebda6441d4252a965" name="Modules/Build.lua" part="program"/>
<File sha1="c03a7796aea3e9aa832fbb92c1f674ef5af690ca" name="Modules/BuildList.lua" part="program"/>
<File sha1="be04c886bc6e892201a72afd806ccb53e1591beb" name="Modules/Calcs.lua" part="program"/>
<File sha1="84b35b20be7183a2211697c8b9db7e1395b16dc1" name="Modules/CalcSections.lua" part="program"/>
<File sha1="5e989c9041fed870d387fd8809620722cc911661" name="Modules/Calcs.lua" part="program"/>
<File sha1="2a22fd89b1b436db0f458c95e53d07fd33eeac63" name="Modules/CalcSections.lua" part="program"/>
<File sha1="f207df4010cb3c7bc6cce98be2529a3b8a708b8f" name="Modules/Common.lua" part="program"/>
<File sha1="910b87ac5a232c8ab7cb14dfc61d8f85eac58884" name="Modules/Data.lua" part="program"/>
<File sha1="132f51b4be7890360f478df52bc6c77772db75cc" name="Modules/Data.lua" part="program"/>
<File sha1="5ddfa4a5904cefbf2755c231797175c8ae24ac49" name="Modules/ItemTools.lua" part="program"/>
<File sha1="ea30ad5ca76b766665ee8a270dcd0068383ad70f" name="Modules/Main.lua" part="program"/>
<File sha1="ede733f8389fb4c5854304fbc20e2be925a3f5d3" name="Modules/ModParser.lua" part="program"/>