Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Classes/BuildListControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ local buildListHelpers = LoadModule("Modules/BuildListHelpers")
---@class BuildListControl: ListControl
local BuildListClass = newClass("BuildListControl", "ListControl")

---@param anchor Anchor
---@param rect Rect
---@param listMode any
function BuildListClass:BuildListControl(anchor, rect, listMode)
self:ListControl(anchor, rect, 20, "VERTICAL", false, listMode.list)
self.listMode = listMode
Expand Down
1 change: 1 addition & 0 deletions src/Classes/CalcBreakdownControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ local band = bit.band
---@class CalcBreakdownControl: Control, ControlHost
local CalcBreakdownClass = newClass("CalcBreakdownControl", "Control", "ControlHost")

---@param calcsTab CalcsTab
function CalcBreakdownClass:CalcBreakdownControl(calcsTab)
self:Control()
self:ControlHost()
Expand Down
7 changes: 7 additions & 0 deletions src/Classes/CalcSectionControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ local m_min = math.min
---@class CalcSectionControl: Control, ControlHost
local CalcSectionClass = newClass("CalcSectionControl", "Control", "ControlHost")

---@param calcsTab CalcsTab
---@param width any
---@param id any
---@param group any
---@param colour any
---@param subSection any
---@param updateFunc any
function CalcSectionClass:CalcSectionControl(calcsTab, width, id, group, colour, subSection, updateFunc)
self:Control(calcsTab, {0, 0, width, 0})
self:ControlHost()
Expand Down
16 changes: 9 additions & 7 deletions src/Classes/CalcsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,10 @@ function CalcsTabClass:BuildOutput()
end

-- Retrieve calculator functions
self.nodeCalculator = { self.calcs.getNodeCalculator(self.build) }
self.miscCalculator = { self.calcs.getMiscCalculator(self.build) }
local nodeCalcFunc, nodeCalcBase = self.calcs.getNodeCalculator(self.build)
self.nodeCalculator = { nodeCalcFunc, nodeCalcBase }
local miscCalcFunc, miscCalcBase = self.calcs.getMiscCalculator(self.build)
self.miscCalculator = { miscCalcFunc, miscCalcBase }
end

-- Controls the coroutine that calculates node power
Expand Down Expand Up @@ -496,6 +498,10 @@ end
function CalcsTabClass:PowerBuilder()
-- local timer_start = GetTime()
local useFullDPS = self.powerStat and self.powerStat.stat == "FullDPS"
---@type CalcOverride
local override = {
repItem
}
local calcFunc, calcBase = self:GetMiscCalculator()
local cache = { }
local distanceMap = { }
Expand Down Expand Up @@ -757,12 +763,8 @@ function CalcsTabClass:CalculateCombinedOffDefStat(original, modified)
return dpsIncr / modifiedDps, defence
end

function CalcsTabClass:GetNodeCalculator()
return unpack(self.nodeCalculator)
end

function CalcsTabClass:GetMiscCalculator()
return unpack(self.miscCalculator)
return self.miscCalculator[1], self.miscCalculator[2]
end

function CalcsTabClass:CreateUndoState()
Expand Down
9 changes: 9 additions & 0 deletions src/Classes/CompareCalcsHelpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ function M.FormatCalcModName(modName)
end

-- Resolve a modifier's source to a human-readable name
---@param mod Mod
---@param build Build
function M.ResolveSourceName(mod, build)
if not mod.source then return "" end
local sourceType = mod.source:match("[^:]+") or ""
Expand Down Expand Up @@ -138,6 +140,8 @@ function M.FormatModRow(row, sectionData, build)
end

-- Get breakdown text lines for a build's actor
---@param sectionData any
---@param build Build
function M.GetBreakdownLines(sectionData, build)
if not sectionData.breakdown then return nil end
local calcsActor = build.calcsTab and build.calcsTab.calcsEnv and build.calcsTab.calcsEnv.player
Expand All @@ -164,6 +168,8 @@ end

