@rpg-engine/long-bow 0.8.91 → 0.8.92

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.8.91",
3
+ "version": "0.8.92",
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.39",
87
+ "@rpg-engine/shared": "^0.10.40",
88
88
  "dayjs": "^1.11.2",
89
89
  "font-awesome": "^4.7.0",
90
90
  "fs-extra": "^10.1.0",
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  CharacterClass,
3
3
  getLevelFromSP,
4
- getSPForLevel,
5
4
  getSPForLevelExponential,
6
5
  getSkillConstants,
7
6
  } from '@rpg-engine/shared';
@@ -61,28 +60,22 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
61
60
 
62
61
  // Calculate progress based on actual SP position
63
62
  const calculateProgress = (): number => {
64
- if (!skillKey) {
65
- // Fallback for general "Level" display: simple ratio of current SP to next level
66
- const spForCurrentLevel = getSPForLevel(level);
67
- const spForNextLevel = getSPForLevel(level + 1);
68
- const range = spForNextLevel - spForCurrentLevel;
69
- const progress = currentSkillPoints - spForCurrentLevel;
70
- return Math.min(99.99, Math.max(0, (progress / range) * 100));
71
- }
72
-
73
- const { A, b, c } = getSkillConstants(skillKey, effectiveClass);
63
+ // Use exponential formula for all skill progress calculations
64
+ // For character XP (when skillKey is not provided), use default constants
65
+ const skillName = skillKey ?? 'level';
66
+ const { A, b, c } = getSkillConstants(skillName, effectiveClass);
74
67
 
75
68
  // Get the actual calculated level (might be 0 for magic)
76
69
  const actualLevel = Math.floor(getLevelFromSP(currentSkillPoints, A, b, c));
77
70
  const calcLevel = Math.max(c, actualLevel); // Use c as minimum for calculation
78
71
 
79
72
  // Calculate SP thresholds based on actual position
80
- const spForCalcLevel = getSPForLevelExponential(calcLevel, A, b, c);
81
- const spForNextLevel = getSPForLevelExponential(calcLevel + 1, A, b, c);
73
+ const currentLevelSP = getSPForLevelExponential(calcLevel, A, b, c);
74
+ const nextLevelSP = getSPForLevelExponential(calcLevel + 1, A, b, c);
82
75
 
83
- // Progress within current level range
84
- const range = spForNextLevel - spForCalcLevel;
85
- const progressInLevel = currentSkillPoints - spForCalcLevel;
76
+ // Progress within current level range: (currentSP - currentLevelSP) / (nextLevelSP - currentLevelSP)
77
+ const range = nextLevelSP - currentLevelSP;
78
+ const progressInLevel = currentSkillPoints - currentLevelSP;
86
79
 
87
80
  return Math.min(99.99, Math.max(0, (progressInLevel / Math.max(1, range)) * 100));
88
81
  };