Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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
Binary file added data/images/game/imbuing/basic-button.png
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 data/images/game/imbuing/blocked-panel.png
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 data/images/game/imbuing/blocked-panels.png
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 data/images/game/imbuing/imbue-scroll-button.png
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 data/images/game/imbuing/imbuement-icons-64.png
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 data/images/game/imbuing/imbui-progress.png
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 data/images/game/imbuing/imbui-timer-bg.png
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 data/images/game/imbuing/intricate-button.png
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 data/images/game/imbuing/pick-item-button.png
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 data/images/game/imbuing/powerfull-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/images/game/imbuing/slot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 data/images/game/prey/balanceBg.png
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 data/images/ui/infoPanel.png
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 data/images/ui/item66.png
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 data/images/ui/right-arrow.png
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 data/images/ui/t2pixel-up-frame-borderimage.png
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 data/images/ui/t2pixel-up-frame-borderimage_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 41 additions & 1 deletion data/styles/10-progressbars.otui
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ProgressBar < UIProgressBar
height: 16
background-color: red
image-source: /images/ui/progressbar
image-border: 1
image-border: 2
font: verdana-11px-rounded
text-offset: 0 2

Expand All @@ -12,6 +12,9 @@ ProgressBar < UIProgressBar
margin-bottom: 0
height: 0

ThickProgressBar < ProgressBar
image-source: /images/ui/progressbar_thick

LifeProgressBar < UIProgressBar
height: 16
background-color: green
Expand All @@ -26,3 +29,40 @@ ProgressRect < UIProgressRect
color: white
background-color: #00000088
font: verdana-11px-rounded

HealthBar < ProgressBar
image-source: /images/ui/progressbarhpmana
image-border: 3

ManaBar < ProgressBar
image-source: /images/ui/progressbarhpmana
image-border: 4
background-color: #4444ff

ProgressBarSD < UIProgressBarSD
height: 22
tooltip-delayed: true

ProgressBarSD < UIProgressBar
height: 22
tooltip-delayed: true

HealthBarSD < ProgressBarSD

ProgressBarSDInv < UIProgressBarSDInverted

InvManaBar < UIProgressBarSDInverted
size: 10 30
image-border: 1

InvVerticalBar < UIVerticalProgressBarSDInverted
size: 10 30
image-border: 1

VerticalBar < UIVerticalProgressBarSD
size: 10 30
image-border: 1

ProgressBarSD < UIProgressBarSD
height: 22
tooltip-delayed: true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Duplicate ProgressBarSD definitions override each other.
The class is declared multiple times with different bases, so only the last definition survives. If you need SD styling for both UIProgressBarSD and UIProgressBar, use distinct class names (and update references).

🔧 One possible consolidation
-ProgressBarSD < UIProgressBar
+ProgressBarSDPlain < UIProgressBar
   height: 22
   tooltip-delayed: true
@@
-ProgressBarSD < UIProgressBarSD
-  height: 22
-  tooltip-delayed: true
🤖 Prompt for AI Agents
In `@data/styles/10-progressbars.otui` around lines 42 - 68, The file defines
ProgressBarSD twice with different bases, causing the first definition to be
overridden; rename one of the ProgressBarSD classes to a distinct name (e.g.,
ProgressBarSD_UIProgressBar or ProgressBarSD_SD) and update all
usages/inheritance to reference the new name so each variant keeps its intended
base (references to UIProgressBarSD vs UIProgressBar), ensure derived classes
like HealthBarSD inherit from the correct renamed variant, and keep other
classes (ProgressBarSDInv, InvManaBar, InvVerticalBar, VerticalBar) unchanged
unless they need to point to the renamed symbol.

109 changes: 109 additions & 0 deletions modules/corelib/ui/uiprogressbarsd.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
-- @docclass
UIProgressBarSD = extends(UIWidget, "UIProgressBarSD")

function UIProgressBarSD.create()
local progressbar = UIProgressBarSD.internalCreate()
progressbar:setFocusable(false)
progressbar:setOn(true)
progressbar.min = 0
progressbar.max = 100
progressbar.value = 0
progressbar.bgBorderLeft = 0
progressbar.bgBorderRight = 0
progressbar.bgBorderTop = 0
progressbar.bgBorderBottom = 0
return progressbar
Comment on lines +4 to +15
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Initialize minimum/maximum instead of min/max to avoid nil clamps.
setValue clamps using self.minimum/self.maximum; with current init those are nil until setters run, so a style-driven percent can throw.

