@rpg-engine/long-bow 0.8.91 → 0.8.93

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.
@@ -5,6 +5,7 @@ export interface ISpellProps {
5
5
  atlasIMG: any;
6
6
  charMana: number;
7
7
  charMagicLevel: number;
8
+ charSkillLevels?: Record<string, number>;
8
9
  onPointerUp?: (spellKey: string) => void;
9
10
  isSettingShortcut?: boolean;
10
11
  spellKey: string;
@@ -7,6 +7,7 @@ export interface ISpellbookProps {
7
7
  spells: ISpell[];
8
8
  magicLevel: number;
9
9
  mana: number;
10
+ charSkillLevels?: Record<string, number>;
10
11
  onSpellClick: (spellKey: string) => void;
11
12
  setSpellShortcut: (key: string, index: number) => void;
12
13
  shortcuts: IShortcut[];
@@ -36557,15 +36557,10 @@ var SkillProgressBar = function SkillProgressBar(_ref) {
36557
36557
  var effectiveLevel = calculateEffectiveLevel();
36558
36558
  // Calculate progress based on actual SP position
36559
36559
  var calculateProgress = function calculateProgress() {
36560
- if (!skillKey) {
36561
- // Fallback for general "Level" display: simple ratio of current SP to next level
36562
- var spForCurrentLevel = shared.getSPForLevel(level);
36563
- var _spForNextLevel = shared.getSPForLevel(level + 1);
36564
- var _range = _spForNextLevel - spForCurrentLevel;
36565
- var _progress = currentSkillPoints - spForCurrentLevel;
36566
- return Math.min(99.99, Math.max(0, _progress / _range * 100));
36567
- }
36568
- var _getSkillConstants2 = shared.getSkillConstants(skillKey, effectiveClass),
36560
+ // Use exponential formula for all skill progress calculations
36561
+ // For character XP (when skillKey is not provided), use default constants
36562
+ var skillName = skillKey != null ? skillKey : 'level';
36563
+ var _getSkillConstants2 = shared.getSkillConstants(skillName, effectiveClass),
36569
36564
  A = _getSkillConstants2.A,
36570
36565
  b = _getSkillConstants2.b,
36571
36566
  c = _getSkillConstants2.c;
@@ -36573,11 +36568,11 @@ var SkillProgressBar = function SkillProgressBar(_ref) {
36573
36568
  var actualLevel = Math.floor(shared.getLevelFromSP(currentSkillPoints, A, b, c));
36574
36569
  var calcLevel = Math.max(c, actualLevel); // Use c as minimum for calculation
36575
36570
  // Calculate SP thresholds based on actual position
36576
- var spForCalcLevel = shared.getSPForLevelExponential(calcLevel, A, b, c);
36577
- var spForNextLevel = shared.getSPForLevelExponential(calcLevel + 1, A, b, c);
36578
- // Progress within current level range
36579
- var range = spForNextLevel - spForCalcLevel;
36580
- var progressInLevel = currentSkillPoints - spForCalcLevel;
36571
+ var currentLevelSP = shared.getSPForLevelExponential(calcLevel, A, b, c);
36572
+ var nextLevelSP = shared.getSPForLevelExponential(calcLevel + 1, A, b, c);
36573
+ // Progress within current level range: (currentSP - currentLevelSP) / (nextLevelSP - currentLevelSP)
36574
+ var range = nextLevelSP - currentLevelSP;
36575
+ var progressInLevel = currentSkillPoints - currentLevelSP;
36581
36576
  return Math.min(99.99, Math.max(0, progressInLevel / Math.max(1, range) * 100));
36582
36577
  };
36583
36578
  var progress = calculateProgress();
@@ -37150,6 +37145,20 @@ var SpellInfoWrapper = function SpellInfoWrapper(_ref) {
37150
37145
  }));
37151
37146
  };
37152
37147
 
37148
+ var SKILL_NAMES = {
37149
+ magicLevel: 'magic level',
37150
+ distanceFighting: 'distance fighting',
37151
+ swordFighting: 'sword fighting',
37152
+ axeFighting: 'axe fighting',
37153
+ clubFighting: 'club fighting',
37154
+ shielding: 'shielding',
37155
+ fishing: 'fishing',
37156
+ cooking: 'cooking',
37157
+ firstAid: 'first aid'
37158
+ };
37159
+ var getSkillName = function getSkillName(attribute) {
37160
+ return SKILL_NAMES[attribute] || attribute;
37161
+ };
37153
37162
  var Spell = function Spell(_ref) {
37154
37163
  var _spell$texturePath;
37155
37164
  var atlasIMG = _ref.atlasIMG,
@@ -37157,16 +37166,31 @@ var Spell = function Spell(_ref) {
37157
37166
  spellKey = _ref.spellKey,
37158
37167
  charMana = _ref.charMana,
37159
37168
  charMagicLevel = _ref.charMagicLevel,
37169
+ charSkillLevels = _ref.charSkillLevels,
37160
37170
  onPointerUp = _ref.onPointerUp,
37161
37171
  isSettingShortcut = _ref.isSettingShortcut,
37162
37172
  spell = _ref.spell,
37163
37173
  activeCooldown = _ref.activeCooldown;
37164
37174
  var manaCost = spell.manaCost,
37165
37175
  minMagicLevelRequired = spell.minMagicLevelRequired,
37176
+ minSkillLevelRequired = spell.minSkillLevelRequired,
37177
+ attribute = spell.attribute,
37166
37178
  magicWords = spell.magicWords,
37167
37179
  name = spell.name,
37168
37180
  description = spell.description;
37169
- var disabled = isSettingShortcut ? charMagicLevel < minMagicLevelRequired : manaCost > charMana || charMagicLevel < minMagicLevelRequired;
37181
+ var getRequiredLevel = function getRequiredLevel() {
37182
+ return minSkillLevelRequired != null ? minSkillLevelRequired : minMagicLevelRequired;
37183
+ };
37184
+ var getCharacterSkillLevel = function getCharacterSkillLevel() {
37185
+ if (attribute && charSkillLevels) {
37186
+ var _charSkillLevels$attr;
37187
+ return (_charSkillLevels$attr = charSkillLevels[attribute]) != null ? _charSkillLevels$attr : 0;
37188
+ }
37189
+ return charMagicLevel;
37190
+ };
37191
+ var requiredLevel = getRequiredLevel();
37192
+ var characterSkillLevel = getCharacterSkillLevel();
37193
+ var disabled = isSettingShortcut ? characterSkillLevel < requiredLevel : manaCost > charMana || characterSkillLevel < requiredLevel;
37170
37194
  var CONTAINER_STYLE = {
37171
37195
  width: '32px',
37172
37196
  height: '32px'
@@ -37178,7 +37202,7 @@ var Spell = function Spell(_ref) {
37178
37202
  onPointerUp: onPointerUp == null ? void 0 : onPointerUp.bind(null, spellKey),
37179
37203
  isSettingShortcut: isSettingShortcut && !disabled,
37180
37204
  className: "spell"
37181
- }, disabled && React__default.createElement(Overlay$3, null, charMagicLevel < minMagicLevelRequired ? 'Low magic level' : manaCost > charMana && 'No mana'), React__default.createElement(SpellImage, null, activeCooldown && activeCooldown > 0 ? React__default.createElement("span", {
37205
+ }, disabled && React__default.createElement(Overlay$3, null, characterSkillLevel < requiredLevel ? "Low " + getSkillName(attribute || 'magic level') + " level" : manaCost > charMana && 'No mana'), React__default.createElement(SpellImage, null, activeCooldown && activeCooldown > 0 ? React__default.createElement("span", {
37182
37206
  className: "cooldown"
37183
37207
  }, activeCooldown.toFixed(activeCooldown > 10 ? 0 : 1)) : null, React__default.createElement(SpriteFromAtlas, {
37184
37208
  atlasIMG: atlasIMG,
@@ -37236,6 +37260,7 @@ var Spellbook = function Spellbook(_ref) {
37236
37260
  spells = _ref.spells,
37237
37261
  magicLevel = _ref.magicLevel,
37238
37262
  mana = _ref.mana,
37263
+ charSkillLevels = _ref.charSkillLevels,
37239
37264
  onSpellClick = _ref.onSpellClick,
37240
37265
  setSpellShortcut = _ref.setSpellShortcut,
37241
37266
  shortcuts = _ref.shortcuts,
@@ -37296,6 +37321,7 @@ var Spellbook = function Spellbook(_ref) {
37296
37321
  atlasJSON: iconAtlasJSON,
37297
37322
  charMana: mana,
37298
37323
  charMagicLevel: magicLevel,
37324
+ charSkillLevels: charSkillLevels,
37299
37325
  onPointerUp: settingShortcutIndex !== -1 ? setShortcut : onSpellClick,
37300
37326
  spellKey: spell.key,
37301
37327
  isSettingShortcut: settingShortcutIndex !== -1,