@rpg-engine/long-bow 0.8.82 → 0.8.83
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 +35 -16
- 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 +36 -17
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/SkillProgressBar.tsx +43 -24
- package/src/stories/Character/skills/SkillsContainer.stories.tsx +3 -0
package/dist/long-bow.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import React, { useState, useEffect, Component, useRef, useCallback, useContext,
|
|
|
2
2
|
import styled, { css, keyframes, createGlobalStyle } from 'styled-components';
|
|
3
3
|
import { BeatLoader } from 'react-spinners';
|
|
4
4
|
import { v4 } from 'uuid';
|
|
5
|
-
import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemQualityLevel, ItemRarities, ItemSubType, isMobile, TaskType, TaskStatus, isMobileOrTablet, RewardType, ItemSlotType, NPCSubtype, EntityAttackType, NPCAlignment, VideoGuideCategory, VideoGuideLanguage, CharacterClass, QuestStatus, getSkillConstants,
|
|
5
|
+
import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemQualityLevel, ItemRarities, ItemSubType, isMobile, TaskType, TaskStatus, isMobileOrTablet, RewardType, ItemSlotType, NPCSubtype, EntityAttackType, NPCAlignment, VideoGuideCategory, VideoGuideLanguage, CharacterClass, QuestStatus, getSkillConstants, getLevelFromSP, getSPForLevel, getSPForLevelExponential, getXPForLevel, MetadataType, PurchaseType, UserAccountTypes, PaymentCurrency, PeriodOfDay } from '@rpg-engine/shared';
|
|
6
6
|
import dayjs from 'dayjs';
|
|
7
7
|
import { ErrorBoundary as ErrorBoundary$1 } from 'react-error-boundary';
|
|
8
8
|
import { FaTimes, FaDiscord, FaWhatsapp, FaSearch, FaThumbtack, FaBoxOpen, FaChevronLeft, FaChevronRight, FaClipboardList, FaChevronUp, FaChevronDown, FaReddit, FaTrash, FaShoppingBag, FaInfoCircle, FaCartPlus, FaArrowLeft, FaHistory, FaShoppingCart } from 'react-icons/fa';
|
|
@@ -36513,29 +36513,48 @@ var SkillProgressBar = function SkillProgressBar(_ref) {
|
|
|
36513
36513
|
characterClass = _ref.characterClass,
|
|
36514
36514
|
level = _ref.level,
|
|
36515
36515
|
currentSkillPoints = _ref.skillPoints,
|
|
36516
|
-
skillPointsToNextLevel = _ref.skillPointsToNextLevel,
|
|
36517
36516
|
texturePath = _ref.texturePath,
|
|
36518
36517
|
_ref$showSkillPoints = _ref.showSkillPoints,
|
|
36519
36518
|
showSkillPoints = _ref$showSkillPoints === void 0 ? true : _ref$showSkillPoints,
|
|
36520
36519
|
atlasIMG = _ref.atlasIMG,
|
|
36521
36520
|
atlasJSON = _ref.atlasJSON,
|
|
36522
36521
|
buffAndDebuff = _ref.buffAndDebuff;
|
|
36523
|
-
//
|
|
36524
|
-
var
|
|
36525
|
-
|
|
36526
|
-
|
|
36527
|
-
|
|
36528
|
-
|
|
36529
|
-
c = _getSkillConstants.c;
|
|
36530
|
-
return getSPForLevelExponential(level, A, b, c);
|
|
36522
|
+
// Use CharacterClass.None as default if skillKey is provided but characterClass is not
|
|
36523
|
+
var effectiveClass = characterClass != null ? characterClass : CharacterClass.None;
|
|
36524
|
+
// Calculate the effective level based on actual SP (handles data inconsistencies)
|
|
36525
|
+
var calculateEffectiveLevel = function calculateEffectiveLevel() {
|
|
36526
|
+
if (!skillKey) {
|
|
36527
|
+
return level; // Fallback to stored level for general "Level" display
|
|
36531
36528
|
}
|
|
36532
|
-
|
|
36533
|
-
|
|
36534
|
-
|
|
36529
|
+
var _getSkillConstants = getSkillConstants(skillKey, effectiveClass),
|
|
36530
|
+
A = _getSkillConstants.A,
|
|
36531
|
+
b = _getSkillConstants.b,
|
|
36532
|
+
c = _getSkillConstants.c;
|
|
36533
|
+
var actualLevel = Math.floor(getLevelFromSP(currentSkillPoints, A, b, c));
|
|
36534
|
+
return Math.max(c, actualLevel); // At least starting level
|
|
36535
|
+
};
|
|
36536
|
+
var effectiveLevel = calculateEffectiveLevel();
|
|
36537
|
+
// Calculate progress based on actual SP position
|
|
36535
36538
|
var calculateProgress = function calculateProgress() {
|
|
36536
|
-
|
|
36537
|
-
|
|
36538
|
-
|
|
36539
|
+
if (!skillKey) {
|
|
36540
|
+
// Fallback for general "Level" display: simple ratio of current SP to next level
|
|
36541
|
+
var spForCurrentLevel = getSPForLevel(level);
|
|
36542
|
+
var _spForNextLevel = getSPForLevel(level + 1);
|
|
36543
|
+
var _range = _spForNextLevel - spForCurrentLevel;
|
|
36544
|
+
var _progress = currentSkillPoints - spForCurrentLevel;
|
|
36545
|
+
return Math.min(100, Math.max(0, _progress / _range * 100));
|
|
36546
|
+
}
|
|
36547
|
+
var _getSkillConstants2 = getSkillConstants(skillKey, effectiveClass),
|
|
36548
|
+
A = _getSkillConstants2.A,
|
|
36549
|
+
b = _getSkillConstants2.b,
|
|
36550
|
+
c = _getSkillConstants2.c;
|
|
36551
|
+
// Calculate SP thresholds for current effective level
|
|
36552
|
+
var spForEffectiveLevel = getSPForLevelExponential(effectiveLevel, A, b, c);
|
|
36553
|
+
var spForNextLevel = getSPForLevelExponential(effectiveLevel + 1, A, b, c);
|
|
36554
|
+
// Progress within current effective level
|
|
36555
|
+
var range = spForNextLevel - spForEffectiveLevel;
|
|
36556
|
+
var progressInLevel = currentSkillPoints - spForEffectiveLevel;
|
|
36557
|
+
return Math.min(100, Math.max(0, progressInLevel / Math.max(1, range) * 100));
|
|
36539
36558
|
};
|
|
36540
36559
|
var progress = calculateProgress();
|
|
36541
36560
|
var formatBuffAndDebuff = function formatBuffAndDebuff(value) {
|
|
@@ -36546,7 +36565,7 @@ var SkillProgressBar = function SkillProgressBar(_ref) {
|
|
|
36546
36565
|
var result = level * (buffAndDebuff / 100);
|
|
36547
36566
|
return result > 0 ? "+" + result.toFixed(2) : "" + result.toFixed(2);
|
|
36548
36567
|
};
|
|
36549
|
-
return React.createElement(React.Fragment, null, React.createElement(ProgressTitle, null, buffAndDebuff !== undefined && React.createElement(React.Fragment, null, buffAndDebuff > 0 ? React.createElement(BuffAndDebuffContainer, null, React.createElement(TitleNameContainer, null, React.createElement(TitleNameBuff, null, skillName), React.createElement(TitleNameBuff, null, "lv ",
|
|
36568
|
+
return React.createElement(React.Fragment, null, React.createElement(ProgressTitle, null, buffAndDebuff !== undefined && React.createElement(React.Fragment, null, buffAndDebuff > 0 ? React.createElement(BuffAndDebuffContainer, null, React.createElement(TitleNameContainer, null, React.createElement(TitleNameBuff, null, skillName), React.createElement(TitleNameBuff, null, "lv ", effectiveLevel, " (", skillsBuffsCalc(effectiveLevel, buffAndDebuff), ")")), React.createElement(TitleNameBuffContainer, null, React.createElement(TitleNameBuff, null, "(+", formatBuffAndDebuff(buffAndDebuff), "%)"))) : buffAndDebuff < 0 ? React.createElement(React.Fragment, null, React.createElement(TitleNameContainer, null, React.createElement(TitleNameDebuff, null, skillName), React.createElement(TitleNameDebuff, null, "lv ", effectiveLevel, " (", skillsBuffsCalc(effectiveLevel, buffAndDebuff), ")")), React.createElement("div", null, React.createElement(TitleNameDebuff, null, "(", formatBuffAndDebuff(buffAndDebuff), "%)"))) : React.createElement(TitleName, null, skillName)), !buffAndDebuff && React.createElement(TitleNameContainer, null, React.createElement(TitleName, null, skillName), React.createElement(ValueDisplay, null, "lv ", effectiveLevel))), React.createElement(ProgressBody, null, React.createElement(ProgressIconContainer, null, atlasIMG && atlasJSON ? React.createElement(SpriteContainer$4, null, React.createElement(ErrorBoundary, null, React.createElement(SpriteFromAtlas, {
|
|
36550
36569
|
atlasIMG: atlasIMG,
|
|
36551
36570
|
atlasJSON: atlasJSON,
|
|
36552
36571
|
spriteKey: texturePath,
|