🐛 Proposed fix
-  progressbar.min = 0
-  progressbar.max = 100
+  progressbar.minimum = 0
+  progressbar.maximum = 100
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function UIProgressBarSD.create()
local progressbar = UIProgressBarSD.internalCreate()
progressbar:setFocusable(false)
progressbar:setOn(true)
progressbar.min = 0
progressbar.max = 100
progressbar.value = 0
progressbar.bgBorderLeft = 0
progressbar.bgBorderRight = 0
progressbar.bgBorderTop = 0
progressbar.bgBorderBottom = 0
return progressbar
function UIProgressBarSD.create()
local progressbar = UIProgressBarSD.internalCreate()
progressbar:setFocusable(false)
progressbar:setOn(true)
progressbar.minimum = 0
progressbar.maximum = 100
progressbar.value = 0
progressbar.bgBorderLeft = 0
progressbar.bgBorderRight = 0
progressbar.bgBorderTop = 0
progressbar.bgBorderBottom = 0
return progressbar
🤖 Prompt for AI Agents
In `@modules/corelib/ui/uiprogressbarsd.lua` around lines 4 - 15, The constructor
UIProgressBarSD.create currently initializes progressbar.min/progressbar.max
causing self.minimum/self.maximum to remain nil and break setValue clamps;
change the initialization to set progressbar.minimum and progressbar.maximum
(and keep progressbar.value) so setValue and any style-driven percent
calculations have valid bounds; update any places relying on min/max to use
minimum/maximum or set both aliases if needed to preserve compatibility.

end

function UIProgressBarSD:setMinimum(minimum)
self.minimum = minimum
if self.value < minimum then
self:setValue(minimum)
end
end

function UIProgressBarSD:setMaximum(maximum)
self.maximum = maximum
if self.value > maximum then
self:setValue(maximum)
end
end

function UIProgressBarSD:setValue(value, minimum, maximum)
if minimum then
self:setMinimum(minimum)
end

if maximum then
self:setMaximum(maximum)
end

self.value = math.max(math.min(value, self.maximum), self.minimum)
self:updateBackground()
end

function UIProgressBarSD:setPercent(percent)
self:setValue(percent, 0, 100)
end

function UIProgressBarSD:getPercent()
return self.value
end

function UIProgressBarSD:getPercentPixels()
return (self.maximum - self.minimum) / self:getWidth()
end

function UIProgressBarSD:getProgress()
if self.minimum == self.maximum then return 1 end
return (self.value - self.minimum) / (self.maximum - self.minimum)
end

function UIProgressBarSD:updateBackground()
if self:isOn() then
local width = math.round(math.max((self:getProgress() * (self:getWidth() - self.bgBorderLeft - self.bgBorderRight)), 1))
local height = self:getHeight() - self.bgBorderTop - self.bgBorderBottom
local rect = { x = self.bgBorderLeft, y = self.bgBorderTop, width = width, height = height }
self:setImageRect(rect)

--[[if width == 1 then
self:setImageVisible(false)
else
self:setImageVisible(true)
end]]
end
end

function UIProgressBarSD:onSetup()
self:updateBackground()
end

function UIProgressBarSD:onStyleApply(name, node)
for name,value in pairs(node) do
if name == 'background-border-left' then
self.bgBorderLeft = tonumber(value)
elseif name == 'background-border-right' then
self.bgBorderRight = tonumber(value)
elseif name == 'background-border-top' then
self.bgBorderTop = tonumber(value)
elseif name == 'background-border-bottom' then
self.bgBorderBottom = tonumber(value)
elseif name == 'background-border' then
self.bgBorderLeft = tonumber(value)
self.bgBorderRight = tonumber(value)
self.bgBorderTop = tonumber(value)
self.bgBorderBottom = tonumber(value)
elseif name == 'percent' then
self.percent = self:setPercent(tonumber(value))
elseif name == 'tooltip-delayed' then
self.tooltipDelayed = value
end
end
end

function UIProgressBarSD:onGeometryChange(oldRect, newRect)
if not self:isOn() then
self:setHeight(0)
end
self:updateBackground()
end
111 changes: 111 additions & 0 deletions modules/corelib/uiprogressbarsd.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
-- @docclass
UIProgressBarSD = extends(UIWidget, "UIProgressBarSD")

function UIProgressBarSD.create()
local progressbar = UIProgressBarSD.internalCreate()
progressbar:setFocusable(false)
progressbar:setOn(true)
progressbar.min = 0
progressbar.max = 100
progressbar.value = 0
progressbar.bgBorderLeft = 0
progressbar.bgBorderRight = 0
progressbar.bgBorderTop = 0
progressbar.bgBorderBottom = 0
progressbar:insertLuaCall("onSetup")
progressbar:insertLuaCall("onGeometryChange")
Comment on lines +4 to +16
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Initialize minimum/maximum instead of min/max to avoid nil clamps.
setValue clamps via self.minimum/self.maximum; with current init those are nil until setters run.

