bnstooltips 1.19.1 → 1.20.0
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/build/SkillTooltip/SkillTooltip.d.ts +1 -1
- package/build/SkillTooltip/SkillTooltip.types.d.ts +0 -2
- package/build/SkillTooltipWrapper/SkillTooltipWrapper.types.d.ts +0 -2
- package/build/Utilities/Helpers.d.ts +2 -1
- package/build/Utilities/ISkill.d.ts +10 -0
- package/build/index.es.js +69 -9
- package/build/index.es.js.map +1 -1
- package/build/index.js +69 -9
- package/build/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SkillTooltipProps } from "./SkillTooltip.types";
|
|
3
3
|
import "./SkillTooltip.scss";
|
|
4
|
-
declare function SkillTooltip({ data, debug, masteryPoints
|
|
4
|
+
declare function SkillTooltip({ data, debug, masteryPoints }: SkillTooltipProps): JSX.Element;
|
|
5
5
|
export default SkillTooltip;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Skill } from "./ISkill";
|
|
1
|
+
import { Skill, SkillArcaneInfo } from "./ISkill";
|
|
2
2
|
export declare function BuildIconPath(iconPath: string, iconIndex?: number): string;
|
|
3
3
|
export declare function IsNullOrEmpty(property?: string): boolean;
|
|
4
4
|
export declare function ReplaceIconsInHtmlString(htmlString: string): string;
|
|
@@ -13,3 +13,4 @@ export interface IBnsMoney {
|
|
|
13
13
|
Copper: number;
|
|
14
14
|
}
|
|
15
15
|
export declare function getMoneyObj(money: number): IBnsMoney | null;
|
|
16
|
+
export declare function GetSkillMasteryValue(points: number, arcaneInfo: SkillArcaneInfo): number;
|
|
@@ -23,6 +23,16 @@ export interface Skill {
|
|
|
23
23
|
};
|
|
24
24
|
RealCastCondition: RealCastCondition;
|
|
25
25
|
RealEffects: RealEffects;
|
|
26
|
+
ArcaneInfo: SkillArcaneInfo;
|
|
27
|
+
}
|
|
28
|
+
export interface SkillArcaneInfo {
|
|
29
|
+
IsCooldown: boolean;
|
|
30
|
+
DamageSections: {
|
|
31
|
+
[id: number]: number;
|
|
32
|
+
};
|
|
33
|
+
CooldownBreakpoints: {
|
|
34
|
+
[id: number]: number;
|
|
35
|
+
};
|
|
26
36
|
}
|
|
27
37
|
export interface RealEffects {
|
|
28
38
|
Effects: {
|
package/build/index.es.js
CHANGED
|
@@ -316,6 +316,63 @@ function getMoneyObj(money) {
|
|
|
316
316
|
Gold: gold,
|
|
317
317
|
Silver: silver
|
|
318
318
|
};
|
|
319
|
+
}
|
|
320
|
+
function GetSkillMasteryValue(points, arcaneInfo) {
|
|
321
|
+
if (points <= 0)
|
|
322
|
+
return 0;
|
|
323
|
+
return arcaneInfo.IsCooldown ? GetSkillMasteryCdValueForPoints(points, arcaneInfo.CooldownBreakpoints) : GetSkillMasteryValueForPoints(points, arcaneInfo.DamageSections);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Calculates the cooldown reduction value based on skill mastery points and defined breakpoints.
|
|
327
|
+
*
|
|
328
|
+
* @param mastery - The total skill mastery points.
|
|
329
|
+
* @param cooldownBreakpoints - An object mapping breakpoints to their corresponding cooldown reduction values.
|
|
330
|
+
* @returns The total cooldown reduction value.
|
|
331
|
+
*/
|
|
332
|
+
function GetSkillMasteryCdValueForPoints(mastery, cooldownBreakpoints) {
|
|
333
|
+
var value = 0; // Accumulator for the total cooldown reduction value
|
|
334
|
+
// Convert the object keys (breakpoints) to an array of numbers and sort them in ascending order
|
|
335
|
+
var sortedBreakpoints = Object.keys(cooldownBreakpoints)
|
|
336
|
+
.map(Number) // Convert string keys to numbers
|
|
337
|
+
.sort(function (a, b) { return a - b; }); // Sort breakpoints in ascending order
|
|
338
|
+
// Iterate over the sorted breakpoints
|
|
339
|
+
for (var _i = 0, sortedBreakpoints_1 = sortedBreakpoints; _i < sortedBreakpoints_1.length; _i++) {
|
|
340
|
+
var breakpoint = sortedBreakpoints_1[_i];
|
|
341
|
+
if (mastery >= breakpoint) {
|
|
342
|
+
// Add the cooldown reduction value for this breakpoint (converted from milliseconds to seconds)
|
|
343
|
+
value += cooldownBreakpoints[breakpoint] / 1000;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return value; // Return the total cooldown reduction value
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Calculates the total skill bonus based on mastery points and the given damage sections.
|
|
350
|
+
*
|
|
351
|
+
* @param mastery - The total mastery points.
|
|
352
|
+
* @param damageSections - An object defining breakpoints and corresponding multipliers.
|
|
353
|
+
* @returns The total bonus percentage.
|
|
354
|
+
*/
|
|
355
|
+
function GetSkillMasteryValueForPoints(mastery, damageSections) {
|
|
356
|
+
var bonus = 0; // Stores the accumulated bonus percentage
|
|
357
|
+
var previousLimit = 0; // Keeps track of the previous breakpoint
|
|
358
|
+
// Iterate over the damageSections object, sorted by its keys (breakpoints)
|
|
359
|
+
for (var _i = 0, _a = Object.entries(damageSections); _i < _a.length; _i++) {
|
|
360
|
+
var _b = _a[_i], limitStr = _b[0], multiplier = _b[1];
|
|
361
|
+
var limit = parseInt(limitStr, 10); // Convert the key (string) to a number
|
|
362
|
+
if (mastery > previousLimit) {
|
|
363
|
+
// Calculate how many points fall within this range
|
|
364
|
+
var pointsInRange = Math.min(mastery - previousLimit, limit - previousLimit);
|
|
365
|
+
// Multiply points by the corresponding multiplier (converted to percentage)
|
|
366
|
+
bonus += pointsInRange * (multiplier / 10);
|
|
367
|
+
}
|
|
368
|
+
// Update the previous limit for the next iteration
|
|
369
|
+
previousLimit = limit;
|
|
370
|
+
// Stop iterating if mastery has been fully allocated
|
|
371
|
+
if (mastery <= limit) {
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return bonus;
|
|
319
376
|
}
|
|
320
377
|
|
|
321
378
|
//----------------------
|
|
@@ -8672,7 +8729,7 @@ function JsonArrayToJsxArray(stringArray) {
|
|
|
8672
8729
|
return jsxArray;
|
|
8673
8730
|
}
|
|
8674
8731
|
|
|
8675
|
-
var css_248z$6 = ".TooltipBase_bns_upgradeRed_color {\n color: #FF2818;\n}\n\n.TooltipBase_bns_downgradeBlue_color {\n color: #28A9F0;\n}\n\n.SkillTooltip_skillIconContainer {\n width: 60px;\n height: 60px;\n padding: 0;\n float: left;\n position: relative;\n}\n.SkillTooltip_skillIcon {\n width: 60px;\n height: 60px;\n position: relative;\n}\n.SkillTooltip_skillIconCanvas {\n width: 60px;\n height: 60px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n filter: blur(30px);\n opacity: 0.5;\n}\n.SkillTooltip_buttonIcon {\n position: absolute;\n right: 1px;\n bottom: 1px;\n height: 18px;\n opacity: 0.9;\n}\n.SkillTooltip_buttonIconMouse {\n background-color: rgba(0, 0, 0, 0.8);\n}\n.SkillTooltip_mainText {\n font-weight: 500;\n}\n.SkillTooltip_smallText {\n font-size: 12px;\n}\n.SkillTooltip_subTextMargin {\n margin-bottom: 0.3rem;\n}\n.SkillTooltip_boundaryContainer {\n display: flex;\n width: 100%;\n margin-bottom: 0.5rem;\n line-height: 17px;\n}\n.SkillTooltip_boundary {\n flex: 1;\n flex-basis: 0px;\n min-width: 0;\n display: flex;\n flex-direction: column;\n color: black;\n margin: 0.15rem;\n}\n.SkillTooltip_boundary:first-of-type > .SkillTooltip_boundaryHead {\n border-radius: 3px 0 0 0;\n}\n.SkillTooltip_boundary:last-of-type > .SkillTooltip_boundaryHead {\n border-radius: 0 3px 0 0;\n}\n.SkillTooltip_boundary:first-of-type > .SkillTooltip_boundaryBody {\n border-radius: 0 0 0 3px;\n}\n.SkillTooltip_boundary:last-of-type > .SkillTooltip_boundaryBody {\n border-radius: 0 0 3px 0;\n}\n.SkillTooltip_boundaryHead {\n color: white;\n font-weight: 500;\n font-size: 12px;\n text-overflow: ellipsis;\n overflow: hidden;\n padding: 0.3rem;\n text-align: center;\n flex: 1;\n min-height: 26px;\n background-color: rgba(127, 127, 127, 0.4);\n}\n.SkillTooltip_boundaryBody {\n color: white;\n padding: 0.5rem 0.3rem;\n margin-top: 0.15rem;\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 40px;\n flex: 2;\n background-color: rgba(127, 127, 127, 0.4);\n}\n.SkillTooltip_boundaryBodyModifier {\n min-height: 33px !important;\n}\n.SkillTooltip_boundaryHasIcon {\n min-height: 50px !important;\n}\n.SkillTooltip_conditionRow {\n display: flex;\n align-items: center;\n font-size: 12px;\n}\n.SkillTooltip_conditionRow:not(:last-of-type) {\n margin-bottom: 0.1rem;\n}\n.SkillTooltip_conditionIcon {\n width: 20px;\n height: 20px;\n margin-right: 0.33rem;\n}\n.SkillTooltip_conditionIconSmall {\n width: 12px;\n height: 12px;\n margin-right: 0.22rem;\n}\n\n.tooltipArg {\n color: #00D9FF;\n font-weight: 600;\n}\n\n.wordbreakall {\n word-break: break-all;\n}\n\n.wordbreakword {\n word-break: break-word;\n}\n\n.target-360 {\n background-image: url(\"./360.png\");\n background-repeat: no-repeat;\n background-position: 50% 60%;\n background-size: auto 64px;\n}\n\n.target-front-180 {\n background-image: url(\"./180.png\");\n background-repeat: no-repeat;\n background-position: 50% 70%;\n background-size: auto 64px;\n}\n\n.laser {\n background-image: url(\"./laser.png\");\n background-repeat: no-repeat;\n background-position: 50% 50%;\n background-size: auto 64px;\n}\n\n.arcanemark {\n background-image: url(\"./arcanemark.png\");\n width: 24px;\n height: 24px;\n background-position: 50% 50%;\n background-size: auto 24px;\n margin-left: 0.
|
|
8732
|
+
var css_248z$6 = ".TooltipBase_bns_upgradeRed_color {\n color: #FF2818;\n}\n\n.TooltipBase_bns_downgradeBlue_color {\n color: #28A9F0;\n}\n\n.SkillTooltip_skillIconContainer {\n width: 60px;\n height: 60px;\n padding: 0;\n float: left;\n position: relative;\n}\n.SkillTooltip_skillIcon {\n width: 60px;\n height: 60px;\n position: relative;\n}\n.SkillTooltip_skillIconCanvas {\n width: 60px;\n height: 60px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n filter: blur(30px);\n opacity: 0.5;\n}\n.SkillTooltip_buttonIcon {\n position: absolute;\n right: 1px;\n bottom: 1px;\n height: 18px;\n opacity: 0.9;\n}\n.SkillTooltip_buttonIconMouse {\n background-color: rgba(0, 0, 0, 0.8);\n}\n.SkillTooltip_mainText {\n font-weight: 500;\n}\n.SkillTooltip_smallText {\n font-size: 12px;\n}\n.SkillTooltip_subTextMargin {\n margin-bottom: 0.3rem;\n}\n.SkillTooltip_boundaryContainer {\n display: flex;\n width: 100%;\n margin-bottom: 0.5rem;\n line-height: 17px;\n}\n.SkillTooltip_boundary {\n flex: 1;\n flex-basis: 0px;\n min-width: 0;\n display: flex;\n flex-direction: column;\n color: black;\n margin: 0.15rem;\n}\n.SkillTooltip_boundary:first-of-type > .SkillTooltip_boundaryHead {\n border-radius: 3px 0 0 0;\n}\n.SkillTooltip_boundary:last-of-type > .SkillTooltip_boundaryHead {\n border-radius: 0 3px 0 0;\n}\n.SkillTooltip_boundary:first-of-type > .SkillTooltip_boundaryBody {\n border-radius: 0 0 0 3px;\n}\n.SkillTooltip_boundary:last-of-type > .SkillTooltip_boundaryBody {\n border-radius: 0 0 3px 0;\n}\n.SkillTooltip_boundaryHead {\n color: white;\n font-weight: 500;\n font-size: 12px;\n text-overflow: ellipsis;\n overflow: hidden;\n padding: 0.3rem;\n text-align: center;\n flex: 1;\n min-height: 26px;\n background-color: rgba(127, 127, 127, 0.4);\n}\n.SkillTooltip_boundaryBody {\n color: white;\n padding: 0.5rem 0.3rem;\n margin-top: 0.15rem;\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 40px;\n flex: 2;\n background-color: rgba(127, 127, 127, 0.4);\n}\n.SkillTooltip_boundaryBodyModifier {\n min-height: 33px !important;\n}\n.SkillTooltip_boundaryHasIcon {\n min-height: 50px !important;\n}\n.SkillTooltip_conditionRow {\n display: flex;\n align-items: center;\n font-size: 12px;\n}\n.SkillTooltip_conditionRow:not(:last-of-type) {\n margin-bottom: 0.1rem;\n}\n.SkillTooltip_conditionIcon {\n width: 20px;\n height: 20px;\n margin-right: 0.33rem;\n}\n.SkillTooltip_conditionIconSmall {\n width: 12px;\n height: 12px;\n margin-right: 0.22rem;\n}\n\n.tooltipArg {\n color: #00D9FF;\n font-weight: 600;\n}\n\n.wordbreakall {\n word-break: break-all;\n}\n\n.wordbreakword {\n word-break: break-word;\n}\n\n.target-360 {\n background-image: url(\"./360.png\");\n background-repeat: no-repeat;\n background-position: 50% 60%;\n background-size: auto 64px;\n}\n\n.target-front-180 {\n background-image: url(\"./180.png\");\n background-repeat: no-repeat;\n background-position: 50% 70%;\n background-size: auto 64px;\n}\n\n.laser {\n background-image: url(\"./laser.png\");\n background-repeat: no-repeat;\n background-position: 50% 50%;\n background-size: auto 64px;\n}\n\n.arcanemark {\n background-image: url(\"./arcanemark.png\");\n width: 24px;\n height: 24px;\n background-position: 50% 50%;\n background-size: auto 24px;\n margin-left: 0.25rem;\n}";
|
|
8676
8733
|
styleInject(css_248z$6);
|
|
8677
8734
|
|
|
8678
8735
|
function getButtonIconPath(button) {
|
|
@@ -8838,7 +8895,7 @@ function SkillConditions(_a) {
|
|
|
8838
8895
|
}
|
|
8839
8896
|
|
|
8840
8897
|
function SkillTooltip(_a) {
|
|
8841
|
-
var data = _a.data, _b = _a.debug, debug = _b === void 0 ? false : _b, _c = _a.masteryPoints, masteryPoints = _c === void 0 ? 0 : _c
|
|
8898
|
+
var data = _a.data, _b = _a.debug, debug = _b === void 0 ? false : _b, _c = _a.masteryPoints, masteryPoints = _c === void 0 ? 0 : _c;
|
|
8842
8899
|
var skill = data;
|
|
8843
8900
|
var tooltipBaseProps = {
|
|
8844
8901
|
title: skill.Name,
|
|
@@ -8858,7 +8915,7 @@ function SkillTooltip(_a) {
|
|
|
8858
8915
|
//bottomPart
|
|
8859
8916
|
AddSubTexts(tooltipBaseProps.subInfoGroups, skill);
|
|
8860
8917
|
AddBreakValue(tooltipBaseProps.subInfoGroups, skill);
|
|
8861
|
-
AddSkillMastery(tooltipBaseProps.subInfoGroups, masteryPoints,
|
|
8918
|
+
AddSkillMastery(tooltipBaseProps.subInfoGroups, masteryPoints, skill.ArcaneInfo);
|
|
8862
8919
|
AddPvpModifiers(tooltipBaseProps.subInfoGroups, skill);
|
|
8863
8920
|
AddBoundaries(tooltipBaseProps.subInfoGroups, skill);
|
|
8864
8921
|
AddConditions(tooltipBaseProps.subInfoGroups, skill);
|
|
@@ -8910,8 +8967,11 @@ function AddBreakValue(subInfoGroups, skill) {
|
|
|
8910
8967
|
});
|
|
8911
8968
|
}
|
|
8912
8969
|
}
|
|
8913
|
-
function AddSkillMastery(subInfoGroups, masteryPoints,
|
|
8914
|
-
if (masteryPoints == null || masteryPoints == 0 ||
|
|
8970
|
+
function AddSkillMastery(subInfoGroups, masteryPoints, arcaneInfo) {
|
|
8971
|
+
if (masteryPoints == null || masteryPoints == 0 || arcaneInfo == null)
|
|
8972
|
+
return;
|
|
8973
|
+
var masteryValue = GetSkillMasteryValue(masteryPoints, arcaneInfo);
|
|
8974
|
+
if (masteryValue == null || masteryValue == 0)
|
|
8915
8975
|
return;
|
|
8916
8976
|
var formattedMasteryValue = Number.isInteger(masteryValue) ? masteryValue.toString() : masteryValue.toFixed(2).replace(',', '.');
|
|
8917
8977
|
subInfoGroups.push({
|
|
@@ -8922,7 +8982,7 @@ function AddSkillMastery(subInfoGroups, masteryPoints, masteryValue, masteryIsPe
|
|
|
8922
8982
|
React.createElement("span", { className: "tooltipArg", style: { fontSize: "14px" } }, "Skill Grandmaster"),
|
|
8923
8983
|
React.createElement("div", { className: "arcanemark" }),
|
|
8924
8984
|
React.createElement("span", { className: "tooltipArg", style: { fontSize: "14px" } }, masteryPoints)),
|
|
8925
|
-
|
|
8985
|
+
!arcaneInfo.IsCooldown ?
|
|
8926
8986
|
React.createElement("div", null,
|
|
8927
8987
|
"Damage increase:\u00A0",
|
|
8928
8988
|
React.createElement("span", { className: "tooltipArg" },
|
|
@@ -9145,9 +9205,9 @@ var css_248z$5 = ".TooltipBase_bns_upgradeRed_color {\n color: #FF2818;\n}\n\n.
|
|
|
9145
9205
|
styleInject(css_248z$5);
|
|
9146
9206
|
|
|
9147
9207
|
var SkillTooltipWrapper = function (_a) {
|
|
9148
|
-
var data = _a.data, children = _a.children, _b = _a.interactive, interactive = _b === void 0 ? false : _b, _c = _a.placement, placement = _c === void 0 ? "right" : _c, _d = _a.followCursor, followCursor$1 = _d === void 0 ? false : _d, _e = _a.trigger, trigger = _e === void 0 ? "mouseenter focus" : _e, _f = _a.showArrow, showArrow = _f === void 0 ? true : _f, _g = _a.debug, debug = _g === void 0 ? false : _g, _h = _a.masteryPoints, masteryPoints = _h === void 0 ? 0 : _h
|
|
9208
|
+
var data = _a.data, children = _a.children, _b = _a.interactive, interactive = _b === void 0 ? false : _b, _c = _a.placement, placement = _c === void 0 ? "right" : _c, _d = _a.followCursor, followCursor$1 = _d === void 0 ? false : _d, _e = _a.trigger, trigger = _e === void 0 ? "mouseenter focus" : _e, _f = _a.showArrow, showArrow = _f === void 0 ? true : _f, _g = _a.debug, debug = _g === void 0 ? false : _g, _h = _a.masteryPoints, masteryPoints = _h === void 0 ? 0 : _h;
|
|
9149
9209
|
var spanRef = useRef(null);
|
|
9150
|
-
var
|
|
9210
|
+
var _j = useState(null), childRef = _j[0], setChildRef = _j[1];
|
|
9151
9211
|
/**
|
|
9152
9212
|
* Mount the temporary span element.
|
|
9153
9213
|
* retrieve and store the target element's reference.
|
|
@@ -9160,7 +9220,7 @@ var SkillTooltipWrapper = function (_a) {
|
|
|
9160
9220
|
}, []);
|
|
9161
9221
|
return (React.createElement(React.Fragment, null,
|
|
9162
9222
|
children,
|
|
9163
|
-
childRef ? (React.createElement(Tippy, { arrow: showArrow, trigger: trigger, plugins: [followCursor], followCursor: followCursor$1 && (!interactive && !debug), appendTo: document.body, placement: placement, animation: "fade", interactive: interactive || debug, content: React.createElement(SkillTooltip, { data: data, debug: debug, masteryPoints: masteryPoints
|
|
9223
|
+
childRef ? (React.createElement(Tippy, { arrow: showArrow, trigger: trigger, plugins: [followCursor], followCursor: followCursor$1 && (!interactive && !debug), appendTo: document.body, placement: placement, animation: "fade", interactive: interactive || debug, content: React.createElement(SkillTooltip, { data: data, debug: debug, masteryPoints: masteryPoints }), theme: "grade" + 4, reference: childRef })) : (React.createElement("span", { "data-testid": "TooltipWrapper", ref: spanRef, style: { display: "none" } }))));
|
|
9164
9224
|
};
|
|
9165
9225
|
|
|
9166
9226
|
var ServerRegion;
|