bnstooltips 1.18.17 → 1.19.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/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import React, { useState, cloneElement, forwardRef as forwardRef$1, useLayoutEffect, useEffect, useRef } from 'react';
1
+ import React, { useState, cloneElement, forwardRef as forwardRef$1, useLayoutEffect, useEffect, useRef, useMemo } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
 
4
4
  function styleInject(css, ref) {
@@ -129,6 +129,16 @@ function __generator(thisArg, body) {
129
129
  } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
130
130
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
131
131
  }
132
+ }
133
+
134
+ function __spreadArray(to, from, pack) {
135
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
136
+ if (ar || !(i in from)) {
137
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
138
+ ar[i] = from[i];
139
+ }
140
+ }
141
+ return to.concat(ar || Array.prototype.slice.call(from));
132
142
  }
133
143
 
134
144
  var css_248z$e = ".TooltipBase_bns_upgradeRed_color {\n color: #FF2818;\n}\n\n.TooltipBase_bns_downgradeBlue_color {\n color: #28A9F0;\n}\n\n.ItemTooltip_itemIconLoading {\n width: 50px;\n padding: 0.22rem 0;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.ItemTooltip_jobstyleToggleContainer {\n display: flex;\n}\n.ItemTooltip_optionPadding {\n margin: 0.2rem 0 0.5rem 0;\n}\n.ItemTooltip_showButton {\n flex: 1;\n border: none;\n padding: 0.33rem 0.5rem;\n border-radius: 0;\n background-color: rgba(233, 233, 233, 0.2);\n color: #fff;\n opacity: 0.8;\n cursor: pointer;\n transition: background-color 0.1s;\n}\n.ItemTooltip_showButton:hover {\n background-color: rgba(255, 255, 255, 0.3);\n opacity: 1;\n}\n.ItemTooltip_showButton-active {\n background-color: rgba(255, 255, 255, 0.4) !important;\n color: #fff;\n opacity: 1;\n}\n.ItemTooltip_jobstyleButton {\n flex: 1;\n border: none;\n padding: 0.33rem 0.5rem;\n border-radius: 0;\n background-color: rgba(233, 233, 233, 0.1);\n color: #fff;\n opacity: 0.8;\n cursor: pointer;\n transition: background-color 0.1s;\n}\n.ItemTooltip_jobstyleButton:hover {\n background-color: rgba(255, 255, 255, 0.2);\n opacity: 1;\n}\n.ItemTooltip_jobstyleButton-active {\n background-color: rgba(255, 255, 255, 0.3) !important;\n color: #fff;\n opacity: 1;\n}\n.ItemTooltip_itemiconnamedivspan {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.ItemTooltip_cooldown {\n font-weight: 400;\n font-size: 12px;\n}\n.ItemTooltip_subInfo {\n font-size: 14px;\n}\n.ItemTooltip_stats_mainstat {\n font-size: 16px;\n margin-bottom: 0.05rem;\n}\n.ItemTooltip_stats_substat {\n font-size: 14px;\n}\n.ItemTooltip_itemIconInline {\n width: 18px !important;\n height: 18px !important;\n margin: 0 1px;\n top: 3px;\n position: relative;\n}\n.ItemTooltip_itemIconRandom {\n width: 36px !important;\n top: 6px;\n margin: 0 1px 0 2px;\n}\n.ItemTooltip_itemIconSmall {\n width: 20px !important;\n height: 20px !important;\n margin-right: 0.33rem;\n}\n.ItemTooltip_itemIconSlate {\n width: 24px !important;\n height: 24px !important;\n margin-right: 0.11rem;\n}\n.ItemTooltip_setBonus {\n margin-bottom: 0.8rem !important;\n}\n.ItemTooltip_setContainer {\n padding-left: 0.33rem;\n padding-top: 0.22rem;\n}\n.ItemTooltip_setStageContainer {\n display: flex;\n margin: 0.25rem 0 0.35rem 0;\n}\n.ItemTooltip_setStageNumber {\n margin-top: 0.2rem;\n padding-top: 0.1rem;\n line-height: 16px;\n width: 16px;\n height: 16px;\n max-height: 16px;\n font-weight: 500;\n display: flex;\n justify-content: center;\n align-items: center;\n color: rgba(88, 255, 119, 0.8);\n border: 1px solid rgba(88, 255, 119, 0.9);\n border-radius: 3px;\n}\n.ItemTooltip_setStageContent {\n padding-top: 0.2rem;\n flex-grow: 2;\n padding-left: 0.55rem;\n max-width: 90%;\n color: #58ff77;\n}\n.ItemTooltip_itemiconnamediv {\n display: flex;\n align-items: center;\n padding: 0.15rem 0 0.15rem 0.33rem;\n line-height: 20px;\n}\n.ItemTooltip_slateIconNameStatsDiv {\n display: flex;\n justify-content: space-between;\n padding: 0.15rem 0;\n border-bottom: solid 1px rgba(233, 233, 233, 0.3);\n}\n.ItemTooltip_slateIconNameDiv {\n display: flex;\n justify-content: start;\n align-items: center;\n flex: 1;\n}\n.ItemTooltip_slateItemNameSmall {\n font-size: 14px;\n}\n.ItemTooltip_slateStatsDiv {\n display: flex;\n flex-direction: column;\n align-items: end;\n justify-content: center;\n flex: 1;\n}\n.ItemTooltip_setItemIconNameDiv {\n display: flex;\n align-items: center;\n padding: 0.11rem 0 0.11rem 0.33rem;\n line-height: 20px;\n}\n.ItemTooltip_setItemsContainer {\n display: flex;\n font-size: 12px;\n}\n.ItemTooltip_setItemsSubContainer {\n flex: 1;\n}\n.ItemTooltip_itemNameRandomDiv {\n display: flex;\n align-items: center;\n}\n\n@media only screen and (max-width: 380px) {\n .ItemTooltip_jobstyleButton {\n padding: 0.5rem;\n }\n}\n/**\n * ==============================================\n * Dot Elastic\n * ==============================================\n */\n.dot-elastic {\n position: relative;\n width: 10px;\n height: 10px;\n border-radius: 5px;\n background-color: rgba(127, 127, 127, 0.8);\n color: rgba(127, 127, 127, 0.8);\n animation: dotElastic 1s infinite linear;\n}\n\n.dot-elastic::before,\n.dot-elastic::after {\n content: \"\";\n display: inline-block;\n position: absolute;\n top: 0;\n}\n\n.dot-elastic::before {\n left: -15px;\n width: 10px;\n height: 10px;\n border-radius: 5px;\n background-color: rgba(127, 127, 127, 0.8);\n color: rgba(127, 127, 127, 0.8);\n animation: dotElasticBefore 1s infinite linear;\n}\n\n.dot-elastic::after {\n left: 15px;\n width: 10px;\n height: 10px;\n border-radius: 5px;\n background-color: rgba(127, 127, 127, 0.8);\n color: rgba(127, 127, 127, 0.8);\n animation: dotElasticAfter 1s infinite linear;\n}\n\n@keyframes dotElasticBefore {\n 0% {\n transform: scale(1, 1);\n }\n 25% {\n transform: scale(1, 1.5);\n }\n 50% {\n transform: scale(1, 0.67);\n }\n 75% {\n transform: scale(1, 1);\n }\n 100% {\n transform: scale(1, 1);\n }\n}\n@keyframes dotElastic {\n 0% {\n transform: scale(1, 1);\n }\n 25% {\n transform: scale(1, 1);\n }\n 50% {\n transform: scale(1, 1.5);\n }\n 75% {\n transform: scale(1, 1);\n }\n 100% {\n transform: scale(1, 1);\n }\n}\n@keyframes dotElasticAfter {\n 0% {\n transform: scale(1, 1);\n }\n 25% {\n transform: scale(1, 1);\n }\n 50% {\n transform: scale(1, 0.67);\n }\n 75% {\n transform: scale(1, 1.5);\n }\n 100% {\n transform: scale(1, 1);\n }\n}";