🐛 Proposed fix
-  progressbar.min = 0
-  progressbar.max = 100
+  progressbar.minimum = 0
+  progressbar.maximum = 100
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function UIProgressBarSD.create()
local progressbar = UIProgressBarSD.internalCreate()
progressbar:setFocusable(false)
progressbar:setOn(true)
progressbar.min = 0
progressbar.max = 100
progressbar.value = 0
progressbar.bgBorderLeft = 0
progressbar.bgBorderRight = 0
progressbar.bgBorderTop = 0
progressbar.bgBorderBottom = 0
progressbar:insertLuaCall("onSetup")
progressbar:insertLuaCall("onGeometryChange")
function UIProgressBarSD.create()
local progressbar = UIProgressBarSD.internalCreate()
progressbar:setFocusable(false)
progressbar:setOn(true)
progressbar.minimum = 0
progressbar.maximum = 100
progressbar.value = 0
progressbar.bgBorderLeft = 0
progressbar.bgBorderRight = 0
progressbar.bgBorderTop = 0
progressbar.bgBorderBottom = 0
progressbar:insertLuaCall("onSetup")
progressbar:insertLuaCall("onGeometryChange")
🤖 Prompt for AI Agents
In `@modules/corelib/uiprogressbarsd.lua` around lines 4 - 16, In
UIProgressBarSD.create(), the progress bar initializes
progressbar.min/progressbar.max which leaves self.minimum/self.maximum nil (used
by setValue); change the initialization to set progressbar.minimum = 0 and
progressbar.maximum = 100 (keep progressbar.value = 0 and the other setup calls
as-is) so clamps in setValue work correctly.

return progressbar
end

function UIProgressBarSD:setMinimum(minimum)
self.minimum = minimum
if self.value < minimum then
self:setValue(minimum)
end
end

function UIProgressBarSD:setMaximum(maximum)
self.maximum = maximum
if self.value > maximum then
self:setValue(maximum)
end
end

function UIProgressBarSD:setValue(value, minimum, maximum)
if minimum then
self:setMinimum(minimum)
end

if maximum then
self:setMaximum(maximum)
end

self.value = math.max(math.min(value, self.maximum), self.minimum)
self:updateBackground()
end

function UIProgressBarSD:setPercent(percent)
self:setValue(percent, 0, 100)
end

function UIProgressBarSD:getPercent()
return self.value
end

function UIProgressBarSD:getPercentPixels()
return (self.maximum - self.minimum) / self:getWidth()
end

function UIProgressBarSD:getProgress()
if self.minimum == self.maximum then return 1 end
return (self.value - self.minimum) / (self.maximum - self.minimum)
end

function UIProgressBarSD:updateBackground()
if self:isOn() then
local width = math.round(math.max((self:getProgress() * (self:getWidth() - self.bgBorderLeft - self.bgBorderRight)), 1))
local height = self:getHeight() - self.bgBorderTop - self.bgBorderBottom
local rect = { x = self.bgBorderLeft, y = self.bgBorderTop, width = width, height = height }
self:setImageRect(rect)

if width == 1 then
self:setImageVisible(false)
else
self:setImageVisible(true)
end
end
end

function UIProgressBarSD:onSetup()
self:updateBackground()
end

function UIProgressBarSD:onStyleApply(name, node)
for name,value in pairs(node) do
if name == 'background-border-left' then
self.bgBorderLeft = tonumber(value)
elseif name == 'background-border-right' then
self.bgBorderRight = tonumber(value)
elseif name == 'background-border-top' then
self.bgBorderTop = tonumber(value)
elseif name == 'background-border-bottom' then
self.bgBorderBottom = tonumber(value)
elseif name == 'background-border' then
self.bgBorderLeft = tonumber(value)
self.bgBorderRight = tonumber(value)
self.bgBorderTop = tonumber(value)
self.bgBorderBottom = tonumber(value)
elseif name == 'percent' then
self.percent = self:setPercent(tonumber(value))
elseif name == 'tooltip-delayed' then
self.tooltipDelayed = value
end
end
end

function UIProgressBarSD:onGeometryChange(oldRect, newRect)
if not self:isOn() then
self:setHeight(0)
end
self:updateBackground()
end
110 changes: 110 additions & 0 deletions modules/corelib/uiprogressbarsdinverted.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
-- @docclass
UIProgressBarSDInverted = extends(UIWidget, "UIProgressBarSDInverted")

