@rpg-engine/long-bow 0.8.83 → 0.8.85
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 +17 -13
- 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 +17 -13
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/ProgressBar.tsx +2 -1
- package/src/components/SimpleProgressBar.tsx +2 -2
- package/src/components/SkillProgressBar.tsx +14 -10
- package/src/mocks/skills.mocks.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpg-engine/long-bow",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.85",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@capacitor/core": "^6.1.0",
|
|
86
86
|
"@rollup/plugin-image": "^2.1.1",
|
|
87
|
-
"@rpg-engine/shared": "^0.10.
|
|
87
|
+
"@rpg-engine/shared": "^0.10.33",
|
|
88
88
|
"dayjs": "^1.11.2",
|
|
89
89
|
"font-awesome": "^4.7.0",
|
|
90
90
|
"fs-extra": "^10.1.0",
|
|
@@ -12,8 +12,8 @@ export const SimpleProgressBar: React.FC<ISimpleProgressBarProps> = ({
|
|
|
12
12
|
bgColor = 'red',
|
|
13
13
|
margin = 20,
|
|
14
14
|
}) => {
|
|
15
|
-
// Ensure the width is at least 1% if value is greater than 0
|
|
16
|
-
const width = value > 0 ? Math.max(1, Math.min(
|
|
15
|
+
// Ensure the width is at least 1% if value is greater than 0, capped at 99.99%
|
|
16
|
+
const width = value > 0 ? Math.max(1, Math.min(99.99, value)) : 0;
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
19
|
<Container className="simple-progress-bar">
|
|
@@ -54,7 +54,7 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
|
54
54
|
|
|
55
55
|
const { A, b, c } = getSkillConstants(skillKey, effectiveClass);
|
|
56
56
|
const actualLevel = Math.floor(getLevelFromSP(currentSkillPoints, A, b, c));
|
|
57
|
-
return Math.max(
|
|
57
|
+
return Math.max(1, actualLevel); // Minimum level is always 1 in our system
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
const effectiveLevel = calculateEffectiveLevel();
|
|
@@ -67,20 +67,24 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
|
67
67
|
const spForNextLevel = getSPForLevel(level + 1);
|
|
68
68
|
const range = spForNextLevel - spForCurrentLevel;
|
|
69
69
|
const progress = currentSkillPoints - spForCurrentLevel;
|
|
70
|
-
return Math.min(
|
|
70
|
+
return Math.min(99.99, Math.max(0, (progress / range) * 100));
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
const { A, b, c } = getSkillConstants(skillKey, effectiveClass);
|
|
74
74
|
|
|
75
|
-
//
|
|
76
|
-
const
|
|
77
|
-
const
|
|
75
|
+
// Get the actual calculated level (might be 0 for magic)
|
|
76
|
+
const actualLevel = Math.floor(getLevelFromSP(currentSkillPoints, A, b, c));
|
|
77
|
+
const calcLevel = Math.max(c, actualLevel); // Use c as minimum for calculation
|
|
78
|
+
|
|
79
|
+
// Calculate SP thresholds based on actual position
|
|
80
|
+
const spForCalcLevel = getSPForLevelExponential(calcLevel, A, b, c);
|
|
81
|
+
const spForNextLevel = getSPForLevelExponential(calcLevel + 1, A, b, c);
|
|
78
82
|
|
|
79
|
-
// Progress within current
|
|
80
|
-
const range = spForNextLevel -
|
|
81
|
-
const progressInLevel = currentSkillPoints -
|
|
83
|
+
// Progress within current level range
|
|
84
|
+
const range = spForNextLevel - spForCalcLevel;
|
|
85
|
+
const progressInLevel = currentSkillPoints - spForCalcLevel;
|
|
82
86
|
|
|
83
|
-
return Math.min(
|
|
87
|
+
return Math.min(99.99, Math.max(0, (progressInLevel / Math.max(1, range)) * 100));
|
|
84
88
|
};
|
|
85
89
|
|
|
86
90
|
const progress = calculateProgress();
|
|
@@ -162,7 +166,7 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
|
162
166
|
|
|
163
167
|
<ProgressBarWrapper>
|
|
164
168
|
<SimpleProgressBar value={progress} bgColor={bgColor} />
|
|
165
|
-
<Tooltip>SP: {currentSkillPoints}</Tooltip>
|
|
169
|
+
<Tooltip>{skillKey ? 'SP' : 'XP'}: {currentSkillPoints}</Tooltip>
|
|
166
170
|
</ProgressBarWrapper>
|
|
167
171
|
</ProgressBody>
|
|
168
172
|
{showSkillPoints && (
|