bnstooltips 1.19.1 → 1.19.2

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.
@@ -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, masteryValue, masteryIsPercentage, }: SkillTooltipProps): JSX.Element;
4
+ declare function SkillTooltip({ data, debug, masteryPoints, masteryIsCooldown, }: SkillTooltipProps): JSX.Element;
5
5
  export default SkillTooltip;
@@ -2,7 +2,6 @@ import { Skill } from "../Utilities/ISkill";
2
2
  export interface SkillTooltipProps {
3
3
  data: Skill;
4
4
  masteryPoints?: number;
5
- masteryValue?: number;
6
- masteryIsPercentage?: boolean;
5
+ masteryIsCooldown?: boolean;
7
6
  debug?: boolean;
8
7
  }
@@ -3,7 +3,6 @@ import { ITooltipWrapper } from "../Utilities/Models";
3
3
  export interface SkillTooltipWrapperProps extends ITooltipWrapper {
4
4
  data: Skill;
5
5
  masteryPoints?: number;
6
- masteryValue?: number;
7
- masteryIsPercentage?: boolean;
6
+ masteryIsCooldown?: boolean;
8
7
  debug?: boolean;
9
8
  }
@@ -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, isCd: boolean): number;
package/build/index.es.js CHANGED
@@ -316,6 +316,53 @@ function getMoneyObj(money) {
316
316
  Gold: gold,
317
317
  Silver: silver
318
318
  };
319
+ }
320
+ function GetSkillMasteryValue(points, isCd) {
321
+ if (points <= 0)
322
+ return 0;
323
+ return isCd ? GetSkillMasteryCdValueForPoints(points) : GetSkillMasteryValueForPoints(points);
324
+ }
325
+ function GetSkillMasteryCdValueForPoints(points) {
326
+ var value = 0;
327
+ if (points >= 4) {
328
+ value += 1;
329
+ }
330
+ if (points >= 12) {
331
+ value += 2;
332
+ }
333
+ if (points >= 24) {
334
+ value += 2;
335
+ }
336
+ return 0 - value;
337
+ }
338
+ function GetSkillMasteryValueForPoints(points) {
339
+ var value = 0;
340
+ if (points > 0) {
341
+ var firstRange = Math.min(points, 15);
342
+ value += firstRange * 1.9;
343
+ points -= firstRange;
344
+ }
345
+ if (points > 0) {
346
+ var secondRange = Math.min(points, 35 - 15);
347
+ value += secondRange * 1.5;
348
+ points -= secondRange;
349
+ }
350
+ if (points > 0) {
351
+ var thirdRange = Math.min(points, 100 - 35);
352
+ value += thirdRange * 1.1;
353
+ points -= thirdRange;
354
+ }
355
+ if (points > 0) {
356
+ var fourthRange = Math.min(points, 165 - 100);
357
+ value += fourthRange * 0.7;
358
+ points -= fourthRange;
359
+ }
360
+ if (points > 0) {
361
+ var fifthRange = Math.min(points, 1000 - 165);
362
+ value += fifthRange * 0.3;
363
+ points -= fifthRange;
364
+ }
365
+ return value;
319
366
  }
320
367
 
321
368
  //----------------------
@@ -8672,7 +8719,7 @@ function JsonArrayToJsxArray(stringArray) {
8672
8719
  return jsxArray;
8673
8720
  }
8674
8721
 
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.33rem;\n margin-right: 0.05rem;\n}";
8722
+ 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
8723
  styleInject(css_248z$6);
8677
8724
 