@@ -1563,6 +1573,7 @@ var BnsItemDto = /** @class */ (function () {
1563
1573
  this.slateStones.push(SlateStoneDto.fromJS(item));
1564
1574
  }
1565
1575
  }
1576
+ this.randomEffects = _data["randomEffects"] ? ItemRandomEffectsDto.fromJS(_data["randomEffects"]) : undefined;
1566
1577
  }
1567
1578
  };
1568
1579
  BnsItemDto.fromJS = function (data) {
@@ -1669,6 +1680,7 @@ var BnsItemDto = /** @class */ (function () {
1669
1680
  data["slateStones"].push(item.toJSON());
1670
1681
  }
1671
1682
  }
1683
+ data["randomEffects"] = this.randomEffects ? this.randomEffects.toJSON() : undefined;
1672
1684
  return data;
1673
1685
  };
1674
1686
  return BnsItemDto;
@@ -1946,6 +1958,37 @@ var ItemDescriptionDto = /** @class */ (function () {
1946
1958
  };
1947
1959
  return ItemDescriptionDto;
1948
1960
  }());
1961
+ var ItemEffectDto = /** @class */ (function () {
1962
+ function ItemEffectDto(data) {
1963
+ if (data) {
1964
+ for (var property in data) {
1965
+ if (data.hasOwnProperty(property))
1966
+ this[property] = data[property];
1967
+ }
1968
+ }
1969
+ }
1970
+ ItemEffectDto.prototype.init = function (_data) {
1971
+ if (_data) {
1972
+ this.id = _data["id"];
1973
+ this.text = _data["text"];
1974
+ this.weight = _data["weight"];
1975
+ }
1976
+ };
1977
+ ItemEffectDto.fromJS = function (data) {
1978
+ data = typeof data === 'object' ? data : {};
1979
+ var result = new ItemEffectDto();
1980
+ result.init(data);
1981
+ return result;
1982
+ };
1983
+ ItemEffectDto.prototype.toJSON = function (data) {
1984
+ data = typeof data === 'object' ? data : {};
1985
+ data["id"] = this.id;
1986
+ data["text"] = this.text;
1987
+ data["weight"] = this.weight;
1988
+ return data;
1989
+ };
1990
+ return ItemEffectDto;
1991
+ }());
1949
1992
  var ItemIconDto = /** @class */ (function () {
1950
1993
  function ItemIconDto(data) {
1951
1994
  if (data) {
@@ -2163,6 +2206,53 @@ var ItemImproveEffectOptionWithNameDto = /** @class */ (function () {
2163
2206
  };
2164
2207
  return ItemImproveEffectOptionWithNameDto;
2165
2208
  }());
2209
+ var ItemRandomEffectsDto = /** @class */ (function () {
2210
+ function ItemRandomEffectsDto(data) {
2211
+ if (data) {
2212
+ for (var property in data) {
2213
+ if (data.hasOwnProperty(property))
2214
+ this[property] = data[property];
2215
+ }
2216
+ }
2217
+ }
2218
+ ItemRandomEffectsDto.prototype.init = function (_data) {
2219
+ if (_data) {
2220
+ this.alias = _data["alias"];
2221
+ this.randomEffectCount = _data["randomEffectCount"];
2222
+ this.totalWeight = _data["totalWeight"];
2223
+ this.itemSkillName = _data["itemSkillName"];
2224
+ if (Array.isArray(_data["randomEffects"])) {
2225
+ this.randomEffects = [];
2226
+ for (var _i = 0, _a = _data["randomEffects"]; _i < _a.length; _i++) {
2227
+ var item = _a[_i];
2228
+ this.randomEffects.push(ItemEffectDto.fromJS(item));
2229
+ }
2230
+ }
2231
+ }
2232
+ };
2233
+ ItemRandomEffectsDto.fromJS = function (data) {
2234
+ data = typeof data === 'object' ? data : {};
2235
+ var result = new ItemRandomEffectsDto();
2236
+ result.init(data);
2237
+ return result;
2238
+ };
2239
+ ItemRandomEffectsDto.prototype.toJSON = function (data) {
2240
+ data = typeof data === 'object' ? data : {};
2241
+ data["alias"] = this.alias;
2242
+ data["randomEffectCount"] = this.randomEffectCount;
2243
+ data["totalWeight"] = this.totalWeight;
2244
+ data["itemSkillName"] = this.itemSkillName;
2245
+ if (Array.isArray(this.randomEffects)) {
2246
+ data["randomEffects"] = [];
2247
+ for (var _i = 0, _a = this.randomEffects; _i < _a.length; _i++) {
2248
+ var item = _a[_i];
2249
+ data["randomEffects"].push(item.toJSON());
2250
+ }
2251
+ }
2252
+ return data;
2253
+ };
2254
+ return ItemRandomEffectsDto;
2255
+ }());
2166
2256
  var ItemRandomStatDto = /** @class */ (function () {
2167
2257
  function ItemRandomStatDto(data) {
2168
2258
  if (data) {
@@ -8165,10 +8255,13 @@ function ItemUpgradeEffects(props) {
8165
8255
 
8166
8256
  function ItemTooltip(_a) {
8167
8257
  var _this = this;
8168
- var _b, _c, _d;
8169
- var data = _a.data, region = _a.region, _e = _a.debug, debug = _e === void 0 ? false : _e, _f = _a.offline, offline = _f === void 0 ? false : _f, clientProp = _a.client, jobstyleOverride = _a.jobstyleOverride, _g = _a.showUpgrade, showUpgrade = _g === void 0 ? false : _g, _h = _a.showUpgradeEffects, showUpgradeEffects = _h === void 0 ? false : _h, _j = _a.fullHeight, fullHeight = _j === void 0 ? false : _j;
8170
- var _k = useState("advanced-1"), jobstyle = _k[0], setJobstyle = _k[1];
8171
- var _l = useState(), client = _l[0], setClient = _l[1];
8258
+ var data = _a.data, region = _a.region, _b = _a.debug, debug = _b === void 0 ? false : _b, _c = _a.offline, offline = _c === void 0 ? false : _c, clientProp = _a.client, jobstyleOverride = _a.jobstyleOverride, _d = _a.showUpgrade, showUpgrade = _d === void 0 ? false : _d, _e = _a.showUpgradeEffects, showUpgradeEffects = _e === void 0 ? false : _e, _f = _a.fullHeight, fullHeight = _f === void 0 ? false : _f;
8259
+ var _g = useState("advanced-1"), jobstyle = _g[0], setJobstyle = _g[1];
8260
+ var _h = useState(), client = _h[0], setClient = _h[1];
8261
+ var _j = useState(false), setHasSkillModifiers = _j[0], setSetHasSkillModifiers = _j[1];
8262
+ var _k = useState([]), jobstyles = _k[0], setJobstyles = _k[1];
8263
+ var _l = useState(false), itemCombats = _l[0], setItemCombats = _l[1];
8264
+ var item = data;
8172
8265
  useEffect(function () {
8173
8266
  if (offline && !showUpgradeEffects)
8174
8267
  return;
@@ -8189,46 +8282,35 @@ function ItemTooltip(_a) {
8189
8282
  setJobstyle(jobstyleOverride);
8190
8283
  }
8191
8284
  }, [jobstyleOverride]);
8192
- var item = data;
8193
- var itemCategory = (_c = (_b = item.categories) === null || _b === void 0 ? void 0 : _b.sort(function (a, b) { return b.index - a.index; })[0].localizedName) !== null && _c !== void 0 ? _c : "";
8194
- if (itemCategory == "none")
8195
- itemCategory = "";
8285
+ useEffect(function () {
8286
+ var _a, _b, _c, _d, _e, _f, _g;
8287
+ var setHasSkillModifiers_i = ((_a = item.skills) === null || _a === void 0 ? void 0 : _a.some(function (skill) { return skill.jobstyle != null; })) || ((_c = (_b = item.setBonus) === null || _b === void 0 ? void 0 : _b.setBonusStages) === null || _c === void 0 ? void 0 : _c.some(function (stage) { var _a; return ((_a = stage.skillModifiers) === null || _a === void 0 ? void 0 : _a.length) > 0; })) || false;
8288
+ var jobstyles_i = Array.from(new Set(__spreadArray(__spreadArray([], (((_d = item.skills) === null || _d === void 0 ? void 0 : _d.map(function (skill) { return skill.jobstyle; })) || []), true), (((_f = (_e = item.setBonus) === null || _e === void 0 ? void 0 : _e.setBonusStages) === null || _f === void 0 ? void 0 : _f.flatMap(function (stage) { var _a; return ((_a = stage.skillModifiers) === null || _a === void 0 ? void 0 : _a.map(function (modifier) { return modifier.jobstyle; })) || []; })) || []), true).filter(Boolean)));
8289
+ var itemCombats_i = ((_g = item.skills) === null || _g === void 0 ? void 0 : _g.some(function (skill) { return skill.jobstyle != null; })) || false;
8290
+ setSetHasSkillModifiers(setHasSkillModifiers_i);
8291
+ setJobstyles(jobstyles_i);
8292
+ setItemCombats(itemCombats_i);
8293
+ }, [item]);
8294
+ useEffect(function () {
8295
+ if (jobstyles.length > 0 && !jobstyles.includes(jobstyle)) {
8296
+ setJobstyle(jobstyles[0]);
8297
+ }
8298
+ }, [jobstyle, jobstyles]);
8299
+ var itemCategory = useMemo(function () {
8300
+ var _a, _b, _c;
8301
+ var category = (_c = (_b = (_a = item.categories) === null || _a === void 0 ? void 0 : _a.sort(function (a, b) { return b.index - a.index; })[0]) === null || _b === void 0 ? void 0 : _b.localizedName) !== null && _c !== void 0 ? _c : "";
8302
+ return category === "none" ? "" : category;
8303
+ }, [item]);
8196
8304
  var tooltipBaseProps = {
8197
8305
  title: item.name,
8198
8306
  grade: item.grade,
8199
- id: item.id + "-" + item.level,
8307
+ id: "".concat(item.id, "-").concat(item.level),
8200
8308
  icon: item.icon ? BuildIconPath(item.icon.iconPath) : "",
8201
8309
  subtitle: itemCategory,
8202
8310
  mainInfos: [],
8203
8311
  subInfoGroups: [],
8204
8312
  fullHeight: fullHeight,
8205
8313
  };
8206
- var setHasSkillModifiers = false;
8207
- var jobstyles = [];
8208
- var itemCombats = false;
8209
- if (item.skills != null && item.skills.length > 0) {
8210
- item.skills.forEach(function (itemSkill) {
8211
- if (itemSkill.jobstyle != null) {
8212
- setHasSkillModifiers = true;
8213
- itemCombats = true;
8214
- if (!jobstyles.includes(itemSkill.jobstyle)) {
8215
- jobstyles.push(itemSkill.jobstyle);
8216
- }
8217
- }
8218
- });
8219
- }
8220
- if (((_d = item.setBonus) === null || _d === void 0 ? void 0 : _d.setBonusStages) != null) {
8221
- item.setBonus.setBonusStages.forEach(function (stage) {
8222
- if (stage.skillModifiers != null && stage.skillModifiers.length > 0) {
8223
- setHasSkillModifiers = true;
8224
- stage.skillModifiers.forEach(function (modifier) {
8225
- if (!jobstyles.includes(modifier.jobstyle)) {
8226
- jobstyles.push(modifier.jobstyle);
8227
- }
8228
- });
8229
- }
8230
- });
8231
- }
8232
8314
  //top part
8233
8315
  AddMainInfo(tooltipBaseProps.mainInfos, item);
8234
8316
  AddSubInfo(tooltipBaseProps.mainInfos, item);
@@ -8238,8 +8320,11 @@ function ItemTooltip(_a) {
8238
8320
  AddItemRandomStats(tooltipBaseProps.mainInfos, item);
8239
8321
  //bottom part
8240
8322
  AddGearScore(tooltipBaseProps.subInfoGroups, item, debug);
8241
- AddJobstyleToggles(setHasSkillModifiers, tooltipBaseProps.subInfoGroups, jobstyles, jobstyle, setJobstyle);
8323
+ if (jobstyles.length > 1) {
8324
+ AddJobstyleToggles(setHasSkillModifiers, tooltipBaseProps.subInfoGroups, jobstyles, jobstyle, setJobstyle);
8325
+ }
8242
8326
  AddTopText(tooltipBaseProps.subInfoGroups, item);
8327
+ AddRandomEffects(tooltipBaseProps.subInfoGroups, item);
8243
8328
  AddSkillDescriptions(tooltipBaseProps.subInfoGroups, item, itemCombats, jobstyle);
8244
8329
  AddSkillModifiers(tooltipBaseProps.subInfoGroups, item, false, jobstyle);
8245
8330
  AddEtchingStones(tooltipBaseProps.subInfoGroups, item);
@@ -8313,6 +8398,18 @@ function AddTopText(subInfoGroups, item) {
8313
8398
  texts: [React.createElement(TopText, __assign({}, item))],
8314
8399
  });
8315
8400
  }
8401
+ function AddRandomEffects(subInfoGroups, item) {
8402
+ if (item.randomEffects == null || item.randomEffects.randomEffectCount == 0 || item.randomEffects.randomEffects == null || item.randomEffects.randomEffects.length == 0)
8403
+ return;
8404
+ subInfoGroups.push({
8405
+ title: "",
8406
+ texts: [
8407
+ React.createElement("div", null,
8408
+ React.createElement("div", { id: item.randomEffects.alias, dangerouslySetInnerHTML: { __html: item.randomEffects.itemSkillName } }),
8409
+ item.randomEffects.randomEffects.map(function (effect) { return (React.createElement("div", { key: item.randomEffects.alias + "_" + effect.id, dangerouslySetInnerHTML: { __html: effect.text } })); }))
8410
+ ]
8411
+ });
8412
+ }
8316
8413
  function AddSkillDescriptions(subInfoGroups, item, itemCombats, jobstyle) {
8317
8414
  if (item.skills == null || item.skills.length == 0)
8318
8415
  return;
@@ -8342,6 +8439,14 @@ function AddRandomSubStatCount(subInfoGroups, item) {
8342
8439
  React.createElement("span", { className: "00008130.UI.Label_Green03_12" }, item.randomSubStatCount),
8343
8440
  "\u00A0random secondary stat(s).")]
8344
8441
  });
8442
+ if (item.randomEffects != null && item.randomEffects.randomEffects.length > 1)
8443
+ subInfoGroups.push({
8444
+ title: "Random effects:",
8445
+ texts: [React.createElement("div", { className: "00008130.UI.Vital_LightBlue" },
8446
+ "This item has\u00A0",
8447
+ React.createElement("span", { className: "00008130.UI.Label_Green03_12" }, item.randomEffects.randomEffectCount),
8448
+ "\u00A0random effect(s).")]
8449
+ });
8345
8450
  }
8346
8451
  function AddSetBonus(subInfoGroups, item, jobstyle) {
8347
8452
  if (item.setBonus == null)