Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
LocalIdentity committed Apr 20, 2020
2 parents 848e9bc + 6341daf commit 8df1473
Show file tree
Hide file tree
Showing 112 changed files with 13,234 additions and 11,047 deletions.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

Thank you for reporting an issue.

Before reporting a bug, **please make sure that you are running the latest version.**
You can get the latest version number from `CHANGELOG.md`

Please try to fill in as much of the template below as you're able.

* **What happened?**
* **What were you trying to do?**
* **What steps will reproduce the bug?**
* **Does it reproduce every time? If not, why so?**
* **Additional information:**
If you receive an error or experience graphical bugs, include a screenshot.
Also include a shareable build link, even in cases where you experience issues not specific to a certain build. This helps us greatly to reproduce bugs faster.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
Binary file removed Assets/patreon_logo.png
Binary file not shown.
32 changes: 26 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,32 @@ If you want to use a text editor, [Visual Studio Code](https://code.visualstudio
If you want to use an IDE instead, [PyCharm Community](https://www.jetbrains.com/pycharm/) or [IntelliJ Idea Community](https://www.jetbrains.com/idea/) are recommended.
They are all free and open source and support [EmmyLua](https://github.com/EmmyLua), a Lua plugin that comes with a language server, debugger and many pleasant features. It is recommended to use it over the built-in Lua plugins.

To setup a debugger for PoB on an IDE with EmmyLua:
* Create a new 'Debug Configuration' of type 'Emmy Debugger(NEW)'.
* Select 'x86' version.
* Select if you want the program to block (checkbox) until you attached the debugger (useful if you have to debug the startup process).
* Copy the generated code snippet directly below `function launch:OnInit()` in `./Launch.lua`.
* Start PoB and attach debugger.
##### Visual Studio Code

1. Create a new 'Debug Configuration' of type 'EmmyLua New Debug'
2. Open the Visual Studio Code extensions folder. On Windows, this defaults to `%USERPROFILE%/.vscode/extensions`.
3. Find the subfolder that contains `emmy_core.dll`. You should find both x86 and x64; pick x86. For example, `C:/Users/someuser/.vscode/extensions/tangzx.emmylua-0.3.28/debugger/emmy/windows/x86`.
4. Paste the following code snippet directly below `function launch:OnInit()` in `./Launch.lua`:
```lua
-- This is the path to emmy_core.dll. The ?.dll at the end is intentional.
package.cpath = package.cpath .. ';C:/Users/someuser/.vscode/extensions/tangzx.emmylua-0.3.28/debugger/emmy/windows/x86/?.dll'
local dbg = require('emmy_core')
-- This port must match the Visual Studio Code configuration. Default is 9966.
dbg.tcpListen('localhost', 9966)
-- Uncomment the next line if you want Path of Building to block until the debugger is attached
--dbg.waitIDE()
```
5. Start Path of Building
6. Attach the debugger

##### IntelliJ Idea Community

1. Create a new 'Debug Configuration' of type 'Emmy Debugger(NEW)'.
2. Select 'x86' version.
3. Select if you want the program to block (checkbox) until you attached the debugger (useful if you have to debug the startup process).
4. Copy the generated code snippet directly below `function launch:OnInit()` in `./Launch.lua`.
5. Start Path of Building
6. Attach the debugger

#### Exporting Data from a GGPK file

Expand Down
8 changes: 7 additions & 1 deletion Classes/CalcBreakdownControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ function CalcBreakdownClass:AddModSection(sectionData, modList)
-- Modifier is from a passive node, add node name, and add node ID (used to show node location)
local nodeId = row.mod.source:match("Tree:(%d+)")
if nodeId then
local node = build.spec.nodes[tonumber(nodeId)]
local nodeIdNumber = tonumber(nodeId)
local node = build.spec.nodes[nodeIdNumber] or build.spec.tree.nodes[nodeIdNumber]
row.sourceName = node.dn
row.sourceNameNode = node
end
Expand Down Expand Up @@ -410,6 +411,11 @@ function CalcBreakdownClass:AddModSection(sectionData, modList)
local base = tag.base and (self:FormatModBase(row.mod, tag.base).." + "..math.abs(row.mod.value).." ") or baseVal
desc = base.."per "..(tag.div or 1).." "..self:FormatVarNameOrList(tag.stat, tag.statList)
baseVal = ""
elseif tag.type == "PercentStat" then
local finalPercent = (row.mod.value * (tag.percent / 100)) * 100
local base = tag.base and (self:FormatModBase(row.mod, tag.base).." + "..math.abs(finalPercent).." ") or self:FormatModBase(row.mod, finalPercent)
desc = base.."% of "..self:FormatVarNameOrList(tag.stat, tag.statList)
baseVal = ""
elseif tag.type == "MultiplierThreshold" or tag.type == "StatThreshold" then
desc = "If "..self:FormatVarNameOrList(tag.var or tag.stat, tag.varList or tag.statList)..(tag.upper and " <= " or " >= ")..(tag.threshold or self:FormatModName(tag.thresholdVar or tag.thresholdStat))
elseif tag.type == "SkillName" then
Expand Down
217 changes: 128 additions & 89 deletions Classes/CalcSectionControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,46 @@
--
local t_insert = table.insert

local CalcSectionClass = newClass("CalcSectionControl", "Control", "ControlHost", function(self, calcsTab, width, id, group, label, col, data, updateFunc)
local CalcSectionClass = newClass("CalcSectionControl", "Control", "ControlHost", function(self, calcsTab, width, id, group, colour, subSection, updateFunc)
self.Control(calcsTab, 0, 0, width, 0)
self.ControlHost()
self.calcsTab = calcsTab
self.id = id
self.group = group
self.label = label
self.col = col
self.data = data
self.extra = data.extra
self.flag = data.flag
self.notFlag = data.notFlag
self.colour = colour
self.subSection = subSection
self.flag = subSection[1].data.flag
self.notFlag = subSection[1].data.notFlag
self.updateFunc = updateFunc
for _, data in ipairs(self.data) do
for _, colData in ipairs(data) do
if colData.control then
-- Add control to the section's control list and set show/hide function
self.controls[colData.controlName] = colData.control
colData.control.shown = function()
return self.enabled and not self.collapsed and data.enabled

for i, subSec in ipairs(self.subSection) do
for _, data in ipairs(subSec.data) do
for _, colData in ipairs(data) do
if colData.control then
-- Add control to the section's control list and set show/hide function
self.controls[colData.controlName] = colData.control
colData.control.shown = function()
return self.enabled and not self.subSection[1].collapsed and not subSec.collapsed and data.enabled
end
end
end
end
end
self.controls.toggle = new("ButtonControl", {"TOPRIGHT",self,"TOPRIGHT"}, -3, 3, 16, 16, function()
return self.collapsed and "+" or "-"
end, function()
self.collapsed = not self.collapsed
self.calcsTab.modFlag = true
end)
self.controls.toggle.shown = function()
return self.enabled
subSec.collapsed = subSec.defaultCollapsed
self.controls["toggle"..i] = new("ButtonControl", {"TOPRIGHT",self,"TOPRIGHT"}, -3, -13 + (16 * i), 16, 16, function()
return subSec.collapsed and "+" or "-"
end, function()
subSec.collapsed = not subSec.collapsed
self.calcsTab.modFlag = true
end)
if i == 1 then
self.controls["toggle"..i].shown = function()
return self.enabled
end
else
self.controls["toggle"..i].shown = function()
return self.enabled and not self.subSection[1].collapsed
end
end
end
self.shown = function()
return self.enabled
Expand All @@ -51,20 +59,22 @@ function CalcSectionClass:IsMouseOver()
return true
end
local mOver = self:IsMouseInBounds()
if mOver and not self.collapsed and self.enabled then
-- Check if mouse is over one of the cells
local cursorX, cursorY = GetCursorPos()
for _, data in ipairs(self.data) do
if data.enabled then
for _, colData in ipairs(data) do
if colData.control then
for _, subSec in ipairs(self.subSection) do
if mOver and not subSec.collapsed and self.enabled then
-- Check if mouse is over one of the cells
local cursorX, cursorY = GetCursorPos()
for _, data in ipairs(subSec.data) do
if data.enabled then
for _, colData in ipairs(data) do
if colData.control then
if colData.control:IsMouseOver() then
return mOver, colData
end
elseif cursorX >= colData.x and cursorY >= colData.y and cursorX < colData.x + colData.width and cursorY < colData.y + colData.height then
return mOver, colData
end
end
end
end
end
end
Expand All @@ -79,30 +89,41 @@ function CalcSectionClass:UpdateSize()
end
local x, y = self:GetPos()
local width = self:GetSize()
self.height = 0
self.height = 2
self.enabled = false
local yOffset = 22
for _, rowData in ipairs(self.data) do
rowData.enabled = self.calcsTab:CheckFlag(rowData)
if rowData.enabled then
self.enabled = true
local xOffset = 134
for col, colData in ipairs(rowData) do
colData.xOffset = xOffset
colData.yOffset = yOffset
colData.width = self.data.colWidth or width - 136
colData.height = 18
xOffset = xOffset + colData.width
local yOffset = 0
for i, subSec in ipairs(self.subSection) do
self.controls["toggle"..i].y = yOffset + 3
local tempHeight = 0
yOffset = yOffset + 22
for _, rowData in ipairs(subSec.data) do
rowData.enabled = self.calcsTab:CheckFlag(rowData)
if rowData.enabled then
self.enabled = true
local xOffset = 134
for colour, colData in ipairs(rowData) do
colData.xOffset = xOffset
colData.yOffset = yOffset
colData.width = subSec.data.colWidth or width - 136
colData.height = 18
xOffset = xOffset + colData.width
end
yOffset = yOffset + 18
self.height = self.height + 18
tempHeight = tempHeight + 18
end
if subSec.collapsed then
rowData.enabled = false
end
yOffset = yOffset + 18
self.height = self.height + 18
end
if self.collapsed then
rowData.enabled = false
if self.enabled and not subSec.collapsed then
self.height = self.height + 22
else
self.height = self.height - tempHeight + 20
yOffset = yOffset - tempHeight - 2
end
end
if self.enabled and not self.collapsed then
self.height = self.height + 24
if self.enabled and not self.subSection[1].collapsed then
if self.updateFunc then
self:updateFunc()
end
Expand All @@ -112,21 +133,23 @@ function CalcSectionClass:UpdateSize()
end

function CalcSectionClass:UpdatePos()
if self.collapsed or not self.enabled then
if self.subSection[1].collapsed or not self.enabled then
return
end
local x, y = self:GetPos()
for _, rowData in ipairs(self.data) do
if rowData.enabled then
for col, colData in ipairs(rowData) do
-- Update the real coordinates of this cell
colData.x = x + colData.xOffset
colData.y = y + colData.yOffset
for _, subSec in ipairs(self.subSection) do
for _, rowData in ipairs(subSec.data) do
if rowData.enabled then
for colour, colData in ipairs(rowData) do
-- Update the real coordinates of this cell
colData.x = x + colData.xOffset
colData.y = y + colData.yOffset
if colData.control then
colData.control.x = colData.x + 4
colData.control.y = colData.y + 9 - colData.control.height/2
end
end
end
end
end
end
Expand Down Expand Up @@ -197,44 +220,58 @@ function CalcSectionClass:Draw(viewPort)
local actor = self.calcsTab.input.showMinion and self.calcsTab.calcsEnv.minion or self.calcsTab.calcsEnv.player
-- Draw border and background
SetDrawLayer(nil, -10)
SetDrawColor(self.col)
SetDrawColor(self.colour)
DrawImage(nil, x, y, width, height)
SetDrawColor(0.10, 0.10, 0.10)
DrawImage(nil, x + 2, y + 2, width - 4, height - 4)
-- Draw label
if not self.enabled then
DrawString(x + 3, y + 3, "LEFT", 16, "VAR BOLD", "^8"..self.label)
else
DrawString(x + 3, y + 3, "LEFT", 16, "VAR BOLD", "^7"..self.label..":")
if self.extra then
local x = x + 3 + DrawStringWidth(16, "VAR BOLD", self.label) + 10
DrawString(x, y + 3, "LEFT", 16, "VAR", self:FormatStr(self.extra, actor))

local primary = true
local lineY = y
for _, subSec in ipairs(self.subSection) do
-- Draw line above label
SetDrawColor(self.colour)
DrawImage(nil, x + 2, lineY, width - 4, 2)
SetDrawColor(0.10, 0.10, 0.10)
-- Draw label
if not self.enabled then
DrawString(x + 3, lineY + 3, "LEFT", 16, "VAR BOLD", "^8"..subSec.label)
else
DrawString(x + 3, lineY + 3, "LEFT", 16, "VAR BOLD", "^7"..subSec.label..":")
if subSec.data.extra then
local x = x + 3 + DrawStringWidth(16, "VAR BOLD", subSec.label) + 10
DrawString(x, lineY + 3, "LEFT", 16, "VAR", self:FormatStr(subSec.data.extra, actor))
end
end
end
-- Draw line below label
SetDrawColor(self.col)
DrawImage(nil, x + 2, y + 20, width - 4, 2)
-- Draw controls
SetDrawLayer(nil, 0)
self:DrawControls(viewPort)
if self.collapsed or not self.enabled then
return
end
local lineY = y + 22
for _, rowData in ipairs(self.data) do
if rowData.enabled then
if rowData.label then
-- Draw row label with background
SetDrawColor(rowData.bgCol or "^0")
DrawImage(nil, x + 2, lineY, 130, 18)
DrawString(x + 132, lineY + 1, "RIGHT_X", 16, "VAR", "^7"..rowData.label.."^7:")
-- Draw line below label
SetDrawColor(self.colour)
DrawImage(nil, x + 2, lineY + 20, width - 4, 2)
-- Draw controls
SetDrawLayer(nil, 0)
self:DrawControls(viewPort)
if subSec.collapsed or not self.enabled then
if primary then
return
else
lineY = lineY + 20
primary = false
end
for col, colData in ipairs(rowData) do
-- Draw column separator at the left end of the cell
SetDrawColor(self.col)
DrawImage(nil, colData.x, lineY, 2, colData.height)
if colData.format and self.calcsTab:CheckFlag(colData) then
if cursorY >= viewPort.y and cursorY < viewPort.y + viewPort.height and cursorX >= colData.x and cursorY >= colData.y and cursorX < colData.x + colData.width and cursorY < colData.y + colData.height then
else
lineY = lineY + 22
primary = false
for _, rowData in ipairs(subSec.data) do
if rowData.enabled then
if rowData.label then
-- Draw row label with background
SetDrawColor(rowData.bgCol or "^0")
DrawImage(nil, x + 2, lineY, 130, 18)
DrawString(x + 132, lineY + 1, "RIGHT_X", 16, "VAR", "^7"..rowData.label.."^7:")
end
for colour, colData in ipairs(rowData) do
-- Draw column separator at the left end of the cell
SetDrawColor(self.colour)
DrawImage(nil, colData.x, lineY, 2, colData.height)
if colData.format and self.calcsTab:CheckFlag(colData) then
if cursorY >= viewPort.y and cursorY < viewPort.y + viewPort.height and cursorX >= colData.x and cursorY >= colData.y and cursorX < colData.x + colData.width and cursorY < colData.y + colData.height then
self.calcsTab:SetDisplayStat(colData)
end
if self.calcsTab.displayData == colData then
Expand All @@ -254,6 +291,8 @@ function CalcSectionClass:Draw(viewPort)
end
end
lineY = lineY + 18
end
end
end
end
end
Expand Down
Loading

0 comments on commit 8df1473

Please sign in to comment.