function UIProgressBarSDInverted.create()
local progressbar = UIProgressBarSDInverted.internalCreate()
progressbar:setFocusable(false)
progressbar:setOn(true)
progressbar.min = 0
progressbar.max = 100
progressbar.value = 0
progressbar.bgBorderLeft = 0
progressbar.bgBorderRight = 0
progressbar.bgBorderTop = 0
progressbar.bgBorderBottom = 0
progressbar:insertLuaCall("onSetup")
Comment on lines +4 to +15
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Initialize minimum/maximum instead of min/max to avoid nil clamps.
setValue clamps via self.minimum/self.maximum; with current init those are nil until setters run.

🐛 Proposed fix
-  progressbar.min = 0
-  progressbar.max = 100
+  progressbar.minimum = 0
+  progressbar.maximum = 100
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function UIProgressBarSDInverted.create()
local progressbar = UIProgressBarSDInverted.internalCreate()
progressbar:setFocusable(false)
progressbar:setOn(true)
progressbar.min = 0
progressbar.max = 100
progressbar.value = 0
progressbar.bgBorderLeft = 0
progressbar.bgBorderRight = 0
progressbar.bgBorderTop = 0
progressbar.bgBorderBottom = 0
progressbar:insertLuaCall("onSetup")
function UIProgressBarSDInverted.create()
local progressbar = UIProgressBarSDInverted.internalCreate()
progressbar:setFocusable(false)
progressbar:setOn(true)
progressbar.minimum = 0
progressbar.maximum = 100
progressbar.value = 0
progressbar.bgBorderLeft = 0
progressbar.bgBorderRight = 0
progressbar.bgBorderTop = 0
progressbar.bgBorderBottom = 0
progressbar:insertLuaCall("onSetup")
🤖 Prompt for AI Agents
In `@modules/corelib/uiprogressbarsdinverted.lua` around lines 4 - 15, The create
function sets progressbar.min/progressbar.max which leaves
progressbar.minimum/progressbar.maximum nil and causes setValue (which clamps
against self.minimum/self.maximum) to fail; change
UIProgressBarSDInverted.create to initialize progressbar.minimum and
progressbar.maximum (and set progressbar.value after them) instead of
progressbar.min/progressbar.max so setValue/clamping works correctly, leaving
other initializations (bgBorder*, setFocusable, setOn, insertLuaCall("onSetup"))
unchanged.

progressbar:insertLuaCall("onGeometryChange")
return progressbar
end

function UIProgressBarSDInverted:setMinimum(minimum)
self.minimum = minimum
if self.value < minimum then
self:setValue(minimum)
end
end

function UIProgressBarSDInverted:setMaximum(maximum)
self.maximum = maximum
if self.value > maximum then
self:setValue(maximum)
end
end

function UIProgressBarSDInverted:setValue(value, minimum, maximum)
if minimum then
self:setMinimum(minimum)
end

if maximum then
self:setMaximum(maximum)
end

self.value = math.max(math.min(value, self.maximum), self.minimum)
self:updateBackground()
end

function UIProgressBarSDInverted:setPercent(percent)
self:setValue(percent, 0, 100)
end

function UIProgressBarSDInverted:getPercent()
return self.value
end

function UIProgressBarSDInverted:getPercentPixels()
return (self.maximum - self.minimum) / self:getWidth()
end

function UIProgressBarSDInverted:getProgress()
if self.minimum == self.maximum then return 1 end
return (self.value - self.minimum) / (self.maximum - self.minimum)
end

function UIProgressBarSDInverted:updateBackground()
if self:isOn() then
local width = math.round(math.max((self:getProgress() * (self:getWidth() - self.bgBorderLeft - self.bgBorderRight)), 1))
local height = self:getHeight() - self.bgBorderTop - self.bgBorderBottom
local rect = { x = self:getWidth() - (self:getProgress() * self:getWidth()), y = self.bgBorderTop, width = width, height = height }
if width == 1 then
rect.x = rect.x - 1
end
self:setImageRect(rect)

if width == 1 then
self:setImageVisible(false)
else
self:setImageVisible(true)
end
end
end

function UIProgressBarSDInverted:onSetup()
self:updateBackground()
end

function UIProgressBarSDInverted:onStyleApply(name, node)
for name,value in pairs(node) do
if name == 'background-border-left' then
self.bgBorderLeft = tonumber(value)
elseif name == 'background-border-right' then
self.bgBorderRight = tonumber(value)
elseif name == 'background-border-top' then
self.bgBorderTop = tonumber(value)
elseif name == 'background-border-bottom' then
self.bgBorderBottom = tonumber(value)
elseif name == 'background-border' then
self.bgBorderLeft = tonumber(value)
self.bgBorderRight = tonumber(value)
self.bgBorderTop = tonumber(value)
self.bgBorderBottom = tonumber(value)
end
end
end

function UIProgressBarSDInverted:onGeometryChange(oldRect, newRect)
if not self:isOn() then
self:setHeight(0)
end
self:updateBackground()
end
Loading
Loading