@rpg-engine/long-bow 0.8.79 → 0.8.81
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 +1 -0
- package/dist/components/SkillsContainer.d.ts +2 -1
- package/dist/long-bow.cjs.development.js +15 -3
- 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 +16 -4
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/SkillProgressBar.tsx +4 -3
- package/src/components/SkillsContainer.tsx +22 -4
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.81",
|
|
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": "
|
|
87
|
+
"@rpg-engine/shared": "0.10.32",
|
|
88
88
|
"dayjs": "^1.11.2",
|
|
89
89
|
"font-awesome": "^4.7.0",
|
|
90
90
|
"fs-extra": "^10.1.0",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getSPForLevel } from '@rpg-engine/shared';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import styled from 'styled-components';
|
|
4
3
|
import { uiColors } from '../constants/uiColors';
|
|
@@ -15,6 +14,7 @@ export interface ISkillProgressBarProps {
|
|
|
15
14
|
texturePath: string;
|
|
16
15
|
showSkillPoints?: boolean;
|
|
17
16
|
skillPointsToNextLevel: number;
|
|
17
|
+
skillPointsForCurrentLevel: number;
|
|
18
18
|
atlasJSON: any;
|
|
19
19
|
atlasIMG: any;
|
|
20
20
|
buffAndDebuff?: number;
|
|
@@ -26,6 +26,7 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
|
26
26
|
level,
|
|
27
27
|
skillPoints: currentSkillPoints,
|
|
28
28
|
skillPointsToNextLevel,
|
|
29
|
+
skillPointsForCurrentLevel,
|
|
29
30
|
texturePath,
|
|
30
31
|
showSkillPoints = true,
|
|
31
32
|
atlasIMG,
|
|
@@ -33,8 +34,8 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
|
33
34
|
|
|
34
35
|
buffAndDebuff,
|
|
35
36
|
}) => {
|
|
36
|
-
// Skill points needed to start the current level
|
|
37
|
-
const baseSkillPoints =
|
|
37
|
+
// Skill points needed to start the current level (passed from parent, calculated with correct formula)
|
|
38
|
+
const baseSkillPoints = skillPointsForCurrentLevel;
|
|
38
39
|
const calculateProgress = (): number => {
|
|
39
40
|
const totalPointsForLevelUp = Math.max(
|
|
40
41
|
1,
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
CharacterClass,
|
|
3
|
+
ISkill,
|
|
4
|
+
ISkillDetails,
|
|
5
|
+
getSPForLevelExponential,
|
|
6
|
+
getSkillConstants,
|
|
7
|
+
getXPForLevel,
|
|
8
|
+
} from '@rpg-engine/shared';
|
|
2
9
|
import React from 'react';
|
|
3
10
|
import styled from 'styled-components';
|
|
4
11
|
import { uiColors } from '../constants/uiColors';
|
|
@@ -7,6 +14,7 @@ import { SkillProgressBar } from './SkillProgressBar';
|
|
|
7
14
|
|
|
8
15
|
export interface ISkillContainerProps {
|
|
9
16
|
skill: ISkill;
|
|
17
|
+
characterClass: CharacterClass;
|
|
10
18
|
onCloseButton: () => void;
|
|
11
19
|
atlasJSON: any;
|
|
12
20
|
atlasIMG: any;
|
|
@@ -81,6 +89,7 @@ const skillNameMap: SkillMap = {
|
|
|
81
89
|
export const SkillsContainer: React.FC<ISkillContainerProps> = ({
|
|
82
90
|
onCloseButton,
|
|
83
91
|
skill,
|
|
92
|
+
characterClass,
|
|
84
93
|
atlasIMG,
|
|
85
94
|
atlasJSON,
|
|
86
95
|
scale,
|
|
@@ -105,6 +114,13 @@ export const SkillsContainer: React.FC<ISkillContainerProps> = ({
|
|
|
105
114
|
continue;
|
|
106
115
|
}
|
|
107
116
|
|
|
117
|
+
// Get the skill constants for this skill and character class
|
|
118
|
+
const { A, b, c } = getSkillConstants(key, characterClass);
|
|
119
|
+
|
|
120
|
+
// Calculate SP thresholds using exponential formula
|
|
121
|
+
const skillPointsForCurrentLevel = getSPForLevelExponential(skillDetails.level, A, b, c);
|
|
122
|
+
const skillPointsToNextLevel = getSPForLevelExponential(skillDetails.level + 1, A, b, c);
|
|
123
|
+
|
|
108
124
|
output.push(
|
|
109
125
|
<SkillProgressBar
|
|
110
126
|
key={key}
|
|
@@ -112,9 +128,8 @@ export const SkillsContainer: React.FC<ISkillContainerProps> = ({
|
|
|
112
128
|
bgColor={skillCategoryColor}
|
|
113
129
|
level={skillDetails.level || 0}
|
|
114
130
|
skillPoints={Math.round(skillDetails.skillPoints) || 0}
|
|
115
|
-
skillPointsToNextLevel={
|
|
116
|
-
|
|
117
|
-
}
|
|
131
|
+
skillPointsToNextLevel={skillPointsToNextLevel}
|
|
132
|
+
skillPointsForCurrentLevel={skillPointsForCurrentLevel}
|
|
118
133
|
texturePath={value}
|
|
119
134
|
atlasIMG={atlasIMG}
|
|
120
135
|
atlasJSON={atlasJSON}
|
|
@@ -149,6 +164,9 @@ export const SkillsContainer: React.FC<ISkillContainerProps> = ({
|
|
|
149
164
|
skillPointsToNextLevel={
|
|
150
165
|
Math.round(getXPForLevel(skill.level + 1)) || 0
|
|
151
166
|
}
|
|
167
|
+
skillPointsForCurrentLevel={
|
|
168
|
+
Math.round(getXPForLevel(skill.level)) || 0
|
|
169
|
+
}
|
|
152
170
|
texturePath={'swords/broad-sword.png'}
|
|
153
171
|
atlasIMG={atlasIMG}
|
|
154
172
|
atlasJSON={atlasJSON}
|