@rpg-engine/long-bow 0.6.53 → 0.6.54
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/components/SkillProgressBar.d.ts +0 -1
- package/dist/long-bow.cjs.development.js +7 -12
- 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 +8 -13
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/SkillProgressBar.tsx +14 -14
- package/src/components/SkillsContainer.tsx +1 -12
- package/src/mocks/skills.mocks.ts +14 -14
package/package.json
CHANGED
|
@@ -11,7 +11,6 @@ export interface ISkillProgressBarProps {
|
|
|
11
11
|
bgColor: string;
|
|
12
12
|
level: number;
|
|
13
13
|
skillPoints: number;
|
|
14
|
-
skillPointsToNextLevel?: number;
|
|
15
14
|
texturePath: string;
|
|
16
15
|
showSkillPoints?: boolean;
|
|
17
16
|
atlasJSON: any;
|
|
@@ -24,7 +23,6 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
|
24
23
|
skillName,
|
|
25
24
|
level,
|
|
26
25
|
skillPoints: currentSkillPoints,
|
|
27
|
-
skillPointsToNextLevel,
|
|
28
26
|
texturePath,
|
|
29
27
|
showSkillPoints = true,
|
|
30
28
|
atlasIMG,
|
|
@@ -32,23 +30,27 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
|
32
30
|
buffAndDebuff,
|
|
33
31
|
}) => {
|
|
34
32
|
// Base skill points for the previous level (0 for level 1)
|
|
35
|
-
const baseSkillPointsPrevLevel = getSPForLevel(level);
|
|
33
|
+
const baseSkillPointsPrevLevel = level > 1 ? getSPForLevel(level - 1) : 0;
|
|
34
|
+
|
|
35
|
+
// Total skill points needed for the next level
|
|
36
|
+
const nextLevelSkillPoints = getSPForLevel(level + 1);
|
|
36
37
|
|
|
37
38
|
// Calculate excess skill points above the previous level
|
|
38
|
-
const excessSkillPoints =
|
|
39
|
+
const excessSkillPoints = Math.max(
|
|
40
|
+
currentSkillPoints - baseSkillPointsPrevLevel,
|
|
41
|
+
0
|
|
42
|
+
);
|
|
39
43
|
|
|
40
44
|
// Calculate progress percentage towards the next level
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
const progress = Math.min(
|
|
46
|
+
100,
|
|
47
|
+
Math.max(0, (excessSkillPoints / nextLevelSkillPoints) * 100)
|
|
48
|
+
);
|
|
43
49
|
|
|
44
50
|
const skillsBuffsCalc = (level: number, buffAndDebuff: number): string => {
|
|
45
51
|
const result = level * (buffAndDebuff / 100);
|
|
46
52
|
|
|
47
|
-
|
|
48
|
-
return `+${result.toFixed(2)}`;
|
|
49
|
-
} else {
|
|
50
|
-
return `${result.toFixed(2)}`;
|
|
51
|
-
}
|
|
53
|
+
return result > 0 ? `+${result.toFixed(2)}` : `${result.toFixed(2)}`;
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
return (
|
|
@@ -119,9 +121,7 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
|
119
121
|
</ProgressBody>
|
|
120
122
|
{showSkillPoints && (
|
|
121
123
|
<SkillDisplayContainer>
|
|
122
|
-
<SkillPointsDisplay>
|
|
123
|
-
{currentSkillPoints}/{skillPointsToNextLevel}
|
|
124
|
-
</SkillPointsDisplay>
|
|
124
|
+
<SkillPointsDisplay>{progress.toFixed(2)}%</SkillPointsDisplay>
|
|
125
125
|
</SkillDisplayContainer>
|
|
126
126
|
)}
|
|
127
127
|
</>
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ISkill,
|
|
3
|
-
ISkillDetails,
|
|
4
|
-
getSPForLevel,
|
|
5
|
-
getXPForLevel,
|
|
6
|
-
} from '@rpg-engine/shared';
|
|
1
|
+
import { ISkill, ISkillDetails } from '@rpg-engine/shared';
|
|
7
2
|
import React from 'react';
|
|
8
3
|
import styled from 'styled-components';
|
|
9
4
|
import { uiColors } from '../constants/uiColors';
|
|
@@ -117,9 +112,6 @@ export const SkillsContainer: React.FC<ISkillContainerProps> = ({
|
|
|
117
112
|
bgColor={skillCategoryColor}
|
|
118
113
|
level={skillDetails.level || 0}
|
|
119
114
|
skillPoints={Math.round(skillDetails.skillPoints) || 0}
|
|
120
|
-
skillPointsToNextLevel={
|
|
121
|
-
Math.round(getSPForLevel(skillDetails.level + 1)) || 0
|
|
122
|
-
}
|
|
123
115
|
texturePath={value}
|
|
124
116
|
atlasIMG={atlasIMG}
|
|
125
117
|
atlasJSON={atlasJSON}
|
|
@@ -151,9 +143,6 @@ export const SkillsContainer: React.FC<ISkillContainerProps> = ({
|
|
|
151
143
|
bgColor={uiColors.navyBlue}
|
|
152
144
|
level={Math.round(skill.level) || 0}
|
|
153
145
|
skillPoints={Math.round(skill.experience) || 0}
|
|
154
|
-
skillPointsToNextLevel={
|
|
155
|
-
Math.round(getXPForLevel(skill.level + 1)) || 0
|
|
156
|
-
}
|
|
157
146
|
texturePath={'swords/broad-sword.png'}
|
|
158
147
|
atlasIMG={atlasIMG}
|
|
159
148
|
atlasJSON={atlasJSON}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ISkill, SkillType, getSPForLevel } from '@rpg-engine/shared';
|
|
2
2
|
|
|
3
|
-
for (let level =
|
|
3
|
+
for (let level = 60; level <= 70; level++) {
|
|
4
4
|
console.log(`SP for level ${level}: ${getSPForLevel(level)}`);
|
|
5
5
|
}
|
|
6
6
|
|
|
@@ -47,7 +47,7 @@ export const skillMock = {
|
|
|
47
47
|
first: {
|
|
48
48
|
type: SkillType.Combat,
|
|
49
49
|
level: 1,
|
|
50
|
-
skillPoints:
|
|
50
|
+
skillPoints: 22,
|
|
51
51
|
skillPointsToNextLevel: getSPForLevel(2),
|
|
52
52
|
},
|
|
53
53
|
club: {
|
|
@@ -64,27 +64,27 @@ export const skillMock = {
|
|
|
64
64
|
},
|
|
65
65
|
dagger: {
|
|
66
66
|
type: SkillType.Combat,
|
|
67
|
-
level:
|
|
68
|
-
skillPoints:
|
|
69
|
-
skillPointsToNextLevel:
|
|
67
|
+
level: 4,
|
|
68
|
+
skillPoints: 300,
|
|
69
|
+
skillPointsToNextLevel: getSPForLevel(5),
|
|
70
70
|
},
|
|
71
71
|
axe: {
|
|
72
72
|
type: SkillType.Combat,
|
|
73
|
-
level:
|
|
74
|
-
skillPoints:
|
|
75
|
-
skillPointsToNextLevel:
|
|
73
|
+
level: 5,
|
|
74
|
+
skillPoints: 400,
|
|
75
|
+
skillPointsToNextLevel: getSPForLevel(6),
|
|
76
76
|
},
|
|
77
77
|
distance: {
|
|
78
78
|
type: SkillType.Combat,
|
|
79
|
-
level:
|
|
80
|
-
skillPoints:
|
|
81
|
-
skillPointsToNextLevel:
|
|
79
|
+
level: 3,
|
|
80
|
+
skillPoints: 120,
|
|
81
|
+
skillPointsToNextLevel: getSPForLevel(4),
|
|
82
82
|
},
|
|
83
83
|
shielding: {
|
|
84
84
|
type: SkillType.Combat,
|
|
85
|
-
level:
|
|
86
|
-
skillPoints:
|
|
87
|
-
skillPointsToNextLevel:
|
|
85
|
+
level: 3,
|
|
86
|
+
skillPoints: 120,
|
|
87
|
+
skillPointsToNextLevel: getSPForLevel(4),
|
|
88
88
|
},
|
|
89
89
|
fishing: {
|
|
90
90
|
type: SkillType.Gathering,
|