Skip to content

Draft/trendingbuilds #7786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
dc008fe
Add ascendancy assets.
canuysal Mar 17, 2024
659f524
Add archives list control.
canuysal Mar 17, 2024
1d77fe6
Add archive list control to buildlist module.
canuysal Mar 17, 2024
157c469
ArchivesList: prevent missing image artwork for builds with no ascend…
canuysal Mar 20, 2024
a761f67
ArchivesList: prevent line and stats collapsing on some builds.
canuysal Mar 20, 2024
1cf2f59
ArchivesList: fix scrollbar content dimensions.
canuysal Mar 20, 2024
7035ed0
ArchivesListControl: Display life or es depending on which is greater.
canuysal Mar 27, 2024
a5e14ae
ArchivesListControl: prevent stats overlapping on smaller screens.
canuysal Mar 27, 2024
4c8c995
ArchivesListControl: resize button on screen size change.
canuysal Mar 27, 2024
2e4c79f
ArchivesListControl: implement word-break on main skill field.
canuysal Mar 27, 2024
b231a23
ArchivesListControl: hide author name from the build cards.
canuysal Mar 27, 2024
8b10fd0
rename ExtBuildListControl.
canuysal Mar 27, 2024
987b3a3
Refactor class names.
canuysal Mar 27, 2024
a15b2ef
Add ExtBuildListProvider abstract class.
canuysal May 9, 2024
d666b4b
Add PoBArchivesProvider class.
canuysal May 9, 2024
27cee02
Modify ExtBuildListControl to have a generic implementation.
canuysal May 9, 2024
09bd958
Highlight active tab, use white border.
canuysal May 9, 2024
34d5ed0
ExtBuildListControl: Add responsive behaviour to the tabs and dropdown.
canuysal May 9, 2024
e947bf3
ExtBuildListControl: Fix scrollbar.
canuysal May 9, 2024
c40227f
Store import links in the xml.
canuysal May 10, 2024
2b48b6b
Build: Implement similar builds list.
canuysal May 18, 2024
58b20a0
ExtBuildListControl: Prevent overflow on bottom side.
canuysal May 18, 2024
9e4a5a1
Common: Add import build utility function.
canuysal May 18, 2024
37b01b6
Remove unnecessary debug.
canuysal May 23, 2024
a5756dc
Convert protocol handler URI's to import links on startup.
canuysal May 23, 2024
48c3a97
Implement similarity check for all builds.
canuysal Jul 15, 2024
c804c38
Print proper error messages on build list.
canuysal Jul 15, 2024
86b7b4e
Add similar builds popup.
canuysal Jul 15, 2024
b8c6277
Add class portrait assets.
canuysal Jul 15, 2024
75ef74d
Use class portraits as fallback images.
canuysal Jul 15, 2024
7e8d622
Remove unnecessary assets, fix templar portrait.
canuysal Jul 15, 2024
3ebd580
Merge branch 'dev' into feature/pobarchiveslist
Jul 16, 2024
a86e62c
Formatting changes
Jul 17, 2024
f2e1957
ExtBuildListProvider: Fix indentation.
canuysal Jul 17, 2024
f5232c6
Fix bugged font
Jul 17, 2024
738c74f
Further font fix
Jul 17, 2024
058b6c7
Fix split string calculation with different fonts
canuysal Jul 17, 2024
af293f2
Button layout and text positions
Jul 17, 2024
482ebea
Fix spacing on builds page
Jul 17, 2024
257c4a5
Fix Similar builds Popup on different window size
Jul 17, 2024
3ab9d5e
Revert "Fix Similar builds Popup on different window size"
Jul 18, 2024
f0d7277
General popup resize code
Jul 18, 2024
1381d4f
Add show public builds options to settings.
canuysal Jul 18, 2024
2c325ee
Update latest-trending builds option name.
canuysal Jul 18, 2024
e2ea7a1
Add help section and tooltip for similar builds.
canuysal Jul 18, 2024
a73ef61
Use build names as a filename placeholder after importing.
canuysal Jul 18, 2024
f8392c1
Add cells to the grid, fix horizontal line issue.
canuysal Jul 18, 2024
da73a02
Center version text.
canuysal Jul 18, 2024
db2ef0d
Improve responsiveness of builds list menu.
canuysal Jul 19, 2024
3d7799a
Merge remote-tracking branch 'origin/dev' into feature/pobarchiveslist
canuysal Jul 21, 2024
8ac0ffe
Rearrange similar builds button after loadouts.
canuysal Jul 21, 2024
a3d6fef
Remove redundant function.
canuysal Jul 22, 2024
9759a14
Check if image asset exists, prevents Warden placeholder.
canuysal Jul 22, 2024
31dff76
Reduce code complexity.
canuysal Jul 22, 2024
3b48dbb
Fix savename using filepath as a placeholder.
canuysal Jul 22, 2024
c98d509
Fix indentation.
canuysal Jul 22, 2024
fda63ba
Draft: Too many issues.
canuysal Jul 22, 2024
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
11 changes: 11 additions & 0 deletions help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,14 @@ If you wish to add more items, you can copy and paste items using CTRL+C (from t
The item sets section located at the top of the screen can be used to save multiple sets of items and easily switch between them. You can add, remove, rename, and copy new sets using the "Manage..." button.

If you want to search for item upgrades, you can use the "Trade for these items" button to quickly search for items that can improve your gear.

---[Similar Builds Popup]

The Similar Builds Popup allows you to search for builds similar to your current character.

To access the Similar Builds Popup, click on the "Similar Builds" button located at the top of the screen.

It will fetch the builds most similar to your character and sort them by the latest league and match score.

For best results, make sure to select your main item set, tree, and skills before opening the popup.
If you are using leveling gear/tree, it will match with other leveling builds.
Binary file modified runtime/SimpleGraphic/Fonts/Liberation Sans Bold.18.tga
Binary file not shown.
2 changes: 1 addition & 1 deletion runtime/SimpleGraphic/Fonts/Liberation Sans Bold.tgf
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ GLYPH 70 176 2 1 1; // 108 (l)
GLYPH 76 176 13 0 1; // 109 (m)
GLYPH 93 176 9 0 1; // 110 (n)
GLYPH 106 176 8 1 1; // 111 (o)
GLYPH 0 198 9 0 1; // 112 (p)
GLYPH 0 198 8 1 1; // 112 (p)
GLYPH 13 198 8 1 1; // 113 (q)
GLYPH 25 198 6 0 0; // 114 (r)
GLYPH 35 198 7 1 1; // 115 (s)
Expand Down
Binary file added src/Assets/ascendants/ascendant.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/assassin.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/berserker.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/champion.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/chieftain.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/deadeye.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/duelist.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/elementalist.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/gladiator.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/guardian.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/hierophant.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/inquisitor.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/juggernaut.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/marauder.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/necromancer.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/occultist.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/pathfinder.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/raider.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/ranger.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/saboteur.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/scion.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/shadow.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/slayer.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/templar.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/trickster.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/ascendants/witch.jpeg
295 changes: 295 additions & 0 deletions src/Classes/BuildCardControl.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,295 @@
-- Path of Building
--
-- Class: Build Card Control
-- Build card control for external build lists.
--

local ipairs = ipairs
local s_format = string.format
local t_insert = table.insert
local m_max = math.max
local m_min = math.min
local dkjson = require "dkjson"

local BuildCardClass = newClass("BuildCardControl", "ControlHost", "Control",
function(self, anchor, x, y, width, height, build, maxY)
self.ControlHost()
self.Control(anchor, x, y, width, height)
self:SelectControl()
self.build = build
self.font = "VAR"
self.currentHeight = y
self.maxY = maxY

end)

-- splits strings by word and maxWidth
function BuildCardClass:IsMouseOver()
if not self:IsShown() then
return
end
return self:IsMouseInBounds() or self:GetMouseOverControl()
end

function BuildCardClass:OnKeyDown(key, doubleClick)
if not self:IsShown() or not self:IsEnabled() then
return
end
local mOverControl = self:GetMouseOverControl()
if mOverControl and mOverControl.OnKeyDown then
return mOverControl:OnKeyDown(key)
end
if not self:IsMouseOver() and key:match("BUTTON") then
return
end
end

function BuildCardClass:OnKeyUp(key)
if not self:IsShown() or not self:IsEnabled() then
return
end
end

function BuildCardClass:GetAscendancyImageHandle(ascendancy)
if ascendancy then
local fileName = s_format('Assets/ascendants/%s.jpeg', (ascendancy:gsub("^%l", string.lower)))
local file = io.open(fileName, "r")
if file then
file:close()
local image = NewImageHandle()
image:Load(fileName)
return image
end
end

return nil
end

function BuildCardClass:importBuild()
if not (self.build.buildLink) then
print("Build link is not provided.")
return
end
ImportBuild(self.build.buildLink, function(xmlText, urlText)
if xmlText then
main:SetMode("BUILD", false,
self.build.buildName .. (self.build.authorName and (" - " .. self.build.authorName) or ""),
xmlText, false, urlText)
end
end)
end

-- splits strings by word and maxWidth
function BuildCardClass:splitStringByWidth(str, maxWidth, font)
local words = {}
for word in str:gmatch("%S+") do
t_insert(words, word)
end

local lines = {}
local currentLine = ""
for _, word in ipairs(words) do
local wordWidth = DrawStringWidth(16, font, currentLine .. " " .. word)
if wordWidth <= maxWidth then
currentLine = currentLine .. (currentLine == "" and "" or " ") .. word
else
t_insert(lines, currentLine)
currentLine = word
end
end
t_insert(lines, currentLine)

return lines
end

-- wrappers for Drawing tools to apply scrolling
function BuildCardClass:DrawImage(imgHandle, left, top, width, height)
if top + height <= self.maxY() and self.shown then
DrawImage(imgHandle, left, top, width, height)
end
end

function BuildCardClass:DrawString(left, top, align, height, font, text)
if top + height <= self.maxY() and self.shown then
DrawString(left, top, align, height, font, text)
end
end

function BuildCardClass:Draw(viewPort, noTooltip)
local build = self.build
local x, y = self:GetPos()

x = x + 10
y = y + 10

local currentHeight = y

if build.buildName then
local image = nil
if build.ascendancy or build.class then
image = self:GetAscendancyImageHandle(build.ascendancy or build.class)
if image then
SetDrawColor(0.5, 0.5, 0.5)
self:DrawImage(nil, x + self.width() - 115, currentHeight - 1, 82, 82)
SetDrawColor(1, 1, 1)
self:DrawImage(image, x + self.width() - 114, currentHeight, 80, 80)
end
end

-- title
local maxTitle = 3
local titleLines = self:splitStringByWidth(build.buildName, self.width() - 180, "VAR BOLD")
for var=1,maxTitle,1 do
local title = titleLines[var]
-- append ... to last line if there are more lines than max.
title = title and (title .. ((#titleLines > maxTitle and maxTitle == var) and "..." or "")) or ""
-- lineCount = lineCount + 1
self:DrawString(x, currentHeight, "LEFT", 18, "VAR BOLD", title)
currentHeight = currentHeight + 18
end

-- decorator line
currentHeight = currentHeight + 4
SetDrawColor(0.5, 0.5, 0.5)
self:DrawImage(nil, x - 9, currentHeight, self.width() - 115, 1)
SetDrawColor(1, 1, 1)
currentHeight = currentHeight + 8

-- main skill
SetDrawColor(1, 1, 1)
if build.mainSkill and build.mainSkill ~= "" then
local skillLines = self:splitStringByWidth(build.mainSkill, self.width() - 125, self.font)
local skill = skillLines[1] .. (#skillLines > 1 and "..." or "")
self:DrawString(x, currentHeight, "LEFT", 16, self.font, skill)
else
self:DrawString(x, currentHeight, "LEFT", 16, self.font, '-')
end

-- decorator line
currentHeight = currentHeight + 24
SetDrawColor(0.5, 0.5, 0.5)
self:DrawImage(nil, x - 9, currentHeight, self.width() - 2, 1)
currentHeight = currentHeight + 8
SetDrawColor(1, 1, 1)

-- author
if build.author then
self:DrawString(x, currentHeight, "LEFT", 14, self.font, s_format('%s', build.author))
end

-- version
if build.version then
local authorWidth = build.author and DrawStringWidth(14, self.font, s_format('%s', build.author)) or 0
self:DrawString(x + authorWidth + 20, currentHeight, "LEFT", 14, self.font, s_format('%s', build.version))
SetDrawColor(0.5, 0.5, 0.5)
if authorWidth then
self:DrawImage(nil, x + authorWidth + 10, currentHeight - 7, 1, 28)
self:DrawImage(nil, x + authorWidth + DrawStringWidth(14, self.font, build.version) + 30, currentHeight - 7, 1,
28)
end
end


-- decorator line
currentHeight = currentHeight + 20
SetDrawColor(0.5, 0.5, 0.5)
self:DrawImage(nil, x - 9, currentHeight, self.width() - 2, 1)
currentHeight = currentHeight + 8
SetDrawColor(1, 1, 1)

-- stats
local dpsText = "DPS: 0"
local lifeText = "Life: 0"
local ehpText = "EHP: 0"
if build.dps then
-- SetDrawColor(1, 0, 0)
dpsText = formatNumSep(s_format('DPS: %0.f', build.dps))
end
if build.life or build.es then
-- SetDrawColor(0, 1, 0)
lifeText = formatNumSep(s_format('%s: %0.f', build.life > build.es and "Life" or "ES",
math.max(build.life, build.es)))
end
if build.ehp then
-- SetDrawColor(0, 0, 1)
ehpText = formatNumSep(s_format('EHP: %0.f', build.ehp))
end

-- prevent overlapping on smaller screens.
local dpsWidth = DrawStringWidth(14, self.font, dpsText)
local lifeWidth = DrawStringWidth(14, self.font, lifeText)
local ehpWidth = DrawStringWidth(14, self.font, ehpText)
if (dpsWidth + lifeWidth + ehpWidth < self.width() - 30) then
self:DrawString(x, currentHeight, "LEFT", 14, self.font, dpsText)
SetDrawColor(0.5, 0.5, 0.5)
self:DrawImage(nil, x + dpsWidth + 10, currentHeight - 7, 1, 28)
SetDrawColor(1, 1, 1)
self:DrawString(x + dpsWidth + 20, currentHeight, "LEFT", 14, self.font, lifeText)
SetDrawColor(0.5, 0.5, 0.5)
self:DrawImage(nil, x + dpsWidth + lifeWidth + 30, currentHeight - 7, 1, 28)
self:DrawImage(nil, x + dpsWidth + lifeWidth + ehpWidth + 50, currentHeight - 7, 1, 28)
SetDrawColor(1, 1, 1)
self:DrawString(x + dpsWidth + lifeWidth + 40, currentHeight, "LEFT", 14, self.font, ehpText)
currentHeight = currentHeight + 20
-- decorator line
SetDrawColor(0.5, 0.5, 0.5)
self:DrawImage(nil, x - 9, currentHeight, self.width() - 2, 1)
currentHeight = currentHeight + 3
end

if build.metadata then
currentHeight = currentHeight + 4
for _, metadata in pairs(build.metadata) do
SetDrawColor(1, 1, 1)
self:DrawString(x, currentHeight, "LEFT", 14, self.font, metadata.key .. ": " .. metadata.value)
currentHeight = currentHeight + 20
SetDrawColor(0.5, 0.5, 0.5)
self:DrawImage(nil, x - 9, currentHeight, self.width(), 1)
end
end

-- draw buttons
currentHeight = currentHeight + 4
if not self.controls.importButton then
self.controls.importButton = new("ButtonControl", nil, self.x + 10, currentHeight, 47, 20, "Import", function()
self:importBuild()
end)
else
self.controls.importButton.x = self.x + 10
self.controls.importButton.y = currentHeight
if currentHeight > self.maxY() then
self.controls.importButton.shown = false and self.shown
else
self.controls.importButton.shown = true and self.shown
end
end

if not self.controls.previewButton then
self.controls.previewButton = new("ButtonControl", nil, self.x + 60, currentHeight, 60, 20, "Preview", function()
if self.build.previewLink then
OpenURL(self.build.previewLink)
end
end)
else
self.controls.previewButton.x = self.x + 60
self.controls.previewButton.y = currentHeight
if currentHeight > self.maxY() then
self.controls.previewButton.shown = false and self.shown
else
self.controls.previewButton.shown = true and self.shown
end
end

-- bottom border
SetDrawColor(1, 1, 1)
currentHeight = currentHeight + 26
self:DrawImage(nil, x - 9, currentHeight, self.width() - 1, 3)
-- currentHeight = currentHeight + 16

self:DrawString(x, currentHeight - 10, "LEFT", 14, self.font, s_format('%s', currentHeight - y))


self:DrawControls(viewPort, (noTooltip and not self.forceTooltip) and self)
return currentHeight - y
end
end
3 changes: 3 additions & 0 deletions src/Classes/BuildListControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ local BuildListClass = newClass("BuildListControl", "ListControl", function(self
end
end
self.dragTargetList = { self.controls.path, self }
self.controls.path.width = function ()
return self.width()
end
end)

function BuildListClass:SelByFileName(selFileName)
Expand Down
Loading
Loading