@rpg-engine/long-bow 0.6.50 → 0.6.51
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 +11 -10
- 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 +11 -10
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/SkillProgressBar.tsx +26 -18
package/package.json
CHANGED
|
@@ -23,26 +23,36 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
|
23
23
|
bgColor,
|
|
24
24
|
skillName,
|
|
25
25
|
level,
|
|
26
|
-
skillPoints,
|
|
27
|
-
|
|
26
|
+
skillPoints: currentSkillPoints,
|
|
27
|
+
|
|
28
28
|
texturePath,
|
|
29
29
|
showSkillPoints = true,
|
|
30
30
|
atlasIMG,
|
|
31
31
|
atlasJSON,
|
|
32
32
|
buffAndDebuff,
|
|
33
33
|
}) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
// Base skill points for the previous level (0 for level 1)
|
|
35
|
+
const baseSkillPointsPrevLevel = level > 1 ? getSPForLevel(level - 1) : 0;
|
|
36
|
+
|
|
37
|
+
// Total skill points needed for the next level
|
|
38
|
+
const nextLevelSkillPoints = getSPForLevel(level + 1);
|
|
39
|
+
|
|
40
|
+
// Calculate excess skill points above the previous level
|
|
41
|
+
const excessSkillPoints = currentSkillPoints - baseSkillPointsPrevLevel;
|
|
42
|
+
|
|
43
|
+
// Calculate progress percentage towards the next level
|
|
44
|
+
const progress =
|
|
45
|
+
nextLevelSkillPoints > baseSkillPointsPrevLevel
|
|
46
|
+
? Math.max(
|
|
47
|
+
Math.min(
|
|
48
|
+
(excessSkillPoints /
|
|
49
|
+
(nextLevelSkillPoints - baseSkillPointsPrevLevel)) *
|
|
50
|
+
100,
|
|
51
|
+
100
|
|
52
|
+
),
|
|
53
|
+
0
|
|
54
|
+
)
|
|
55
|
+
: 0;
|
|
46
56
|
|
|
47
57
|
const skillsBuffsCalc = (level: number, buffAndDebuff: number): string => {
|
|
48
58
|
const result = level * (buffAndDebuff / 100);
|
|
@@ -117,14 +127,12 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
|
117
127
|
</ProgressIconContainer>
|
|
118
128
|
|
|
119
129
|
<ProgressBarContainer>
|
|
120
|
-
<SimpleProgressBar value={
|
|
130
|
+
<SimpleProgressBar value={progress} bgColor={bgColor} />
|
|
121
131
|
</ProgressBarContainer>
|
|
122
132
|
</ProgressBody>
|
|
123
133
|
{showSkillPoints && (
|
|
124
134
|
<SkillDisplayContainer>
|
|
125
|
-
<SkillPointsDisplay>
|
|
126
|
-
{ratio.toFixed(2)}% ({skillPoints} SP)
|
|
127
|
-
</SkillPointsDisplay>
|
|
135
|
+
<SkillPointsDisplay>{progress.toFixed(2)}%</SkillPointsDisplay>
|
|
128
136
|
</SkillDisplayContainer>
|
|
129
137
|
)}
|
|
130
138
|
</>
|