@rpg-engine/long-bow 0.6.58 → 0.6.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/long-bow.cjs.development.js +12 -11
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +12 -11
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/SimpleProgressBar.tsx +13 -9
- package/src/components/SkillProgressBar.tsx +15 -15
- package/src/mocks/skills.mocks.ts +6 -6
- package/src/stories/SimpleProgressBar.stories.tsx +3 -1
|
@@ -32094,12 +32094,14 @@ var SimpleProgressBar = function SimpleProgressBar(_ref) {
|
|
|
32094
32094
|
bgColor = _ref$bgColor === void 0 ? 'red' : _ref$bgColor,
|
|
32095
32095
|
_ref$margin = _ref.margin,
|
|
32096
32096
|
margin = _ref$margin === void 0 ? 20 : _ref$margin;
|
|
32097
|
+
// Ensure the width is at least 1% if value is greater than 0
|
|
32098
|
+
var width = value > 0 ? Math.max(1, Math.min(100, value)) : 0;
|
|
32097
32099
|
return React__default.createElement(Container$r, {
|
|
32098
32100
|
className: "simple-progress-bar"
|
|
32099
32101
|
}, React__default.createElement(ProgressBarContainer, {
|
|
32100
32102
|
margin: margin
|
|
32101
32103
|
}, React__default.createElement(BackgroundBar, null, React__default.createElement(Progress, {
|
|
32102
|
-
|
|
32104
|
+
width: width,
|
|
32103
32105
|
bgColor: bgColor
|
|
32104
32106
|
}))));
|
|
32105
32107
|
};
|
|
@@ -32114,10 +32116,10 @@ var BackgroundBar = /*#__PURE__*/styled__default.span.withConfig({
|
|
|
32114
32116
|
var Progress = /*#__PURE__*/styled__default.span.withConfig({
|
|
32115
32117
|
displayName: "SimpleProgressBar__Progress",
|
|
32116
32118
|
componentId: "sc-mbeil3-2"
|
|
32117
|
-
})(["background-color:", ";width:", "%;"], function (props) {
|
|
32119
|
+
})(["background-color:", ";width:", "%;transition:width 0.5s ease-in-out;"], function (props) {
|
|
32118
32120
|
return props.bgColor;
|
|
32119
32121
|
}, function (props) {
|
|
32120
|
-
return props.
|
|
32122
|
+
return props.width.toFixed(2);
|
|
32121
32123
|
});
|
|
32122
32124
|
var ProgressBarContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
32123
32125
|
displayName: "SimpleProgressBar__ProgressBarContainer",
|
|
@@ -32145,15 +32147,14 @@ var SkillProgressBar = function SkillProgressBar(_ref) {
|
|
|
32145
32147
|
buffAndDebuff = _ref.buffAndDebuff;
|
|
32146
32148
|
// Skill points needed to start the current level
|
|
32147
32149
|
var baseSkillPoints = shared.getSPForLevel(level);
|
|
32148
|
-
|
|
32149
|
-
|
|
32150
|
-
|
|
32151
|
-
|
|
32152
|
-
|
|
32153
|
-
var
|
|
32154
|
-
// Calculate progress percentage towards the next level
|
|
32155
|
-
var progress = Math.min(100, Math.max(0, excessSkillPoints / totalPointsForLevelUp * 100));
|
|
32150
|
+
var calculateProgress = function calculateProgress() {
|
|
32151
|
+
var totalPointsForLevelUp = Math.max(1, skillPointsToNextLevel - baseSkillPoints);
|
|
32152
|
+
var excessSkillPoints = Math.max(0, currentSkillPoints - baseSkillPoints);
|
|
32153
|
+
return Math.min(100, Math.max(0, excessSkillPoints / totalPointsForLevelUp * 100));
|
|
32154
|
+
};
|
|
32155
|
+
var progress = calculateProgress();
|
|
32156
32156
|
var skillsBuffsCalc = function skillsBuffsCalc(level, buffAndDebuff) {
|
|
32157
|
+
if (buffAndDebuff === 0) return '0';
|
|
32157
32158
|
var result = level * (buffAndDebuff / 100);
|
|
32158
32159
|
return result > 0 ? "+" + result.toFixed(2) : "" + result.toFixed(2);
|
|
32159
32160
|
};
|