-- Draw the calcs hover tooltip showing breakdown for both builds with common/unique grouping
-- tooltip, primaryBuild, primaryLabel passed as args instead of self
---@param tooltip Tooltip
---@param primaryBuild Build
function M.DrawCalcsTooltip(tooltip, primaryBuild, primaryLabel, colData, rowLabel, rowX, rowY, rowW, rowH, vp, compareEntry)
if tooltip:CheckForUpdate(colData, rowLabel) then
-- Get calcsEnv actors (these have breakdown data populated)
Expand Down Expand Up @@ -318,6 +324,8 @@ function M.DrawCalcsTooltip(tooltip, primaryBuild, primaryLabel, colData, rowLab
end

-- Resolve a modifier's source name for breakdown panel display
---@param mod Mod
---@param build Build
local function resolveModSource(mod, build)
local sourceType = mod.source and mod.source:match("[^:]+") or "?"
local sourceName = ""
Expand Down Expand Up @@ -352,6 +360,7 @@ local function resolveModSource(mod, build)
end

-- Draw a breakdown panel for a single build's SkillBuffs or SkillDebuffs,
---@param build Build
function M.DrawSkillBreakdownPanel(build, breakdownKey, label, cellX, cellY, cellW, cellH, vp)
local player = build.calcsTab and build.calcsTab.calcsEnv
and build.calcsTab.calcsEnv.player
Expand Down
7 changes: 6 additions & 1 deletion src/Classes/ConfigTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ local s_upper = string.upper
local varList = LoadModule("Modules/ConfigOptions")
local configVisibility = LoadModule("Modules/ConfigVisibility")

---@class CustomModBlock: ControlHost, Control
---@class CustomModBlockControl: ControlHost, Control
local CustomModBlockClass = newClass("CustomModBlockControl", "ControlHost", "Control")

---@param anchor Anchor
---@param rect Rect
---@param configTab ConfigTab
---@param blockIndex integer
---@param blockData any
function CustomModBlockClass:CustomModBlockControl(anchor, rect, configTab, blockIndex, blockData)
self:Control(anchor, rect)
self:ControlHost()
Expand Down
10 changes: 6 additions & 4 deletions src/Classes/Control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ local rect = {
---@field shown Prop<boolean>
---@field x Prop<number>?
---@field y Prop<number>?
---@field width Prop<number>?
---@field height Prop<number>?
local ControlClass = newClass("Control")

---@alias ControlAnchor [AnchorPoint, Control|ControlHost, AnchorPoint, boolean|nil]
---@alias ControlRect [number|nil, number|nil, number|nil, number]
---@alias Anchor [AnchorPoint, Control|ControlHost, AnchorPoint, boolean|nil]
---@alias Rect [Prop<number>?,Prop<number>?, Prop<number>?, Prop<number>?]

---@param anchor? ControlAnchor
---@param rect? ControlRect
---@param anchor? Anchor
---@param rect? Rect
function ControlClass:Control(anchor, rect)
self.rectStart = rect or {0, 0, 0, 0}
self.x, self.y, self.width, self.height = unpack(self.rectStart)
Expand Down
4 changes: 2 additions & 2 deletions src/Classes/GemSelectControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ local imbuedTooltipText = "\"Socketed in\" item must be set in order to add an i
---@class GemSelectControl: EditControl
local GemSelectClass = newClass("GemSelectControl", "EditControl")

---@param anchor ControlAnchor
---@param rect ControlRect
---@param anchor Anchor
---@param rect Rect
---@param skillsTab SkillsTab
---@param index integer
---@param changeFunc fun(...)
Expand Down
6 changes: 3 additions & 3 deletions src/Classes/ImportTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ end


--- @class CharacterPassives
--- @field mastery_effects table<string, int>
--- @field mastery_effects table<string, integer>
--- @field skill_overrides table<string, table>
--- @field jewel_data table<string, table>
--- @field hashes_ex integer[]
Expand All @@ -1119,10 +1119,10 @@ end
--- @field alternate_ascendancy string | integer integer on website, string on oauth

-- https://www.pathofexile.com/developer/docs/reference#type-Item
--- @alias Item any
--- @alias GGGItem any

--- @class CharacterPassivesData : CharacterBasicData
--- @field jewels Item[]
--- @field jewels GGGItem[]
--- @field passives CharacterPassives
--- @param charData CharacterPassivesData
--- @param deleteJewels boolean
Expand Down
28 changes: 24 additions & 4 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ for _, curInfluenceInfo in ipairs(influenceInfo) do
influenceItemMap[curInfluenceInfo.display.." Item"] = curInfluenceInfo.key
end

---@enum (key) LineFlags
local lineFlags = {
["crafted"] = true,
["crucible"] = true,
Expand Down Expand Up @@ -406,6 +407,19 @@ function ItemClass:NormaliseVariantSelections()
end
end

---@class ModLine A modifier line on an item. An in-game mod can translate to multiple ModLines.
---@field modList Mod[]
---@field line string The actual text for the line. This might describe a range of values, in which case applyRange() can be used with this and the range value to get a ranged line.
---@field range number?
---@field extra string?
---@field valueScalar number?
---@field [LineFlags] boolean?
---@field modTags string[]?
---@field variantList table<number, boolean>?
---@field versionList table<number, boolean>?
---@field variantGroupList table<number, boolean>?
---@field modId string?

-- Parse raw item data and extract item name, base type, quality, and modifiers
function ItemClass:ParseRaw(raw, rarity, highQuality)
self.raw = raw
Expand Down Expand Up @@ -472,11 +486,16 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
self.sockets = { }
self.classRequirementModLines = { }
self.buffModLines = { }
---@type ModLine[]
self.enchantModLines = { }
self.scourgeModLines = { }
self.implicitModLines = { }
self.explicitModLines = { }
self.crucibleModLines = { }
---@type ModLine[]
self.scourgeModLines = {}
---@type ModLine[]
self.implicitModLines = {}
---@type ModLine[]
self.explicitModLines = {}
---@type ModLine[]
self.crucibleModLines = {}
-- old items or trade-sourced items have increases to modifiers baked in to the item text, which
-- means that we can't add e.g. quality or mod magnitude effect to them during parsing. we will
-- assume an item to be an advanced copy format if either has mod roll information, a modifier
Expand Down Expand Up @@ -849,6 +868,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
gameModeStage = "EXPLICIT"
end
if not specName or foundExplicit or foundImplicit then
---@type ModLine
local modLine = { modTags = {} }

line = line:gsub("{(%a*):?([^}]*)}", function(k,val)
Expand Down
9 changes: 9 additions & 0 deletions src/Classes/ItemDBControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ local m_floor = math.floor
---@class ItemDBControl: ListControl
local ItemDBClass = newClass("ItemDBControl", "ListControl")

---@class ItemDBData
---@field list Item[]
---@field loading boolean

---@param anchor Anchor
---@param rect Rect
---@param itemsTab ItemsTab
---@param db ItemDBData
---@param dbType "RARE"|"UNIQUE"
function ItemDBClass:ItemDBControl(anchor, rect, itemsTab, db, dbType)
self:ListControl(anchor, rect, 16, "VERTICAL", false)
self.itemsTab = itemsTab
Expand Down
4 changes: 4 additions & 0 deletions src/Classes/ItemListControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ local t_insert = table.insert
---@class ItemListControl: ListControl
local ItemListClass = newClass("ItemListControl", "ListControl")

---@param anchor Anchor
---@param rect Rect
---@param itemsTab ItemsTab
---@param forceTooltip boolean?
function ItemListClass:ItemListControl(anchor, rect, itemsTab, forceTooltip)
self:ListControl(anchor, rect, 16, "VERTICAL", true, itemsTab.itemOrderList, forceTooltip)
self.itemsTab = itemsTab
Expand Down
7 changes: 7 additions & 0 deletions src/Classes/ItemSlotControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ local itemSlotHelper = LoadModule("Modules/ItemSlotHelper")
---@class ItemSlotControl
local ItemSlotClass = newClass("ItemSlotControl", "DropDownControl")

---@param anchor Anchor
---@param x Prop<number>
---@param y Prop<number>
---@param itemsTab ItemsTab
---@param slotName string
---@param slotLabel string
---@param nodeId integer?
function ItemSlotClass:ItemSlotControl(anchor, x, y, itemsTab, slotName, slotLabel, nodeId)
self:DropDownControl(anchor, { x, y, 310, 20 }, {}, function(index, value)
if self.items[index] ~= self.selItemId then
Expand Down
3 changes: 3 additions & 0 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4308,6 +4308,9 @@ local function cloneSpecForJewelComparison(spec)
return specCopy
end

---@param itemsTab ItemsTab
---@param compareSlot ItemSlotControl
---@param replacementItem Item
local function buildSpecForJewelComparison(itemsTab, compareSlot, replacementItem)
local tempItemId
local spec = cloneSpecForJewelComparison(itemsTab.build.spec)
Expand Down
4 changes: 2 additions & 2 deletions src/Classes/LabelControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
---@class LabelControl: Control
local LabelClass = newClass("LabelControl", "Control")

---@param anchor? ControlAnchor
---@param rect? ControlRect
---@param anchor? Anchor
---@param rect? Rect
---@param label string
function LabelClass:LabelControl(anchor, rect, label)
self:Control(anchor, rect)
Expand Down
9 changes: 8 additions & 1 deletion src/Classes/ListControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@ local m_min = math.min
local m_max = math.max
local m_floor = math.floor

---@class ListControl: Control, ControlHost
---@class ListControl<T>: Control, ControlHost
local ListClass = newClass("ListControl", "Control", "ControlHost")

---@param anchor Anchor
---@param rect Rect
---@param rowHeight number
---@param scroll "HORIZONTAL"|"VERTICAL"|nil
---@param isMutable boolean?
---@param list T[]?
---@param forceTooltip any
function ListClass:ListControl(anchor, rect, rowHeight, scroll, isMutable, list, forceTooltip)
self:Control(anchor, rect)
self:ControlHost()
Expand Down
Loading
Loading