bnstooltips 1.19.2 → 1.20.1
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 -1
- package/build/SkillTooltipWrapper/SkillTooltipWrapper.types.d.ts +0 -1
- package/build/Utilities/Helpers.d.ts +2 -2
- package/build/Utilities/ISkill.d.ts +10 -0
- package/build/index.es.js +61 -51
- package/build/index.es.js.map +1 -1
- package/build/index.js +61 -51
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -325,52 +325,62 @@ function getMoneyObj(money) {
|
|
|
325
325
|
Silver: silver
|
|
326
326
|
};
|
|
327
327
|
}
|
|
328
|
-
function GetSkillMasteryValue(points,
|
|
329
|
-
if (points <= 0)
|
|
328
|
+
function GetSkillMasteryValue(points, arcaneInfo) {
|
|
329
|
+
if (points <= 0 || arcaneInfo == null)
|
|
330
330
|
return 0;
|
|
331
|
-
return
|
|
331
|
+
return arcaneInfo.IsCooldown ? GetSkillMasteryCdValueForPoints(points, arcaneInfo.CooldownBreakpoints) : GetSkillMasteryValueForPoints(points, arcaneInfo.DamageSections);
|
|
332
332
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
333
|
+
/**
|
|
334
|
+
* Calculates the cooldown reduction value based on skill mastery points and defined breakpoints.
|
|
335
|
+
*
|
|
336
|
+
* @param mastery - The total skill mastery points.
|
|
337
|
+
* @param cooldownBreakpoints - An object mapping breakpoints to their corresponding cooldown reduction values.
|
|
338
|
+
* @returns The total cooldown reduction value.
|
|
339
|
+
*/
|
|
340
|
+
function GetSkillMasteryCdValueForPoints(mastery, cooldownBreakpoints) {
|
|
341
|
+
var value = 0; // Accumulator for the total cooldown reduction value
|
|
342
|
+
// Convert the object keys (breakpoints) to an array of numbers and sort them in ascending order
|
|
343
|
+
var sortedBreakpoints = Object.keys(cooldownBreakpoints)
|
|
344
|
+
.map(Number) // Convert string keys to numbers
|
|
345
|
+
.sort(function (a, b) { return a - b; }); // Sort breakpoints in ascending order
|
|
346
|
+
// Iterate over the sorted breakpoints
|
|
347
|
+
for (var _i = 0, sortedBreakpoints_1 = sortedBreakpoints; _i < sortedBreakpoints_1.length; _i++) {
|
|
348
|
+
var breakpoint = sortedBreakpoints_1[_i];
|
|
349
|
+
if (mastery >= breakpoint) {
|
|
350
|
+
// Add the cooldown reduction value for this breakpoint (converted from milliseconds to seconds)
|
|
351
|
+
value += cooldownBreakpoints[breakpoint] / 1000;
|
|
352
|
+
}
|
|
343
353
|
}
|
|
344
|
-
return
|
|
354
|
+
return value; // Return the total cooldown reduction value
|
|
345
355
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
var
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
356
|
+
/**
|
|
357
|
+
* Calculates the total skill bonus based on mastery points and the given damage sections.
|
|
358
|
+
*
|
|
359
|
+
* @param mastery - The total mastery points.
|
|
360
|
+
* @param damageSections - An object defining breakpoints and corresponding multipliers.
|
|
361
|
+
* @returns The total bonus percentage.
|
|
362
|
+
*/
|
|
363
|
+
function GetSkillMasteryValueForPoints(mastery, damageSections) {
|
|
364
|
+
var bonus = 0; // Stores the accumulated bonus percentage
|
|
365
|
+
var previousLimit = 0; // Keeps track of the previous breakpoint
|
|
366
|
+
// Iterate over the damageSections object, sorted by its keys (breakpoints)
|
|
367
|
+
for (var _i = 0, _a = Object.entries(damageSections); _i < _a.length; _i++) {
|
|
368
|
+
var _b = _a[_i], limitStr = _b[0], multiplier = _b[1];
|
|
369
|
+
var limit = parseInt(limitStr, 10); // Convert the key (string) to a number
|
|
370
|
+
if (mastery > previousLimit) {
|
|
371
|
+
// Calculate how many points fall within this range
|
|
372
|
+
var pointsInRange = Math.min(mastery - previousLimit, limit - previousLimit);
|
|
373
|
+
// Multiply points by the corresponding multiplier (converted to percentage)
|
|
374
|
+
bonus += pointsInRange * (multiplier / 10);
|
|
375
|
+
}
|
|
376
|
+
// Update the previous limit for the next iteration
|
|
377
|
+
previousLimit = limit;
|
|
378
|
+
// Stop iterating if mastery has been fully allocated
|
|
379
|
+
if (mastery <= limit) {
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
372
382
|
}
|
|
373
|
-
return
|
|
383
|
+
return bonus;
|
|
374
384
|
}
|
|
375
385
|
|
|
376
386
|
//----------------------
|
|
@@ -8893,7 +8903,7 @@ function SkillConditions(_a) {
|
|
|
8893
8903
|
}
|
|
8894
8904
|
|
|
8895
8905
|
function SkillTooltip(_a) {
|
|
8896
|
-
var data = _a.data, _b = _a.debug, debug = _b === void 0 ? false : _b, _c = _a.masteryPoints, masteryPoints = _c === void 0 ? 0 : _c
|
|
8906
|
+
var data = _a.data, _b = _a.debug, debug = _b === void 0 ? false : _b, _c = _a.masteryPoints, masteryPoints = _c === void 0 ? 0 : _c;
|
|
8897
8907
|
var skill = data;
|
|
8898
8908
|
var tooltipBaseProps = {
|
|
8899
8909
|
title: skill.Name,
|
|
@@ -8913,7 +8923,7 @@ function SkillTooltip(_a) {
|
|
|
8913
8923
|
//bottomPart
|
|
8914
8924
|
AddSubTexts(tooltipBaseProps.subInfoGroups, skill);
|
|
8915
8925
|
AddBreakValue(tooltipBaseProps.subInfoGroups, skill);
|
|
8916
|
-
AddSkillMastery(tooltipBaseProps.subInfoGroups, masteryPoints,
|
|
8926
|
+
AddSkillMastery(tooltipBaseProps.subInfoGroups, masteryPoints, skill.ArcaneInfo);
|
|
8917
8927
|
AddPvpModifiers(tooltipBaseProps.subInfoGroups, skill);
|
|
8918
8928
|
AddBoundaries(tooltipBaseProps.subInfoGroups, skill);
|
|
8919
8929
|
AddConditions(tooltipBaseProps.subInfoGroups, skill);
|
|
@@ -8965,11 +8975,11 @@ function AddBreakValue(subInfoGroups, skill) {
|
|
|
8965
8975
|
});
|
|
8966
8976
|
}
|
|
8967
8977
|
}
|
|
8968
|
-
function AddSkillMastery(subInfoGroups, masteryPoints,
|
|
8969
|
-
if (masteryPoints == null || masteryPoints == 0)
|
|
8978
|
+
function AddSkillMastery(subInfoGroups, masteryPoints, arcaneInfo) {
|
|
8979
|
+
if (masteryPoints == null || masteryPoints == 0 || arcaneInfo == null)
|
|
8970
8980
|
return;
|
|
8971
|
-
var masteryValue = GetSkillMasteryValue(masteryPoints,
|
|
8972
|
-
if (masteryValue == null
|
|
8981
|
+
var masteryValue = GetSkillMasteryValue(masteryPoints, arcaneInfo);
|
|
8982
|
+
if (masteryValue == null)
|
|
8973
8983
|
return;
|
|
8974
8984
|
var formattedMasteryValue = Number.isInteger(masteryValue) ? masteryValue.toString() : masteryValue.toFixed(2).replace(',', '.');
|
|
8975
8985
|
subInfoGroups.push({
|
|
@@ -8980,7 +8990,7 @@ function AddSkillMastery(subInfoGroups, masteryPoints, masteryIsCooldown) {
|
|
|
8980
8990
|
React__default["default"].createElement("span", { className: "tooltipArg", style: { fontSize: "14px" } }, "Skill Grandmaster"),
|
|
8981
8991
|
React__default["default"].createElement("div", { className: "arcanemark" }),
|
|
8982
8992
|
React__default["default"].createElement("span", { className: "tooltipArg", style: { fontSize: "14px" } }, masteryPoints)),
|
|
8983
|
-
!
|
|
8993
|
+
!arcaneInfo.IsCooldown ?
|
|
8984
8994
|
React__default["default"].createElement("div", null,
|
|
8985
8995
|
"Damage increase:\u00A0",
|
|
8986
8996
|
React__default["default"].createElement("span", { className: "tooltipArg" },
|
|
@@ -9203,9 +9213,9 @@ var css_248z$5 = ".TooltipBase_bns_upgradeRed_color {\n color: #FF2818;\n}\n\n.
|
|
|
9203
9213
|
styleInject(css_248z$5);
|
|
9204
9214
|
|
|
9205
9215
|
var SkillTooltipWrapper = function (_a) {
|
|
9206
|
-
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
|
|
9216
|
+
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;
|
|
9207
9217
|
var spanRef = React.useRef(null);
|
|
9208
|
-
var
|
|
9218
|
+
var _j = React.useState(null), childRef = _j[0], setChildRef = _j[1];
|
|
9209
9219
|
/**
|
|
9210
9220
|
* Mount the temporary span element.
|
|
9211
9221
|
* retrieve and store the target element's reference.
|
|
@@ -9218,7 +9228,7 @@ var SkillTooltipWrapper = function (_a) {
|
|
|
9218
9228
|
}, []);
|
|
9219
9229
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
9220
9230
|
children,
|
|
9221
|
-
childRef ? (React__default["default"].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__default["default"].createElement(SkillTooltip, { data: data, debug: debug, masteryPoints: masteryPoints
|
|
9231
|
+
childRef ? (React__default["default"].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__default["default"].createElement(SkillTooltip, { data: data, debug: debug, masteryPoints: masteryPoints }), theme: "grade" + 4, reference: childRef })) : (React__default["default"].createElement("span", { "data-testid": "TooltipWrapper", ref: spanRef, style: { display: "none" } }))));
|
|
9222
9232
|
};
|
|
9223
9233
|
|
|
9224
9234
|
exports.ServerRegion = void 0;
|