8678
8725
  function getButtonIconPath(button) {
@@ -8838,7 +8885,7 @@ function SkillConditions(_a) {
8838
8885
  }
8839
8886
 
8840
8887
  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, _d = _a.masteryValue, masteryValue = _d === void 0 ? 0 : _d, _e = _a.masteryIsPercentage, masteryIsPercentage = _e === void 0 ? false : _e;
8888
+ var data = _a.data, _b = _a.debug, debug = _b === void 0 ? false : _b, _c = _a.masteryPoints, masteryPoints = _c === void 0 ? 0 : _c, _d = _a.masteryIsCooldown, masteryIsCooldown = _d === void 0 ? false : _d;
8842
8889
  var skill = data;
8843
8890
  var tooltipBaseProps = {
8844
8891
  title: skill.Name,
@@ -8858,7 +8905,7 @@ function SkillTooltip(_a) {
8858
8905
  //bottomPart
8859
8906
  AddSubTexts(tooltipBaseProps.subInfoGroups, skill);
8860
8907
  AddBreakValue(tooltipBaseProps.subInfoGroups, skill);
8861
- AddSkillMastery(tooltipBaseProps.subInfoGroups, masteryPoints, masteryValue, masteryIsPercentage);
8908
+ AddSkillMastery(tooltipBaseProps.subInfoGroups, masteryPoints, masteryIsCooldown);
8862
8909
  AddPvpModifiers(tooltipBaseProps.subInfoGroups, skill);
8863
8910
  AddBoundaries(tooltipBaseProps.subInfoGroups, skill);
8864
8911
  AddConditions(tooltipBaseProps.subInfoGroups, skill);
@@ -8910,8 +8957,11 @@ function AddBreakValue(subInfoGroups, skill) {
8910
8957
  });
8911
8958
  }
8912
8959
  }
8913
- function AddSkillMastery(subInfoGroups, masteryPoints, masteryValue, masteryIsPercentage) {
8914
- if (masteryPoints == null || masteryPoints == 0 || masteryValue == null || masteryValue == 0)
8960
+ function AddSkillMastery(subInfoGroups, masteryPoints, masteryIsCooldown) {
8961
+ if (masteryPoints == null || masteryPoints == 0)
8962
+ return;
8963
+ var masteryValue = GetSkillMasteryValue(masteryPoints, masteryIsCooldown);
8964
+ if (masteryValue == null || masteryValue == 0)
8915
8965
  return;
8916
8966
  var formattedMasteryValue = Number.isInteger(masteryValue) ? masteryValue.toString() : masteryValue.toFixed(2).replace(',', '.');
8917
8967
  subInfoGroups.push({
@@ -8922,7 +8972,7 @@ function AddSkillMastery(subInfoGroups, masteryPoints, masteryValue, masteryIsPe
8922
8972
  React.createElement("span", { className: "tooltipArg", style: { fontSize: "14px" } }, "Skill Grandmaster"),
8923
8973
  React.createElement("div", { className: "arcanemark" }),
8924
8974
  React.createElement("span", { className: "tooltipArg", style: { fontSize: "14px" } }, masteryPoints)),
8925
- masteryIsPercentage ?
8975
+ !masteryIsCooldown ?
8926
8976
  React.createElement("div", null,
8927
8977
  "Damage increase:\u00A0",
8928
8978
  React.createElement("span", { className: "tooltipArg" },
@@ -9145,9 +9195,9 @@ var css_248z$5 = ".TooltipBase_bns_upgradeRed_color {\n color: #FF2818;\n}\n\n.
9145
9195
  styleInject(css_248z$5);
9146
9196
 
9147
9197
  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, _j = _a.masteryValue, masteryValue = _j === void 0 ? 0 : _j, _k = _a.masteryIsPercentage, masteryIsPercentage = _k === void 0 ? false : _k;
9198
+ 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.masteryIsCooldown, masteryIsCooldown = _j === void 0 ? false : _j;
9149
9199
  var spanRef = useRef(null);
9150
- var _l = useState(null), childRef = _l[0], setChildRef = _l[1];
9200
+ var _k = useState(null), childRef = _k[0], setChildRef = _k[1];
9151
9201
  /**
9152
9202
  * Mount the temporary span element.
9153
9203
  * retrieve and store the target element's reference.
@@ -9160,7 +9210,7 @@ var SkillTooltipWrapper = function (_a) {
9160
9210
  }, []);
9161
9211
  return (React.createElement(React.Fragment, null,
9162
9212
  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, masteryValue: masteryValue, masteryIsPercentage: masteryIsPercentage }), theme: "grade" + 4, reference: childRef })) : (React.createElement("span", { "data-testid": "TooltipWrapper", ref: spanRef, style: { display: "none" } }))));
9213
+ 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, masteryIsCooldown: masteryIsCooldown }), theme: "grade" + 4, reference: childRef })) : (React.createElement("span", { "data-testid": "TooltipWrapper", ref: spanRef, style: { display: "none" } }))));
9164
9214
  };
9165
9215
 
9166
9216
  var ServerRegion;