bnstooltips 1.21.2 → 1.22.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 +1 -0
- package/build/SkillTooltipWrapper/SkillTooltipWrapper.types.d.ts +1 -0
- package/build/Utilities/Helpers.d.ts +2 -1
- package/build/Utilities/ISkill.d.ts +13 -1
- package/build/index.es.js +74 -11
- package/build/index.es.js.map +1 -1
- package/build/index.js +74 -11
- 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, multi, }: SkillTooltipProps): JSX.Element;
|
|
4
|
+
declare function SkillTooltip({ data, debug, masteryPoints, showZeroMastery, multi, }: SkillTooltipProps): JSX.Element;
|
|
5
5
|
export default SkillTooltip;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Skill, SkillArcaneInfo } from "./ISkill";
|
|
1
|
+
import { Skill, SkillArcaneInfo, SkillArcaneInfo2 } 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;
|
|
@@ -14,3 +14,4 @@ export interface IBnsMoney {
|
|
|
14
14
|
}
|
|
15
15
|
export declare function getMoneyObj(money: number): IBnsMoney | null;
|
|
16
16
|
export declare function GetSkillMasteryValue(points: number, arcaneInfo: SkillArcaneInfo): number;
|
|
17
|
+
export declare function GetSkillMasteryValue2(points: number, arcaneInfo: SkillArcaneInfo2 | undefined): number;
|
|
@@ -25,7 +25,19 @@ export interface Skill {
|
|
|
25
25
|
};
|
|
26
26
|
RealCastCondition: RealCastCondition;
|
|
27
27
|
RealEffects: RealEffects;
|
|
28
|
-
ArcaneInfo
|
|
28
|
+
ArcaneInfo?: SkillArcaneInfo;
|
|
29
|
+
ArcaneInfo2?: SkillArcaneInfo2;
|
|
30
|
+
}
|
|
31
|
+
export declare enum ArcaneModifyType {
|
|
32
|
+
None = 0,
|
|
33
|
+
Damage = 1,
|
|
34
|
+
Cooldown = 2
|
|
35
|
+
}
|
|
36
|
+
export interface SkillArcaneInfo2 {
|
|
37
|
+
Type: ArcaneModifyType;
|
|
38
|
+
Breakpoints: {
|
|
39
|
+
[id: number]: number;
|
|
40
|
+
};
|
|
29
41
|
}
|
|
30
42
|
export interface SkillArcaneInfo {
|
|
31
43
|
IsCooldown: boolean;
|
package/build/index.es.js
CHANGED
|
@@ -151,7 +151,7 @@ function BuildIconPath(iconPath, iconIndex) {
|
|
|
151
151
|
iconPath = iconPath.substring(1);
|
|
152
152
|
}
|
|
153
153
|
if (iconPath.startsWith("/Game/")) {
|
|
154
|
-
var split = iconPath.split(
|
|
154
|
+
var split = iconPath.split("/");
|
|
155
155
|
var last = split[split.length - 1];
|
|
156
156
|
var penultimate = split[split.length - 2];
|
|
157
157
|
if (last === penultimate) {
|
|
@@ -280,7 +280,7 @@ function getMoneyObj(money) {
|
|
|
280
280
|
var copper = 0;
|
|
281
281
|
if (money === 0)
|
|
282
282
|
return null;
|
|
283
|
-
var digits = money.toString().split(
|
|
283
|
+
var digits = money.toString().split("");
|
|
284
284
|
var realDigits = digits.map(Number);
|
|
285
285
|
var i = 0;
|
|
286
286
|
var subCurrencyIndex = [0, 0, 0];
|
|
@@ -314,13 +314,29 @@ function getMoneyObj(money) {
|
|
|
314
314
|
return {
|
|
315
315
|
Copper: copper,
|
|
316
316
|
Gold: gold,
|
|
317
|
-
Silver: silver
|
|
317
|
+
Silver: silver,
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
320
|
function GetSkillMasteryValue(points, arcaneInfo) {
|
|
321
321
|
if (points <= 0 || arcaneInfo == null)
|
|
322
322
|
return 0;
|
|
323
|
-
return arcaneInfo.IsCooldown
|
|
323
|
+
return arcaneInfo.IsCooldown
|
|
324
|
+
? GetSkillMasteryCdValueForPoints(points, arcaneInfo.CooldownBreakpoints)
|
|
325
|
+
: GetSkillMasteryValueForPoints(points, arcaneInfo.DamageSections);
|
|
326
|
+
}
|
|
327
|
+
function GetSkillMasteryValue2(points, arcaneInfo) {
|
|
328
|
+
if (points <= 0 || arcaneInfo == undefined || arcaneInfo == null)
|
|
329
|
+
return 0;
|
|
330
|
+
if (arcaneInfo.Type === 0)
|
|
331
|
+
return 0; // No modification
|
|
332
|
+
if (arcaneInfo.Type === 1) {
|
|
333
|
+
// Damage modification
|
|
334
|
+
return GetSkillMasteryValueForPoints(points, arcaneInfo.Breakpoints);
|
|
335
|
+
}
|
|
336
|
+
if (arcaneInfo.Type === 2) {
|
|
337
|
+
// Cooldown modification
|
|
338
|
+
return GetSkillMasteryCdValueForPoints(points, arcaneInfo.Breakpoints);
|
|
339
|
+
}
|
|
324
340
|
}
|
|
325
341
|
/**
|
|
326
342
|
* Calculates the cooldown reduction value based on skill mastery points and defined breakpoints.
|
|
@@ -8896,8 +8912,15 @@ function SkillConditions(_a) {
|
|
|
8896
8912
|
React.createElement("div", { key: i, dangerouslySetInnerHTML: { __html: sub.Text } }))); })));
|
|
8897
8913
|
}
|
|
8898
8914
|
|
|
8915
|
+
var ArcaneModifyType;
|
|
8916
|
+
(function (ArcaneModifyType) {
|
|
8917
|
+
ArcaneModifyType[ArcaneModifyType["None"] = 0] = "None";
|
|
8918
|
+
ArcaneModifyType[ArcaneModifyType["Damage"] = 1] = "Damage";
|
|
8919
|
+
ArcaneModifyType[ArcaneModifyType["Cooldown"] = 2] = "Cooldown";
|
|
8920
|
+
})(ArcaneModifyType || (ArcaneModifyType = {}));
|
|
8921
|
+
|
|
8899
8922
|
function SkillTooltip(_a) {
|
|
8900
|
-
var data = _a.data, _b = _a.debug, debug = _b === void 0 ? false : _b, _c = _a.masteryPoints, masteryPoints = _c === void 0 ? 0 : _c, _d = _a.multi, multi =
|
|
8923
|
+
var data = _a.data, _b = _a.debug, debug = _b === void 0 ? false : _b, _c = _a.masteryPoints, masteryPoints = _c === void 0 ? 0 : _c, _d = _a.showZeroMastery, showZeroMastery = _d === void 0 ? false : _d, _e = _a.multi, multi = _e === void 0 ? false : _e;
|
|
8901
8924
|
var skill = data;
|
|
8902
8925
|
var tooltipBaseProps = {
|
|
8903
8926
|
title: skill.Name,
|
|
@@ -8918,7 +8941,8 @@ function SkillTooltip(_a) {
|
|
|
8918
8941
|
//bottomPart
|
|
8919
8942
|
AddSubTexts(tooltipBaseProps.subInfoGroups, skill);
|
|
8920
8943
|
AddBreakValue(tooltipBaseProps.subInfoGroups, skill);
|
|
8921
|
-
AddSkillMastery(tooltipBaseProps.subInfoGroups, masteryPoints, skill.ArcaneInfo);
|
|
8944
|
+
AddSkillMastery(tooltipBaseProps.subInfoGroups, masteryPoints, skill.ArcaneInfo, showZeroMastery);
|
|
8945
|
+
AddSkillMastery2(tooltipBaseProps.subInfoGroups, masteryPoints, skill.ArcaneInfo2, showZeroMastery);
|
|
8922
8946
|
AddPvpModifiers(tooltipBaseProps.subInfoGroups, skill);
|
|
8923
8947
|
AddBoundaries(tooltipBaseProps.subInfoGroups, skill);
|
|
8924
8948
|
AddConditions(tooltipBaseProps.subInfoGroups, skill);
|
|
@@ -8971,8 +8995,47 @@ function AddBreakValue(subInfoGroups, skill) {
|
|
|
8971
8995
|
});
|
|
8972
8996
|
}
|
|
8973
8997
|
}
|
|
8974
|
-
function
|
|
8975
|
-
|
|
8998
|
+
function AddSkillMastery2(subInfoGroups, masteryPoints, arcaneInfo2, showZeroMastery) {
|
|
8999
|
+
var _a;
|
|
9000
|
+
if (showZeroMastery === void 0) { showZeroMastery = false; }
|
|
9001
|
+
if (arcaneInfo2 == undefined ||
|
|
9002
|
+
masteryPoints == null ||
|
|
9003
|
+
(masteryPoints == 0 && !showZeroMastery) ||
|
|
9004
|
+
arcaneInfo2 == null)
|
|
9005
|
+
return;
|
|
9006
|
+
var masteryValue = GetSkillMasteryValue2(masteryPoints, arcaneInfo2);
|
|
9007
|
+
if (masteryValue == null)
|
|
9008
|
+
return;
|
|
9009
|
+
var formattedMasteryValue = Number.isInteger(masteryValue)
|
|
9010
|
+
? masteryValue.toString()
|
|
9011
|
+
: masteryValue.toFixed(2).replace(",", ".");
|
|
9012
|
+
var masteryTypeMap = (_a = {},
|
|
9013
|
+
_a[ArcaneModifyType.Damage] = { label: "Damage increase", unit: "%" },
|
|
9014
|
+
_a[ArcaneModifyType.Cooldown] = { label: "Cooldown reduction", unit: " sec." },
|
|
9015
|
+
_a);
|
|
9016
|
+
subInfoGroups.push({
|
|
9017
|
+
title: "",
|
|
9018
|
+
texts: [
|
|
9019
|
+
React.createElement("div", null,
|
|
9020
|
+
React.createElement("div", { style: { display: "flex", alignItems: "center" } },
|
|
9021
|
+
React.createElement("span", { className: "tooltipArg", style: { fontSize: "14px" } }, "Skill Grandmaster"),
|
|
9022
|
+
React.createElement("div", { className: "arcanemark" }),
|
|
9023
|
+
React.createElement("span", { className: "tooltipArg", style: { fontSize: "14px" } }, masteryPoints)),
|
|
9024
|
+
masteryTypeMap[arcaneInfo2.Type] && (React.createElement("div", null,
|
|
9025
|
+
masteryTypeMap[arcaneInfo2.Type].label,
|
|
9026
|
+
":\u00A0",
|
|
9027
|
+
React.createElement("span", { className: "tooltipArg" },
|
|
9028
|
+
formattedMasteryValue,
|
|
9029
|
+
masteryTypeMap[arcaneInfo2.Type].unit)))),
|
|
9030
|
+
],
|
|
9031
|
+
});
|
|
9032
|
+
}
|
|
9033
|
+
function AddSkillMastery(subInfoGroups, masteryPoints, arcaneInfo, showZeroMastery) {
|
|
9034
|
+
if (showZeroMastery === void 0) { showZeroMastery = false; }
|
|
9035
|
+
if (arcaneInfo == undefined ||
|
|
9036
|
+
masteryPoints == null ||
|
|
9037
|
+
(masteryPoints == 0 && !showZeroMastery) ||
|
|
9038
|
+
arcaneInfo == null)
|
|
8976
9039
|
return;
|
|
8977
9040
|
var masteryValue = GetSkillMasteryValue(masteryPoints, arcaneInfo);
|
|
8978
9041
|
if (masteryValue == null)
|
|
@@ -9255,9 +9318,9 @@ var css_248z$7 = ".TooltipBase_bns_upgradeRed_color {\n color: #FF2818;\n}\n\n.
|
|
|
9255
9318
|
styleInject(css_248z$7);
|
|
9256
9319
|
|
|
9257
9320
|
var SkillTooltipWrapper = function (_a) {
|
|
9258
|
-
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;
|
|
9321
|
+
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, _j = _a.showZeroMastery, showZeroMastery = _j === void 0 ? false : _j;
|
|
9259
9322
|
var spanRef = useRef(null);
|
|
9260
|
-
var
|
|
9323
|
+
var _k = useState(null), childRef = _k[0], setChildRef = _k[1];
|
|
9261
9324
|
/**
|
|
9262
9325
|
* Mount the temporary span element.
|
|
9263
9326
|
* retrieve and store the target element's reference.
|
|
@@ -9270,7 +9333,7 @@ var SkillTooltipWrapper = function (_a) {
|
|
|
9270
9333
|
}, []);
|
|
9271
9334
|
return (React.createElement(React.Fragment, null,
|
|
9272
9335
|
children,
|
|
9273
|
-
childRef ? (React.createElement(Tippy, { arrow: showArrow, trigger: trigger, plugins: [followCursor], followCursor: followCursor$1 &&
|
|
9336
|
+
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, showZeroMastery: showZeroMastery }), theme: "grade" + 4, reference: childRef })) : (React.createElement("span", { "data-testid": "TooltipWrapper", ref: spanRef, style: { display: "none" } }))));
|
|
9274
9337
|
};
|
|
9275
9338
|
|
|
9276
9339
|
var ServerRegion;
|