@rpg-engine/long-bow 0.2.28 → 0.2.29

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.
@@ -21,26 +21,21 @@ function _extends() {
21
21
  _extends = Object.assign ? Object.assign.bind() : function (target) {
22
22
  for (var i = 1; i < arguments.length; i++) {
23
23
  var source = arguments[i];
24
-
25
24
  for (var key in source) {
26
25
  if (Object.prototype.hasOwnProperty.call(source, key)) {
27
26
  target[key] = source[key];
28
27
  }
29
28
  }
30
29
  }
31
-
32
30
  return target;
33
31
  };
34
32
  return _extends.apply(this, arguments);
35
33
  }
36
-
37
34
  function _inheritsLoose(subClass, superClass) {
38
35
  subClass.prototype = Object.create(superClass.prototype);
39
36
  subClass.prototype.constructor = subClass;
40
-
41
37
  _setPrototypeOf(subClass, superClass);
42
38
  }
43
-
44
39
  function _setPrototypeOf(o, p) {
45
40
  _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
46
41
  o.__proto__ = p;
@@ -48,36 +43,33 @@ function _setPrototypeOf(o, p) {
48
43
  };
49
44
  return _setPrototypeOf(o, p);
50
45
  }
51
-
46
+ function _objectDestructuringEmpty(obj) {
47
+ if (obj == null) throw new TypeError("Cannot destructure " + obj);
48
+ }
52
49
  function _objectWithoutPropertiesLoose(source, excluded) {
53
50
  if (source == null) return {};
54
51
  var target = {};
55
52
  var sourceKeys = Object.keys(source);
56
53
  var key, i;
57
-
58
54
  for (i = 0; i < sourceKeys.length; i++) {
59
55
  key = sourceKeys[i];
60
56
  if (excluded.indexOf(key) >= 0) continue;
61
57
  target[key] = source[key];
62
58
  }
63
-
64
59
  return target;
65
60
  }
66
61
 
67
62
  var _excluded = ["disabled", "children", "buttonType"];
68
-
69
63
  (function (ButtonTypes) {
70
64
  ButtonTypes["RPGUIButton"] = "rpgui-button";
71
65
  ButtonTypes["RPGUIGoldButton"] = "rpgui-button golden";
72
66
  })(exports.ButtonTypes || (exports.ButtonTypes = {}));
73
-
74
67
  var Button = function Button(_ref) {
75
68
  var _ref$disabled = _ref.disabled,
76
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
77
- children = _ref.children,
78
- buttonType = _ref.buttonType,
79
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
80
-
69
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
70
+ children = _ref.children,
71
+ buttonType = _ref.buttonType,
72
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
81
73
  return React__default.createElement(ButtonContainer, Object.assign({
82
74
  className: "" + buttonType,
83
75
  disabled: disabled
@@ -90,21 +82,21 @@ var ButtonContainer = /*#__PURE__*/styled.button.withConfig({
90
82
 
91
83
  var SpriteFromAtlas = function SpriteFromAtlas(_ref) {
92
84
  var atlasJSON = _ref.atlasJSON,
93
- atlasIMG = _ref.atlasIMG,
94
- spriteKey = _ref.spriteKey,
95
- _ref$width = _ref.width,
96
- width = _ref$width === void 0 ? shared.GRID_WIDTH : _ref$width,
97
- _ref$height = _ref.height,
98
- height = _ref$height === void 0 ? shared.GRID_HEIGHT : _ref$height,
99
- _ref$imgScale = _ref.imgScale,
100
- imgScale = _ref$imgScale === void 0 ? 2 : _ref$imgScale,
101
- imgStyle = _ref.imgStyle,
102
- onClick = _ref.onClick,
103
- containerStyle = _ref.containerStyle,
104
- _ref$grayScale = _ref.grayScale,
105
- grayScale = _ref$grayScale === void 0 ? false : _ref$grayScale,
106
- _ref$opacity = _ref.opacity,
107
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity;
85
+ atlasIMG = _ref.atlasIMG,
86
+ spriteKey = _ref.spriteKey,
87
+ _ref$width = _ref.width,
88
+ width = _ref$width === void 0 ? shared.GRID_WIDTH : _ref$width,
89
+ _ref$height = _ref.height,
90
+ height = _ref$height === void 0 ? shared.GRID_HEIGHT : _ref$height,
91
+ _ref$imgScale = _ref.imgScale,
92
+ imgScale = _ref$imgScale === void 0 ? 2 : _ref$imgScale,
93
+ imgStyle = _ref.imgStyle,
94
+ onClick = _ref.onClick,
95
+ containerStyle = _ref.containerStyle,
96
+ _ref$grayScale = _ref.grayScale,
97
+ grayScale = _ref$grayScale === void 0 ? false : _ref$grayScale,
98
+ _ref$opacity = _ref.opacity,
99
+ opacity = _ref$opacity === void 0 ? 1 : _ref$opacity;
108
100
  //! If an item is not showing, remember that you MUST run yarn atlas:copy everytime you add a new item to the atlas (it will sync our public folder atlas with src/atlas).
109
101
  //!Due to React's limitations, we cannot import it from the public folder directly!
110
102
  var spriteData = atlasJSON.frames[spriteKey];
@@ -27261,34 +27253,27 @@ var img$1 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAFACAMAAAD6TlWYA
27261
27253
 
27262
27254
  var ErrorBoundary = /*#__PURE__*/function (_Component) {
27263
27255
  _inheritsLoose(ErrorBoundary, _Component);
27264
-
27265
27256
  function ErrorBoundary() {
27266
27257
  var _this;
27267
-
27268
27258
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27269
27259
  args[_key] = arguments[_key];
27270
27260
  }
27271
-
27272
27261
  _this = _Component.call.apply(_Component, [this].concat(args)) || this;
27273
27262
  _this.state = {
27274
27263
  hasError: false
27275
27264
  };
27276
27265
  return _this;
27277
27266
  }
27278
-
27279
27267
  ErrorBoundary.getDerivedStateFromError = function getDerivedStateFromError(_) {
27280
27268
  // Update state so the next render will show the fallback UI.
27281
27269
  return {
27282
27270
  hasError: true
27283
27271
  };
27284
27272
  };
27285
-
27286
27273
  var _proto = ErrorBoundary.prototype;
27287
-
27288
27274
  _proto.componentDidCatch = function componentDidCatch(error, errorInfo) {
27289
27275
  console.error('Uncaught error:', error, errorInfo);
27290
27276
  };
27291
-
27292
27277
  _proto.render = function render() {
27293
27278
  if (this.state.hasError) {
27294
27279
  return React__default.createElement(SpriteFromAtlas, {
@@ -27298,16 +27283,14 @@ var ErrorBoundary = /*#__PURE__*/function (_Component) {
27298
27283
  imgScale: 3
27299
27284
  });
27300
27285
  }
27301
-
27302
27286
  return this.props.children;
27303
27287
  };
27304
-
27305
27288
  return ErrorBoundary;
27306
27289
  }(React.Component);
27307
27290
 
27308
27291
  var Ellipsis = function Ellipsis(_ref) {
27309
27292
  var children = _ref.children,
27310
- maxLines = _ref.maxLines;
27293
+ maxLines = _ref.maxLines;
27311
27294
  return React__default.createElement(Container$1, null, React__default.createElement("div", {
27312
27295
  className: "ellipsis-" + maxLines + "-lines"
27313
27296
  }, children));
@@ -27327,43 +27310,34 @@ var img$5 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0A
27327
27310
 
27328
27311
  var PropertySelect = function PropertySelect(_ref) {
27329
27312
  var availableProperties = _ref.availableProperties,
27330
- onChange = _ref.onChange;
27331
-
27313
+ onChange = _ref.onChange;
27332
27314
  var _useState = React.useState(0),
27333
- currentIndex = _useState[0],
27334
- setCurrentIndex = _useState[1];
27335
-
27315
+ currentIndex = _useState[0],
27316
+ setCurrentIndex = _useState[1];
27336
27317
  var propertiesLength = availableProperties.length - 1;
27337
-
27338
27318
  var onLeftClick = function onLeftClick() {
27339
27319
  if (currentIndex === 0) setCurrentIndex(propertiesLength);else setCurrentIndex(function (index) {
27340
27320
  return index - 1;
27341
27321
  });
27342
27322
  };
27343
-
27344
27323
  var onRightClick = function onRightClick() {
27345
27324
  if (currentIndex === propertiesLength) setCurrentIndex(0);else setCurrentIndex(function (index) {
27346
27325
  return index + 1;
27347
27326
  });
27348
27327
  };
27349
-
27350
27328
  React.useEffect(function () {
27351
27329
  onChange(availableProperties[currentIndex]);
27352
27330
  }, [currentIndex]);
27353
27331
  React.useEffect(function () {
27354
27332
  setCurrentIndex(0);
27355
27333
  }, [JSON.stringify(availableProperties)]);
27356
-
27357
27334
  var getCurrentSelectionName = function getCurrentSelectionName() {
27358
27335
  var item = availableProperties[currentIndex];
27359
-
27360
27336
  if (item) {
27361
27337
  return item.name;
27362
27338
  }
27363
-
27364
27339
  return '';
27365
27340
  };
27366
-
27367
27341
  return React__default.createElement(Container$2, null, React__default.createElement(TextOverlay, null, React__default.createElement(Item, null, React__default.createElement(Ellipsis, {
27368
27342
  maxLines: 1
27369
27343
  }, getCurrentSelectionName()))), React__default.createElement("div", {
@@ -27399,34 +27373,28 @@ var RightArrow = /*#__PURE__*/styled.div.withConfig({
27399
27373
 
27400
27374
  var CharacterSelection = function CharacterSelection(_ref) {
27401
27375
  var availableCharacters = _ref.availableCharacters,
27402
- onChange = _ref.onChange;
27376
+ onChange = _ref.onChange;
27403
27377
  var propertySelectValues = availableCharacters.map(function (item) {
27404
27378
  return {
27405
27379
  id: item.textureKey,
27406
27380
  name: item.name
27407
27381
  };
27408
27382
  });
27409
-
27410
27383
  var _useState = React.useState(),
27411
- selectedValue = _useState[0],
27412
- setSelectedValue = _useState[1];
27413
-
27384
+ selectedValue = _useState[0],
27385
+ setSelectedValue = _useState[1];
27414
27386
  var _useState2 = React.useState(''),
27415
- selectedSpriteKey = _useState2[0],
27416
- setSelectedSpriteKey = _useState2[1];
27417
-
27387
+ selectedSpriteKey = _useState2[0],
27388
+ setSelectedSpriteKey = _useState2[1];
27418
27389
  var onSelectedValueChange = function onSelectedValueChange() {
27419
27390
  var textureKey = selectedValue ? selectedValue.id : '';
27420
27391
  var spriteKey = textureKey ? textureKey + '/down/standing/0.png' : '';
27421
-
27422
27392
  if (spriteKey === selectedSpriteKey) {
27423
27393
  return;
27424
27394
  }
27425
-
27426
27395
  setSelectedSpriteKey(spriteKey);
27427
27396
  onChange(textureKey);
27428
27397
  };
27429
-
27430
27398
  React.useEffect(function () {
27431
27399
  onSelectedValueChange();
27432
27400
  }, [selectedValue]);
@@ -27472,8 +27440,7 @@ var colors = {
27472
27440
  };
27473
27441
 
27474
27442
  var Input = function Input(_ref) {
27475
- var props = _extends({}, _ref);
27476
-
27443
+ var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
27477
27444
  return React__default.createElement("input", Object.assign({}, props));
27478
27445
  };
27479
27446
 
@@ -27483,14 +27450,13 @@ var Input = function Input(_ref) {
27483
27450
  RPGUIContainerTypes["FramedGold2"] = "framed-golden-2";
27484
27451
  RPGUIContainerTypes["FramedGrey"] = "framed-grey";
27485
27452
  })(exports.RPGUIContainerTypes || (exports.RPGUIContainerTypes = {}));
27486
-
27487
27453
  var RPGUIContainer = function RPGUIContainer(_ref) {
27488
27454
  var children = _ref.children,
27489
- type = _ref.type,
27490
- _ref$width = _ref.width,
27491
- width = _ref$width === void 0 ? '50%' : _ref$width,
27492
- height = _ref.height,
27493
- className = _ref.className;
27455
+ type = _ref.type,
27456
+ _ref$width = _ref.width,
27457
+ width = _ref$width === void 0 ? '50%' : _ref$width,
27458
+ height = _ref.height,
27459
+ className = _ref.className;
27494
27460
  return React__default.createElement(Container$4, {
27495
27461
  width: width,
27496
27462
  height: height || 'auto',
@@ -27522,60 +27488,51 @@ var Column = /*#__PURE__*/styled.div.withConfig({
27522
27488
 
27523
27489
  var Chat = function Chat(_ref) {
27524
27490
  var chatMessages = _ref.chatMessages,
27525
- onSendChatMessage = _ref.onSendChatMessage,
27526
- _ref$opacity = _ref.opacity,
27527
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
27528
- _ref$width = _ref.width,
27529
- width = _ref$width === void 0 ? '100%' : _ref$width,
27530
- _ref$height = _ref.height,
27531
- height = _ref$height === void 0 ? '250px' : _ref$height,
27532
- onCloseButton = _ref.onCloseButton;
27533
-
27491
+ onSendChatMessage = _ref.onSendChatMessage,
27492
+ _ref$opacity = _ref.opacity,
27493
+ opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
27494
+ _ref$width = _ref.width,
27495
+ width = _ref$width === void 0 ? '100%' : _ref$width,
27496
+ _ref$height = _ref.height,
27497
+ height = _ref$height === void 0 ? '250px' : _ref$height,
27498
+ onCloseButton = _ref.onCloseButton;
27534
27499
  var _useState = React.useState(''),
27535
- message = _useState[0],
27536
- setMessage = _useState[1];
27537
-
27500
+ message = _useState[0],
27501
+ setMessage = _useState[1];
27538
27502
  React.useEffect(function () {
27539
27503
  scrollChatToBottom();
27540
27504
  }, []);
27541
27505
  React.useEffect(function () {
27542
27506
  scrollChatToBottom();
27543
27507
  }, [chatMessages]);
27544
-
27545
27508
  var scrollChatToBottom = function scrollChatToBottom() {
27546
27509
  var scrollingElement = document.querySelector('.chat-body');
27547
-
27548
27510
  if (scrollingElement) {
27549
27511
  scrollingElement.scrollTop = scrollingElement.scrollHeight;
27550
27512
  }
27551
27513
  };
27552
-
27553
27514
  var handleSubmit = function handleSubmit(event) {
27554
27515
  event.preventDefault();
27555
27516
  onSendChatMessage(message);
27556
27517
  setMessage('');
27557
27518
  };
27558
-
27559
27519
  var getInputValue = function getInputValue(value) {
27560
27520
  setMessage(value);
27561
27521
  };
27562
-
27563
27522
  var onRenderMessageLines = function onRenderMessageLines(emitter, createdAt, message) {
27564
27523
  return dayjs(createdAt || new Date()).format('HH:mm') + " " + (emitter != null && emitter.name ? emitter.name + ": " : 'Unknown: ') + " " + message;
27565
27524
  };
27566
-
27567
27525
  var onRenderChatMessages = function onRenderChatMessages(chatMessages) {
27568
27526
  return chatMessages != null && chatMessages.length ? chatMessages == null ? void 0 : chatMessages.map(function (_ref2, index) {
27569
27527
  var _id = _ref2._id,
27570
- createdAt = _ref2.createdAt,
27571
- emitter = _ref2.emitter,
27572
- message = _ref2.message;
27528
+ createdAt = _ref2.createdAt,
27529
+ emitter = _ref2.emitter,
27530
+ message = _ref2.message;
27573
27531
  return React__default.createElement(MessageText, {
27574
27532
  key: _id + "_" + index
27575
27533
  }, onRenderMessageLines(emitter, createdAt, message));
27576
27534
  }) : React__default.createElement(MessageText, null, "No messages available.");
27577
27535
  };
27578
-
27579
27536
  return React__default.createElement(Container$5, null, React__default.createElement(CustomContainer, {
27580
27537
  type: exports.RPGUIContainerTypes.FramedGrey,
27581
27538
  width: width,
@@ -27642,8 +27599,7 @@ var MessageText = /*#__PURE__*/styled.p.withConfig({
27642
27599
 
27643
27600
  var CheckButton = function CheckButton(_ref) {
27644
27601
  var items = _ref.items,
27645
- onChange = _ref.onChange;
27646
-
27602
+ onChange = _ref.onChange;
27647
27603
  var generateSelectedValuesList = function generateSelectedValuesList() {
27648
27604
  var selectedValues = {};
27649
27605
  items.forEach(function (item) {
@@ -27651,17 +27607,13 @@ var CheckButton = function CheckButton(_ref) {
27651
27607
  });
27652
27608
  return selectedValues;
27653
27609
  };
27654
-
27655
27610
  var _useState = React.useState(generateSelectedValuesList()),
27656
- selectedValues = _useState[0],
27657
- setSelectedValues = _useState[1];
27658
-
27611
+ selectedValues = _useState[0],
27612
+ setSelectedValues = _useState[1];
27659
27613
  var handleClick = function handleClick(label) {
27660
27614
  var _extends2;
27661
-
27662
27615
  setSelectedValues(_extends({}, selectedValues, (_extends2 = {}, _extends2[label] = !selectedValues[label], _extends2)));
27663
27616
  };
27664
-
27665
27617
  React.useEffect(function () {
27666
27618
  if (selectedValues) {
27667
27619
  onChange(selectedValues);
@@ -27697,12 +27649,10 @@ function useOutsideClick(ref, id) {
27697
27649
  id: id
27698
27650
  }
27699
27651
  });
27700
-
27701
27652
  document.dispatchEvent(_event);
27702
27653
  }
27703
- } // Bind the event listener
27704
-
27705
-
27654
+ }
27655
+ // Bind the event listener
27706
27656
  document.addEventListener('mousedown', handleClickOutside);
27707
27657
  return function () {
27708
27658
  // Unbind the event listener on clean up
@@ -27713,26 +27663,25 @@ function useOutsideClick(ref, id) {
27713
27663
 
27714
27664
  var DraggableContainer = function DraggableContainer(_ref) {
27715
27665
  var children = _ref.children,
27716
- _ref$width = _ref.width,
27717
- width = _ref$width === void 0 ? '50%' : _ref$width,
27718
- height = _ref.height,
27719
- className = _ref.className,
27720
- _ref$type = _ref.type,
27721
- type = _ref$type === void 0 ? exports.RPGUIContainerTypes.FramedGold : _ref$type,
27722
- onCloseButton = _ref.onCloseButton,
27723
- title = _ref.title,
27724
- imgSrc = _ref.imgSrc,
27725
- _ref$imgWidth = _ref.imgWidth,
27726
- imgWidth = _ref$imgWidth === void 0 ? '20px' : _ref$imgWidth,
27727
- cancelDrag = _ref.cancelDrag,
27728
- onPositionChange = _ref.onPositionChange,
27729
- onOutsideClick = _ref.onOutsideClick;
27666
+ _ref$width = _ref.width,
27667
+ width = _ref$width === void 0 ? '50%' : _ref$width,
27668
+ height = _ref.height,
27669
+ className = _ref.className,
27670
+ _ref$type = _ref.type,
27671
+ type = _ref$type === void 0 ? exports.RPGUIContainerTypes.FramedGold : _ref$type,
27672
+ onCloseButton = _ref.onCloseButton,
27673
+ title = _ref.title,
27674
+ imgSrc = _ref.imgSrc,
27675
+ _ref$imgWidth = _ref.imgWidth,
27676
+ imgWidth = _ref$imgWidth === void 0 ? '20px' : _ref$imgWidth,
27677
+ cancelDrag = _ref.cancelDrag,
27678
+ onPositionChange = _ref.onPositionChange,
27679
+ onOutsideClick = _ref.onOutsideClick;
27730
27680
  var draggableRef = React.useRef(null);
27731
27681
  useOutsideClick(draggableRef, 'item-container');
27732
27682
  React.useEffect(function () {
27733
27683
  document.addEventListener('clickOutside', function (event) {
27734
27684
  var e = event;
27735
-
27736
27685
  if (e.detail.id === 'item-container') {
27737
27686
  if (onOutsideClick) {
27738
27687
  onOutsideClick();
@@ -27797,6 +27746,7 @@ var Icon = /*#__PURE__*/styled.img.withConfig({
27797
27746
  return props.width;
27798
27747
  });
27799
27748
 
27749
+ //@ts-ignore
27800
27750
  var _RPGUI = RPGUI;
27801
27751
  var RPGUIRoot = function RPGUIRoot(_ref) {
27802
27752
  var children = _ref.children;
@@ -27807,19 +27757,15 @@ var RPGUIRoot = function RPGUIRoot(_ref) {
27807
27757
 
27808
27758
  var Dropdown = function Dropdown(_ref) {
27809
27759
  var options = _ref.options,
27810
- width = _ref.width,
27811
- onChange = _ref.onChange;
27760
+ width = _ref.width,
27761
+ onChange = _ref.onChange;
27812
27762
  var dropdownId = uuid.v4();
27813
-
27814
27763
  var _useState = React.useState(''),
27815
- selectedValue = _useState[0],
27816
- setSelectedValue = _useState[1];
27817
-
27764
+ selectedValue = _useState[0],
27765
+ setSelectedValue = _useState[1];
27818
27766
  React.useEffect(function () {
27819
27767
  var element = document.getElementById("rpgui-dropdown-" + dropdownId);
27820
-
27821
27768
  var dropdownValue = _RPGUI.get_value(element);
27822
-
27823
27769
  setSelectedValue(dropdownValue);
27824
27770
  element == null ? void 0 : element.addEventListener('change', function (event) {
27825
27771
  setSelectedValue(event == null ? void 0 : event.target.value);
@@ -27846,16 +27792,15 @@ var Dropdown = function Dropdown(_ref) {
27846
27792
 
27847
27793
  var RelativeListMenu = function RelativeListMenu(_ref) {
27848
27794
  var options = _ref.options,
27849
- onSelected = _ref.onSelected,
27850
- onOutsideClick = _ref.onOutsideClick,
27851
- _ref$fontSize = _ref.fontSize,
27852
- fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize;
27795
+ onSelected = _ref.onSelected,
27796
+ onOutsideClick = _ref.onOutsideClick,
27797
+ _ref$fontSize = _ref.fontSize,
27798
+ fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize;
27853
27799
  var ref = React.useRef(null);
27854
27800
  useOutsideClick(ref, 'relative-context-menu');
27855
27801
  React.useEffect(function () {
27856
27802
  document.addEventListener('clickOutside', function (event) {
27857
27803
  var e = event;
27858
-
27859
27804
  if (e.detail.id === 'relative-context-menu') {
27860
27805
  if (onOutsideClick) {
27861
27806
  onOutsideClick();
@@ -27912,10 +27857,8 @@ var generateContextMenuListOptions = function generateContextMenuListOptions(act
27912
27857
  });
27913
27858
  return contextMenu;
27914
27859
  };
27915
-
27916
27860
  var generateContextMenu = function generateContextMenu(itemType, itemContainerType) {
27917
27861
  var contextActionMenu = [];
27918
-
27919
27862
  if (itemContainerType === shared.ItemContainerType.Inventory) {
27920
27863
  switch (itemType) {
27921
27864
  case shared.ItemType.Weapon:
@@ -27924,40 +27867,32 @@ var generateContextMenu = function generateContextMenu(itemType, itemContainerTy
27924
27867
  case shared.ItemType.Jewelry:
27925
27868
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForInventory.Equipment);
27926
27869
  break;
27927
-
27928
27870
  case shared.ItemType.Container:
27929
27871
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForInventory.Container);
27930
27872
  break;
27931
-
27932
27873
  case shared.ItemType.Consumable:
27933
27874
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForInventory.Consumable);
27934
27875
  break;
27935
-
27936
27876
  case shared.ItemType.CraftMaterial:
27937
27877
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForInventory.CraftMaterial);
27938
27878
  break;
27939
-
27940
27879
  case shared.ItemType.Tool:
27941
27880
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForInventory.Tool);
27942
27881
  break;
27943
-
27944
27882
  default:
27945
27883
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForInventory.Other);
27946
27884
  break;
27947
27885
  }
27948
27886
  }
27949
-
27950
27887
  if (itemContainerType === shared.ItemContainerType.Equipment) {
27951
27888
  switch (itemType) {
27952
27889
  case shared.ItemType.Container:
27953
27890
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForEquipmentSet.Container);
27954
27891
  break;
27955
-
27956
27892
  default:
27957
27893
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForEquipmentSet.Equipment);
27958
27894
  }
27959
27895
  }
27960
-
27961
27896
  if (itemContainerType === shared.ItemContainerType.Loot) {
27962
27897
  switch (itemType) {
27963
27898
  case shared.ItemType.Weapon:
@@ -27966,25 +27901,20 @@ var generateContextMenu = function generateContextMenu(itemType, itemContainerTy
27966
27901
  case shared.ItemType.Jewelry:
27967
27902
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForLoot.Equipment);
27968
27903
  break;
27969
-
27970
27904
  case shared.ItemType.Consumable:
27971
27905
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForLoot.Consumable);
27972
27906
  break;
27973
-
27974
27907
  case shared.ItemType.CraftMaterial:
27975
27908
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForLoot.CraftMaterial);
27976
27909
  break;
27977
-
27978
27910
  case shared.ItemType.Tool:
27979
27911
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForLoot.Tool);
27980
27912
  break;
27981
-
27982
27913
  default:
27983
27914
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForLoot.Other);
27984
27915
  break;
27985
27916
  }
27986
27917
  }
27987
-
27988
27918
  if (itemContainerType === shared.ItemContainerType.MapContainer) {
27989
27919
  switch (itemType) {
27990
27920
  case shared.ItemType.Weapon:
@@ -27993,25 +27923,20 @@ var generateContextMenu = function generateContextMenu(itemType, itemContainerTy
27993
27923
  case shared.ItemType.Jewelry:
27994
27924
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForMapContainer.Equipment);
27995
27925
  break;
27996
-
27997
27926
  case shared.ItemType.Consumable:
27998
27927
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForMapContainer.Consumable);
27999
27928
  break;
28000
-
28001
27929
  case shared.ItemType.CraftMaterial:
28002
27930
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForMapContainer.CraftMaterial);
28003
27931
  break;
28004
-
28005
27932
  case shared.ItemType.Tool:
28006
27933
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForMapContainer.Tool);
28007
27934
  break;
28008
-
28009
27935
  default:
28010
27936
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForMapContainer.Other);
28011
27937
  break;
28012
27938
  }
28013
27939
  }
28014
-
28015
27940
  return contextActionMenu;
28016
27941
  };
28017
27942
 
@@ -28029,39 +27954,33 @@ var EquipmentSlotSpriteByType = {
28029
27954
  };
28030
27955
  var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28031
27956
  var slotIndex = _ref.slotIndex,
28032
- item = _ref.item,
28033
- containerType = _ref.itemContainerType,
28034
- slotSpriteMask = _ref.slotSpriteMask,
28035
- _onMouseOver = _ref.onMouseOver,
28036
- _onMouseOut = _ref.onMouseOut,
28037
- _onClick = _ref.onClick,
28038
- _onSelected = _ref.onSelected,
28039
- atlasJSON = _ref.atlasJSON,
28040
- atlasIMG = _ref.atlasIMG;
28041
-
27957
+ item = _ref.item,
27958
+ containerType = _ref.itemContainerType,
27959
+ slotSpriteMask = _ref.slotSpriteMask,
27960
+ _onMouseOver = _ref.onMouseOver,
27961
+ _onMouseOut = _ref.onMouseOut,
27962
+ _onClick = _ref.onClick,
27963
+ _onSelected = _ref.onSelected,
27964
+ atlasJSON = _ref.atlasJSON,
27965
+ atlasIMG = _ref.atlasIMG;
28042
27966
  var _useState = React.useState(false),
28043
- isTooltipVisible = _useState[0],
28044
- setTooltipVisible = _useState[1];
28045
-
27967
+ isTooltipVisible = _useState[0],
27968
+ setTooltipVisible = _useState[1];
28046
27969
  var _useState2 = React.useState(false),
28047
- isContextMenuVisible = _useState2[0],
28048
- setIsContextMenuVisible = _useState2[1];
28049
-
27970
+ isContextMenuVisible = _useState2[0],
27971
+ setIsContextMenuVisible = _useState2[1];
28050
27972
  var _useState3 = React.useState([]),
28051
- contextActions = _useState3[0],
28052
- setContextActions = _useState3[1];
28053
-
27973
+ contextActions = _useState3[0],
27974
+ setContextActions = _useState3[1];
28054
27975
  React.useEffect(function () {
28055
27976
  if (item) {
28056
27977
  setContextActions(generateContextMenu(item.type, containerType));
28057
27978
  }
28058
27979
  }, [item]);
28059
-
28060
27980
  var getLeftPositionValue = function getLeftPositionValue(quantity) {
28061
27981
  if (quantity > 0 && quantity < 10) return '2.5rem';else if (quantity > 9 && quantity < 100) return '2.0rem';else if (quantity > 99) return '1rem';
28062
27982
  return '2.5rem';
28063
27983
  };
28064
-
28065
27984
  var getStackInfo = function getStackInfo(itemId, stackQty) {
28066
27985
  // if (itemToRender?.isStackable && itemToRender?.stackQty) {
28067
27986
  if (stackQty > 1) {
@@ -28070,17 +27989,15 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28070
27989
  key: "qty-" + itemId
28071
27990
  }, ' ', stackQty, ' ');
28072
27991
  }
28073
-
28074
27992
  return undefined;
28075
27993
  };
28076
-
28077
27994
  var renderItem = function renderItem(itemToRender) {
28078
27995
  var _itemToRender$_id, _itemToRender$stackQt;
28079
-
28080
27996
  var element = [];
28081
-
28082
27997
  if (itemToRender != null && itemToRender.texturePath) {
28083
- element.push(React__default.createElement(ErrorBoundary, null, React__default.createElement(SpriteFromAtlas, {
27998
+ element.push(React__default.createElement(ErrorBoundary, {
27999
+ key: itemToRender._id
28000
+ }, React__default.createElement(SpriteFromAtlas, {
28084
28001
  key: itemToRender._id,
28085
28002
  atlasIMG: atlasIMG,
28086
28003
  atlasJSON: atlasJSON,
@@ -28088,24 +28005,20 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28088
28005
  imgScale: 3
28089
28006
  })));
28090
28007
  }
28091
-
28092
28008
  var stackInfo = getStackInfo((_itemToRender$_id = itemToRender == null ? void 0 : itemToRender._id) != null ? _itemToRender$_id : '', (_itemToRender$stackQt = itemToRender == null ? void 0 : itemToRender.stackQty) != null ? _itemToRender$stackQt : 0);
28093
-
28094
28009
  if (stackInfo) {
28095
28010
  element.push(stackInfo);
28096
28011
  }
28097
-
28098
28012
  return element;
28099
28013
  };
28100
-
28101
28014
  var renderEquipment = function renderEquipment(itemToRender) {
28102
28015
  var _itemToRender$allowed;
28103
-
28104
28016
  if (itemToRender != null && itemToRender.texturePath && (_itemToRender$allowed = itemToRender.allowedEquipSlotType) != null && _itemToRender$allowed.includes(slotSpriteMask)) {
28105
28017
  var _itemToRender$_id2, _itemToRender$stackQt2;
28106
-
28107
28018
  var element = [];
28108
- element.push(React__default.createElement(ErrorBoundary, null, React__default.createElement(SpriteFromAtlas, {
28019
+ element.push(React__default.createElement(ErrorBoundary, {
28020
+ key: itemToRender._id
28021
+ }, React__default.createElement(SpriteFromAtlas, {
28109
28022
  key: itemToRender._id,
28110
28023
  atlasIMG: atlasIMG,
28111
28024
  atlasJSON: atlasJSON,
@@ -28113,14 +28026,15 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28113
28026
  imgScale: 3
28114
28027
  })));
28115
28028
  var stackInfo = getStackInfo((_itemToRender$_id2 = itemToRender == null ? void 0 : itemToRender._id) != null ? _itemToRender$_id2 : '', (_itemToRender$stackQt2 = itemToRender == null ? void 0 : itemToRender.stackQty) != null ? _itemToRender$stackQt2 : 0);
28116
-
28117
28029
  if (stackInfo) {
28118
28030
  element.push(stackInfo);
28119
28031
  }
28120
-
28121
28032
  return element;
28122
28033
  } else {
28123
- return React__default.createElement(ErrorBoundary, null, React__default.createElement(SpriteFromAtlas, {
28034
+ return React__default.createElement(ErrorBoundary, {
28035
+ key: uuid.v4()
28036
+ }, React__default.createElement(SpriteFromAtlas, {
28037
+ key: uuid.v4(),
28124
28038
  atlasIMG: atlasIMG,
28125
28039
  atlasJSON: atlasJSON,
28126
28040
  spriteKey: EquipmentSlotSpriteByType[slotSpriteMask],
@@ -28130,20 +28044,16 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28130
28044
  }));
28131
28045
  }
28132
28046
  };
28133
-
28134
28047
  var onRenderSlot = function onRenderSlot(itemToRender) {
28135
28048
  switch (containerType) {
28136
28049
  case shared.ItemContainerType.Equipment:
28137
28050
  return renderEquipment(itemToRender);
28138
-
28139
28051
  case shared.ItemContainerType.Inventory:
28140
28052
  return renderItem(itemToRender);
28141
-
28142
28053
  default:
28143
28054
  return renderItem(itemToRender);
28144
28055
  }
28145
28056
  };
28146
-
28147
28057
  return React__default.createElement(Container$9, {
28148
28058
  className: "rpgui-icon empty-slot",
28149
28059
  onMouseOver: function onMouseOver(event) {
@@ -28160,10 +28070,8 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28160
28070
  },
28161
28071
  onClick: function onClick() {
28162
28072
  setTooltipVisible(false);
28163
-
28164
28073
  if (item) {
28165
28074
  setIsContextMenuVisible(!isContextMenuVisible);
28166
-
28167
28075
  _onClick(item.type, containerType, item);
28168
28076
  }
28169
28077
  }
@@ -28171,7 +28079,6 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28171
28079
  options: contextActions,
28172
28080
  onSelected: function onSelected(optionId) {
28173
28081
  setIsContextMenuVisible(false);
28174
-
28175
28082
  if (item) {
28176
28083
  _onSelected(optionId, item);
28177
28084
  }
@@ -28196,31 +28103,29 @@ var ItemQty = /*#__PURE__*/styled.span.withConfig({
28196
28103
 
28197
28104
  var EquipmentSet = function EquipmentSet(_ref) {
28198
28105
  var equipmentSet = _ref.equipmentSet,
28199
- onClose = _ref.onClose,
28200
- _onMouseOver = _ref.onMouseOver,
28201
- _onSelected = _ref.onSelected,
28202
- onItemClick = _ref.onItemClick,
28203
- atlasIMG = _ref.atlasIMG,
28204
- atlasJSON = _ref.atlasJSON;
28106
+ onClose = _ref.onClose,
28107
+ _onMouseOver = _ref.onMouseOver,
28108
+ _onSelected = _ref.onSelected,
28109
+ onItemClick = _ref.onItemClick,
28110
+ atlasIMG = _ref.atlasIMG,
28111
+ atlasJSON = _ref.atlasJSON;
28205
28112
  var neck = equipmentSet.neck,
28206
- leftHand = equipmentSet.leftHand,
28207
- ring = equipmentSet.ring,
28208
- head = equipmentSet.head,
28209
- armor = equipmentSet.armor,
28210
- legs = equipmentSet.legs,
28211
- boot = equipmentSet.boot,
28212
- inventory = equipmentSet.inventory,
28213
- rightHand = equipmentSet.rightHand,
28214
- accessory = equipmentSet.accessory;
28113
+ leftHand = equipmentSet.leftHand,
28114
+ ring = equipmentSet.ring,
28115
+ head = equipmentSet.head,
28116
+ armor = equipmentSet.armor,
28117
+ legs = equipmentSet.legs,
28118
+ boot = equipmentSet.boot,
28119
+ inventory = equipmentSet.inventory,
28120
+ rightHand = equipmentSet.rightHand,
28121
+ accessory = equipmentSet.accessory;
28215
28122
  var equipmentData = [neck, leftHand, ring, head, armor, legs, boot, inventory, rightHand, accessory];
28216
28123
  var equipmentMaskSlots = [shared.ItemSlotType.Neck, shared.ItemSlotType.LeftHand, shared.ItemSlotType.Ring, shared.ItemSlotType.Head, shared.ItemSlotType.Torso, shared.ItemSlotType.Legs, shared.ItemSlotType.Feet, shared.ItemSlotType.Inventory, shared.ItemSlotType.RightHand, shared.ItemSlotType.Accessory];
28217
-
28218
28124
  var onRenderEquipmentSlotRange = function onRenderEquipmentSlotRange(start, end) {
28219
28125
  var equipmentRange = equipmentData.slice(start, end);
28220
28126
  var slotMaksRange = equipmentMaskSlots.slice(start, end);
28221
28127
  return equipmentRange.map(function (data, i) {
28222
28128
  var _ref2;
28223
-
28224
28129
  var item = data;
28225
28130
  var itemContainer = (_ref2 = item && item.itemContainer) != null ? _ref2 : null;
28226
28131
  return React__default.createElement(ItemSlot, {
@@ -28244,7 +28149,6 @@ var EquipmentSet = function EquipmentSet(_ref) {
28244
28149
  });
28245
28150
  });
28246
28151
  };
28247
-
28248
28152
  return React__default.createElement(DraggableContainer, {
28249
28153
  title: 'Equipments',
28250
28154
  type: exports.RPGUIContainerTypes.Framed,
@@ -28268,10 +28172,10 @@ var EquipmentColumn = /*#__PURE__*/styled.div.withConfig({
28268
28172
 
28269
28173
  var SlotsContainer = function SlotsContainer(_ref) {
28270
28174
  var children = _ref.children,
28271
- title = _ref.title,
28272
- onClose = _ref.onClose,
28273
- _onPositionChange = _ref.onPositionChange,
28274
- onOutsideClick = _ref.onOutsideClick;
28175
+ title = _ref.title,
28176
+ onClose = _ref.onClose,
28177
+ _onPositionChange = _ref.onPositionChange,
28178
+ onOutsideClick = _ref.onOutsideClick;
28275
28179
  return React__default.createElement(DraggableContainer, {
28276
28180
  title: title,
28277
28181
  type: exports.RPGUIContainerTypes.Framed,
@@ -28284,8 +28188,7 @@ var SlotsContainer = function SlotsContainer(_ref) {
28284
28188
  cancelDrag: ".item-container-body",
28285
28189
  onPositionChange: function onPositionChange(_ref2) {
28286
28190
  var x = _ref2.x,
28287
- y = _ref2.y;
28288
-
28191
+ y = _ref2.y;
28289
28192
  if (_onPositionChange) {
28290
28193
  _onPositionChange({
28291
28194
  x: x,
@@ -28299,20 +28202,17 @@ var SlotsContainer = function SlotsContainer(_ref) {
28299
28202
 
28300
28203
  var ItemContainer = function ItemContainer(_ref) {
28301
28204
  var itemContainer = _ref.itemContainer,
28302
- onClose = _ref.onClose,
28303
- _onMouseOver = _ref.onMouseOver,
28304
- _onSelected = _ref.onSelected,
28305
- onItemClick = _ref.onItemClick,
28306
- type = _ref.type,
28307
- atlasJSON = _ref.atlasJSON,
28308
- atlasIMG = _ref.atlasIMG;
28309
-
28205
+ onClose = _ref.onClose,
28206
+ _onMouseOver = _ref.onMouseOver,
28207
+ _onSelected = _ref.onSelected,
28208
+ onItemClick = _ref.onItemClick,
28209
+ type = _ref.type,
28210
+ atlasJSON = _ref.atlasJSON,
28211
+ atlasIMG = _ref.atlasIMG;
28310
28212
  var onRenderSlots = function onRenderSlots() {
28311
28213
  var slots = [];
28312
-
28313
28214
  for (var i = 0; i < itemContainer.slotQty; i++) {
28314
28215
  var _itemContainer$slots;
28315
-
28316
28216
  slots.push(React__default.createElement(ItemSlot, {
28317
28217
  key: i,
28318
28218
  slotIndex: i,
@@ -28331,10 +28231,8 @@ var ItemContainer = function ItemContainer(_ref) {
28331
28231
  atlasJSON: atlasJSON
28332
28232
  }));
28333
28233
  }
28334
-
28335
28234
  return slots;
28336
28235
  };
28337
-
28338
28236
  return React__default.createElement(SlotsContainer, {
28339
28237
  title: itemContainer.name || 'Container',
28340
28238
  onClose: onClose
@@ -28349,11 +28247,11 @@ var ItemsContainer = /*#__PURE__*/styled.div.withConfig({
28349
28247
 
28350
28248
  var ListMenu = function ListMenu(_ref) {
28351
28249
  var options = _ref.options,
28352
- onSelected = _ref.onSelected,
28353
- x = _ref.x,
28354
- y = _ref.y,
28355
- _ref$fontSize = _ref.fontSize,
28356
- fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize;
28250
+ onSelected = _ref.onSelected,
28251
+ x = _ref.x,
28252
+ y = _ref.y,
28253
+ _ref$fontSize = _ref.fontSize,
28254
+ fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize;
28357
28255
  return React__default.createElement(Container$a, {
28358
28256
  x: x,
28359
28257
  y: y,
@@ -28397,13 +28295,11 @@ var chunkString = function chunkString(str, length) {
28397
28295
 
28398
28296
  var DynamicText = function DynamicText(_ref) {
28399
28297
  var text = _ref.text,
28400
- onFinish = _ref.onFinish,
28401
- onStart = _ref.onStart;
28402
-
28298
+ onFinish = _ref.onFinish,
28299
+ onStart = _ref.onStart;
28403
28300
  var _useState = React.useState(''),
28404
- textState = _useState[0],
28405
- setTextState = _useState[1];
28406
-
28301
+ textState = _useState[0],
28302
+ setTextState = _useState[1];
28407
28303
  React.useEffect(function () {
28408
28304
  var i = 0;
28409
28305
  var interval = setInterval(function () {
@@ -28413,13 +28309,11 @@ var DynamicText = function DynamicText(_ref) {
28413
28309
  onStart();
28414
28310
  }
28415
28311
  }
28416
-
28417
28312
  if (i < text.length) {
28418
28313
  setTextState(text.substring(0, i + 1));
28419
28314
  i++;
28420
28315
  } else {
28421
28316
  clearInterval(interval);
28422
-
28423
28317
  if (onFinish) {
28424
28318
  onFinish();
28425
28319
  }
@@ -28438,19 +28332,16 @@ var TextContainer = /*#__PURE__*/styled.p.withConfig({
28438
28332
 
28439
28333
  var NPCDialogText = function NPCDialogText(_ref) {
28440
28334
  var text = _ref.text,
28441
- onClose = _ref.onClose,
28442
- onEndStep = _ref.onEndStep,
28443
- onStartStep = _ref.onStartStep;
28335
+ onClose = _ref.onClose,
28336
+ onEndStep = _ref.onEndStep,
28337
+ onStartStep = _ref.onStartStep;
28444
28338
  var textChunks = chunkString(text, 85);
28445
-
28446
28339
  var _useState = React.useState(0),
28447
- chunkIndex = _useState[0],
28448
- setChunkIndex = _useState[1];
28449
-
28340
+ chunkIndex = _useState[0],
28341
+ setChunkIndex = _useState[1];
28450
28342
  var onHandleSpacePress = function onHandleSpacePress(event) {
28451
28343
  if (event.code === 'Space') {
28452
28344
  var hasNextChunk = (textChunks == null ? void 0 : textChunks[chunkIndex + 1]) || false;
28453
-
28454
28345
  if (hasNextChunk) {
28455
28346
  setChunkIndex(function (prev) {
28456
28347
  return prev + 1;
@@ -28461,7 +28352,6 @@ var NPCDialogText = function NPCDialogText(_ref) {
28461
28352
  }
28462
28353
  }
28463
28354
  };
28464
-
28465
28355
  React.useEffect(function () {
28466
28356
  document.addEventListener('keydown', onHandleSpacePress);
28467
28357
  return function () {
@@ -28479,11 +28369,11 @@ var Container$b = /*#__PURE__*/styled.div.withConfig({
28479
28369
  componentId: "sc-1cxkdh9-0"
28480
28370
  })([""]);
28481
28371
 
28372
+ //@ts-ignore
28482
28373
  var useEventListener = function useEventListener(type, handler, el) {
28483
28374
  if (el === void 0) {
28484
28375
  el = window;
28485
28376
  }
28486
-
28487
28377
  var savedHandler = React__default.useRef();
28488
28378
  React__default.useEffect(function () {
28489
28379
  savedHandler.current = handler;
@@ -28493,7 +28383,6 @@ var useEventListener = function useEventListener(type, handler, el) {
28493
28383
  var listener = function listener(e) {
28494
28384
  return savedHandler.current(e);
28495
28385
  };
28496
-
28497
28386
  el.addEventListener(type, listener);
28498
28387
  return function () {
28499
28388
  el.removeEventListener(type, listener);
@@ -28503,36 +28392,29 @@ var useEventListener = function useEventListener(type, handler, el) {
28503
28392
 
28504
28393
  var QuestionDialog = function QuestionDialog(_ref) {
28505
28394
  var questions = _ref.questions,
28506
- answers = _ref.answers,
28507
- onClose = _ref.onClose;
28508
-
28395
+ answers = _ref.answers,
28396
+ onClose = _ref.onClose;
28509
28397
  var _useState = React.useState(questions[0]),
28510
- currentQuestion = _useState[0],
28511
- setCurrentQuestion = _useState[1];
28512
-
28398
+ currentQuestion = _useState[0],
28399
+ setCurrentQuestion = _useState[1];
28513
28400
  var _useState2 = React.useState(false),
28514
- canShowAnswers = _useState2[0],
28515
- setCanShowAnswers = _useState2[1];
28516
-
28401
+ canShowAnswers = _useState2[0],
28402
+ setCanShowAnswers = _useState2[1];
28517
28403
  var onGetFirstAnswer = function onGetFirstAnswer() {
28518
28404
  if (!currentQuestion.answerIds || currentQuestion.answerIds.length === 0) {
28519
28405
  return null;
28520
28406
  }
28521
-
28522
28407
  var firstAnswerId = currentQuestion.answerIds[0];
28523
28408
  return answers.find(function (answer) {
28524
28409
  return answer.id === firstAnswerId;
28525
28410
  });
28526
28411
  };
28527
-
28528
28412
  var _useState3 = React.useState(onGetFirstAnswer()),
28529
- currentAnswer = _useState3[0],
28530
- setCurrentAnswer = _useState3[1];
28531
-
28413
+ currentAnswer = _useState3[0],
28414
+ setCurrentAnswer = _useState3[1];
28532
28415
  React.useEffect(function () {
28533
28416
  setCurrentAnswer(onGetFirstAnswer());
28534
28417
  }, [currentQuestion]);
28535
-
28536
28418
  var onGetAnswers = function onGetAnswers(answerIds) {
28537
28419
  return answerIds.map(function (answerId) {
28538
28420
  return answers.find(function (answer) {
@@ -28540,7 +28422,6 @@ var QuestionDialog = function QuestionDialog(_ref) {
28540
28422
  });
28541
28423
  });
28542
28424
  };
28543
-
28544
28425
  var onKeyPress = function onKeyPress(e) {
28545
28426
  switch (e.key) {
28546
28427
  case 'ArrowDown':
@@ -28558,7 +28439,6 @@ var QuestionDialog = function QuestionDialog(_ref) {
28558
28439
  });
28559
28440
  setCurrentAnswer(nextAnswer || onGetFirstAnswer());
28560
28441
  break;
28561
-
28562
28442
  case 'ArrowUp':
28563
28443
  // select previous answer, if any.
28564
28444
  // if no previous answer, select last answer
@@ -28569,18 +28449,14 @@ var QuestionDialog = function QuestionDialog(_ref) {
28569
28449
  var previousAnswer = onGetAnswers(currentQuestion.answerIds).find(function (answer) {
28570
28450
  return (answer == null ? void 0 : answer.id) === previousAnswerID;
28571
28451
  });
28572
-
28573
28452
  if (previousAnswer) {
28574
28453
  setCurrentAnswer(previousAnswer);
28575
28454
  } else {
28576
28455
  setCurrentAnswer(onGetAnswers(currentQuestion.answerIds).pop());
28577
28456
  }
28578
-
28579
28457
  break;
28580
-
28581
28458
  case 'Enter':
28582
28459
  setCanShowAnswers(false);
28583
-
28584
28460
  if (!(currentAnswer != null && currentAnswer.nextQuestionId)) {
28585
28461
  onClose();
28586
28462
  return;
@@ -28589,16 +28465,12 @@ var QuestionDialog = function QuestionDialog(_ref) {
28589
28465
  return question.id === currentAnswer.nextQuestionId;
28590
28466
  }));
28591
28467
  }
28592
-
28593
28468
  break;
28594
28469
  }
28595
28470
  };
28596
-
28597
28471
  useEventListener('keydown', onKeyPress);
28598
-
28599
28472
  var onAnswerClick = function onAnswerClick(answer) {
28600
28473
  setCanShowAnswers(false);
28601
-
28602
28474
  if (answer.nextQuestionId) {
28603
28475
  // if there is a next question, go to it
28604
28476
  setCurrentQuestion(questions.find(function (question) {
@@ -28609,24 +28481,18 @@ var QuestionDialog = function QuestionDialog(_ref) {
28609
28481
  onClose();
28610
28482
  }
28611
28483
  };
28612
-
28613
28484
  var onRenderCurrentAnswers = function onRenderCurrentAnswers() {
28614
28485
  var answerIds = currentQuestion.answerIds;
28615
-
28616
28486
  if (!answerIds) {
28617
28487
  return null;
28618
28488
  }
28619
-
28620
28489
  var answers = onGetAnswers(answerIds);
28621
-
28622
28490
  if (!answers) {
28623
28491
  return null;
28624
28492
  }
28625
-
28626
28493
  return answers.map(function (answer) {
28627
28494
  var isSelected = (currentAnswer == null ? void 0 : currentAnswer.id) === (answer == null ? void 0 : answer.id);
28628
28495
  var selectedColor = isSelected ? 'yellow' : 'white';
28629
-
28630
28496
  if (answer) {
28631
28497
  return React__default.createElement(AnswerRow, {
28632
28498
  key: "answer_" + answer.id
@@ -28640,11 +28506,9 @@ var QuestionDialog = function QuestionDialog(_ref) {
28640
28506
  color: selectedColor
28641
28507
  }, answer.text));
28642
28508
  }
28643
-
28644
28509
  return null;
28645
28510
  });
28646
28511
  };
28647
-
28648
28512
  return React__default.createElement(Container$c, null, React__default.createElement(QuestionContainer, null, React__default.createElement(DynamicText, {
28649
28513
  text: currentQuestion.text,
28650
28514
  onStart: function onStart() {
@@ -28688,21 +28552,18 @@ var AnswerRow = /*#__PURE__*/styled.div.withConfig({
28688
28552
  NPCDialogType["TextOnly"] = "TextOnly";
28689
28553
  NPCDialogType["TextAndThumbnail"] = "TextAndThumbnail";
28690
28554
  })(exports.NPCDialogType || (exports.NPCDialogType = {}));
28691
-
28692
28555
  var NPCDialog = function NPCDialog(_ref) {
28693
28556
  var text = _ref.text,
28694
- type = _ref.type,
28695
- _onClose = _ref.onClose,
28696
- imagePath = _ref.imagePath,
28697
- _ref$isQuestionDialog = _ref.isQuestionDialog,
28698
- isQuestionDialog = _ref$isQuestionDialog === void 0 ? false : _ref$isQuestionDialog,
28699
- questions = _ref.questions,
28700
- answers = _ref.answers;
28701
-
28557
+ type = _ref.type,
28558
+ _onClose = _ref.onClose,
28559
+ imagePath = _ref.imagePath,
28560
+ _ref$isQuestionDialog = _ref.isQuestionDialog,
28561
+ isQuestionDialog = _ref$isQuestionDialog === void 0 ? false : _ref$isQuestionDialog,
28562
+ questions = _ref.questions,
28563
+ answers = _ref.answers;
28702
28564
  var _useState = React.useState(false),
28703
- showGoNextIndicator = _useState[0],
28704
- setShowGoNextIndicator = _useState[1];
28705
-
28565
+ showGoNextIndicator = _useState[0],
28566
+ setShowGoNextIndicator = _useState[1];
28706
28567
  return React__default.createElement(RPGUIContainer, {
28707
28568
  type: exports.RPGUIContainerTypes.FramedGold,
28708
28569
  width: isQuestionDialog ? '600px' : '50%',
@@ -28770,24 +28631,21 @@ var PressSpaceIndicator = /*#__PURE__*/styled.img.withConfig({
28770
28631
 
28771
28632
  var ProgressBar = function ProgressBar(_ref) {
28772
28633
  var max = _ref.max,
28773
- value = _ref.value,
28774
- color = _ref.color,
28775
- _ref$displayText = _ref.displayText,
28776
- displayText = _ref$displayText === void 0 ? true : _ref$displayText,
28777
- _ref$percentageWidth = _ref.percentageWidth,
28778
- percentageWidth = _ref$percentageWidth === void 0 ? 40 : _ref$percentageWidth,
28779
- _ref$minWidth = _ref.minWidth,
28780
- minWidth = _ref$minWidth === void 0 ? 100 : _ref$minWidth,
28781
- style = _ref.style;
28782
-
28634
+ value = _ref.value,
28635
+ color = _ref.color,
28636
+ _ref$displayText = _ref.displayText,
28637
+ displayText = _ref$displayText === void 0 ? true : _ref$displayText,
28638
+ _ref$percentageWidth = _ref.percentageWidth,
28639
+ percentageWidth = _ref$percentageWidth === void 0 ? 40 : _ref$percentageWidth,
28640
+ _ref$minWidth = _ref.minWidth,
28641
+ minWidth = _ref$minWidth === void 0 ? 100 : _ref$minWidth,
28642
+ style = _ref.style;
28783
28643
  var calculatePercentageValue = function calculatePercentageValue(max, value) {
28784
28644
  if (value > max) {
28785
28645
  value = max;
28786
28646
  }
28787
-
28788
28647
  return value * 100 / max;
28789
28648
  };
28790
-
28791
28649
  return React__default.createElement(Container$e, {
28792
28650
  className: "rpgui-progress",
28793
28651
  "data-value": calculatePercentageValue(max, value) / 100,
@@ -28832,33 +28690,28 @@ var img$8 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCA
28832
28690
 
28833
28691
  var QuestInfo = function QuestInfo(_ref) {
28834
28692
  var quests = _ref.quests,
28835
- onClose = _ref.onClose,
28836
- buttons = _ref.buttons,
28837
- onChangeQuest = _ref.onChangeQuest;
28838
-
28693
+ onClose = _ref.onClose,
28694
+ buttons = _ref.buttons,
28695
+ onChangeQuest = _ref.onChangeQuest;
28839
28696
  var _useState = React.useState(0),
28840
- currentIndex = _useState[0],
28841
- setCurrentIndex = _useState[1];
28842
-
28697
+ currentIndex = _useState[0],
28698
+ setCurrentIndex = _useState[1];
28843
28699
  var questsLength = quests.length - 1;
28844
28700
  React.useEffect(function () {
28845
28701
  if (onChangeQuest) {
28846
28702
  onChangeQuest(currentIndex, quests[currentIndex]._id);
28847
28703
  }
28848
28704
  }, [currentIndex]);
28849
-
28850
28705
  var onLeftClick = function onLeftClick() {
28851
28706
  if (currentIndex === 0) setCurrentIndex(questsLength);else setCurrentIndex(function (index) {
28852
28707
  return index - 1;
28853
28708
  });
28854
28709
  };
28855
-
28856
28710
  var onRightClick = function onRightClick() {
28857
28711
  if (currentIndex === questsLength) setCurrentIndex(0);else setCurrentIndex(function (index) {
28858
28712
  return index + 1;
28859
28713
  });
28860
28714
  };
28861
-
28862
28715
  return React__default.createElement(QuestDraggableContainer, {
28863
28716
  type: exports.RPGUIContainerTypes.Framed,
28864
28717
  onCloseButton: function onCloseButton() {
@@ -28961,7 +28814,7 @@ var RightArrow$1 = /*#__PURE__*/styled.div.withConfig({
28961
28814
 
28962
28815
  var QuestList = function QuestList(_ref) {
28963
28816
  var quests = _ref.quests,
28964
- onClose = _ref.onClose;
28817
+ onClose = _ref.onClose;
28965
28818
  return React__default.createElement(QuestDraggableContainer$1, {
28966
28819
  type: exports.RPGUIContainerTypes.Framed,
28967
28820
  onCloseButton: function onCloseButton() {
@@ -29008,19 +28861,16 @@ var NoQuestContainer = /*#__PURE__*/styled.div.withConfig({
29008
28861
 
29009
28862
  var InputRadio = function InputRadio(_ref) {
29010
28863
  var name = _ref.name,
29011
- items = _ref.items,
29012
- onChange = _ref.onChange;
29013
-
28864
+ items = _ref.items,
28865
+ onChange = _ref.onChange;
29014
28866
  var _useState = React.useState(),
29015
- selectedValue = _useState[0],
29016
- setSelectedValue = _useState[1];
29017
-
28867
+ selectedValue = _useState[0],
28868
+ setSelectedValue = _useState[1];
29018
28869
  var handleClick = function handleClick() {
29019
28870
  var element = document.querySelector("input[name=" + name + "]:checked");
29020
28871
  var elementValue = element.value;
29021
28872
  setSelectedValue(elementValue);
29022
28873
  };
29023
-
29024
28874
  React.useEffect(function () {
29025
28875
  if (selectedValue) {
29026
28876
  onChange(selectedValue);
@@ -29045,23 +28895,18 @@ var InputRadio = function InputRadio(_ref) {
29045
28895
  RangeSliderType["Slider"] = "rpgui-slider";
29046
28896
  RangeSliderType["GoldSlider"] = "rpgui-slider golden";
29047
28897
  })(exports.RangeSliderType || (exports.RangeSliderType = {}));
29048
-
29049
28898
  var RangeSlider = function RangeSlider(_ref) {
29050
28899
  var type = _ref.type,
29051
- valueMin = _ref.valueMin,
29052
- valueMax = _ref.valueMax,
29053
- width = _ref.width,
29054
- onChange = _ref.onChange;
28900
+ valueMin = _ref.valueMin,
28901
+ valueMax = _ref.valueMax,
28902
+ width = _ref.width,
28903
+ onChange = _ref.onChange;
29055
28904
  var sliderId = uuid.v4();
29056
-
29057
28905
  var onHandleMouseUp = function onHandleMouseUp() {
29058
28906
  var rpguiSlider = document.getElementById("rpgui-slider-" + sliderId);
29059
-
29060
28907
  var value = _RPGUI.get_value(rpguiSlider);
29061
-
29062
28908
  onChange(Number(value));
29063
28909
  };
29064
-
29065
28910
  return React__default.createElement("div", {
29066
28911
  onMouseUp: onHandleMouseUp
29067
28912
  }, React__default.createElement(Input$1, {
@@ -29082,10 +28927,10 @@ var Input$1 = /*#__PURE__*/styled.input.withConfig({
29082
28927
 
29083
28928
  var SimpleProgressBar = function SimpleProgressBar(_ref) {
29084
28929
  var value = _ref.value,
29085
- _ref$bgColor = _ref.bgColor,
29086
- bgColor = _ref$bgColor === void 0 ? 'red' : _ref$bgColor,
29087
- _ref$margin = _ref.margin,
29088
- margin = _ref$margin === void 0 ? 20 : _ref$margin;
28930
+ _ref$bgColor = _ref.bgColor,
28931
+ bgColor = _ref$bgColor === void 0 ? 'red' : _ref$bgColor,
28932
+ _ref$margin = _ref.margin,
28933
+ margin = _ref$margin === void 0 ? 20 : _ref$margin;
29089
28934
  return React__default.createElement(Container$f, {
29090
28935
  className: "simple-progress-bar"
29091
28936
  }, React__default.createElement(ProgressBarContainer, {
@@ -29120,16 +28965,18 @@ var ProgressBarContainer = /*#__PURE__*/styled.div.withConfig({
29120
28965
 
29121
28966
  var SkillProgressBar = function SkillProgressBar(_ref) {
29122
28967
  var bgColor = _ref.bgColor,
29123
- skillName = _ref.skillName,
29124
- level = _ref.level,
29125
- skillPoints = _ref.skillPoints,
29126
- texturePath = _ref.texturePath,
29127
- _ref$showSkillPoints = _ref.showSkillPoints,
29128
- showSkillPoints = _ref$showSkillPoints === void 0 ? true : _ref$showSkillPoints;
28968
+ skillName = _ref.skillName,
28969
+ level = _ref.level,
28970
+ skillPoints = _ref.skillPoints,
28971
+ texturePath = _ref.texturePath,
28972
+ _ref$showSkillPoints = _ref.showSkillPoints,
28973
+ showSkillPoints = _ref$showSkillPoints === void 0 ? true : _ref$showSkillPoints,
28974
+ atlasIMG = _ref.atlasIMG,
28975
+ atlasJSON = _ref.atlasJSON;
29129
28976
  var spForNextLevel = shared.getSPForLevel(level + 1);
29130
28977
  var ratio = skillPoints / spForNextLevel * 100;
29131
- return React__default.createElement(React__default.Fragment, null, React__default.createElement(ProgressTitle, null, React__default.createElement(TitleName, null, skillName), React__default.createElement(ValueDisplay, null, "lv ", level)), React__default.createElement(ProgressBody, null, React__default.createElement(ProgressIconContainer, null, atlasJSON ? React__default.createElement(SpriteContainer, null, React__default.createElement(ErrorBoundary, null, React__default.createElement(SpriteFromAtlas, {
29132
- atlasIMG: img$1,
28978
+ return React__default.createElement(React__default.Fragment, null, React__default.createElement(ProgressTitle, null, React__default.createElement(TitleName, null, skillName), React__default.createElement(ValueDisplay, null, "lv ", level)), React__default.createElement(ProgressBody, null, React__default.createElement(ProgressIconContainer, null, atlasIMG && atlasJSON ? React__default.createElement(SpriteContainer, null, React__default.createElement(ErrorBoundary, null, React__default.createElement(SpriteFromAtlas, {
28979
+ atlasIMG: atlasIMG,
29133
28980
  atlasJSON: atlasJSON,
29134
28981
  spriteKey: texturePath,
29135
28982
  imgScale: 1,
@@ -29214,17 +29061,17 @@ var skillProps = {
29214
29061
  };
29215
29062
  var SkillsContainer = function SkillsContainer(_ref) {
29216
29063
  var onCloseButton = _ref.onCloseButton,
29217
- skill = _ref.skill;
29218
-
29064
+ skill = _ref.skill,
29065
+ atlasIMG = _ref.atlasIMG,
29066
+ atlasJSON = _ref.atlasJSON;
29219
29067
  var onRenderSkillCategory = function onRenderSkillCategory(category) {
29220
29068
  var skillCategory = skillProps[category];
29221
29069
  var skillCategoryColor = skillCategory.color;
29222
29070
  var output = [];
29223
-
29224
29071
  for (var _i = 0, _Object$entries = Object.entries(skillCategory.values); _i < _Object$entries.length; _i++) {
29225
29072
  var _Object$entries$_i = _Object$entries[_i],
29226
- key = _Object$entries$_i[0],
29227
- value = _Object$entries$_i[1];
29073
+ key = _Object$entries$_i[0],
29074
+ value = _Object$entries$_i[1];
29228
29075
  //@ts-ignore
29229
29076
  var skillDetails = skill[key];
29230
29077
  output.push(React__default.createElement(SkillProgressBar, {
@@ -29234,13 +29081,13 @@ var SkillsContainer = function SkillsContainer(_ref) {
29234
29081
  level: skillDetails.level || 0,
29235
29082
  skillPoints: Math.round(skillDetails.skillPoints) || 0,
29236
29083
  skillPointsToNextLevel: Math.round(skillDetails.skillPointsToNextLevel) || 0,
29237
- texturePath: value
29084
+ texturePath: value,
29085
+ atlasIMG: atlasIMG,
29086
+ atlasJSON: atlasJSON
29238
29087
  }));
29239
29088
  }
29240
-
29241
29089
  return output;
29242
29090
  };
29243
-
29244
29091
  return React__default.createElement(SkillsDraggableContainer, {
29245
29092
  title: "Skills"
29246
29093
  }, onCloseButton && React__default.createElement(CloseButton$2, {
@@ -29254,7 +29101,9 @@ var SkillsContainer = function SkillsContainer(_ref) {
29254
29101
  level: Math.round(skill.level) || 0,
29255
29102
  skillPoints: Math.round(skill.experience) || 0,
29256
29103
  skillPointsToNextLevel: Math.round(skill.xpToNextLevel) || 0,
29257
- texturePath: 'swords/broad-sword.png'
29104
+ texturePath: 'swords/broad-sword.png',
29105
+ atlasIMG: atlasIMG,
29106
+ atlasJSON: atlasJSON
29258
29107
  }), React__default.createElement("p", null, "Combat Skills"), React__default.createElement("hr", {
29259
29108
  className: "golden"
29260
29109
  })), onRenderSkillCategory('combat'), React__default.createElement(SkillSplitDiv, null, React__default.createElement("p", null, "Crafting Skills"), React__default.createElement("hr", {
@@ -29277,16 +29126,15 @@ var CloseButton$2 = /*#__PURE__*/styled.div.withConfig({
29277
29126
  })(["position:absolute;top:2px;right:2px;color:white;z-index:22;font-size:0.7rem;"]);
29278
29127
 
29279
29128
  var TextArea = function TextArea(_ref) {
29280
- var props = _extends({}, _ref);
29281
-
29129
+ var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
29282
29130
  return React__default.createElement("textarea", Object.assign({}, props));
29283
29131
  };
29284
29132
 
29285
29133
  /* eslint-disable react/require-default-props */
29286
29134
  var Truncate = function Truncate(_ref) {
29287
29135
  var _ref$maxLines = _ref.maxLines,
29288
- maxLines = _ref$maxLines === void 0 ? 1 : _ref$maxLines,
29289
- children = _ref.children;
29136
+ maxLines = _ref$maxLines === void 0 ? 1 : _ref$maxLines,
29137
+ children = _ref.children;
29290
29138
  return React__default.createElement(Container$g, {
29291
29139
  maxLines: maxLines
29292
29140
  }, children);
@@ -29302,21 +29150,16 @@ var Container$g = /*#__PURE__*/styled.div.withConfig({
29302
29150
  ImgSide["right"] = "right";
29303
29151
  ImgSide["left"] = "left";
29304
29152
  })(exports.ImgSide || (exports.ImgSide = {}));
29305
-
29306
29153
  var NPCMultiDialog = function NPCMultiDialog(_ref) {
29307
29154
  var _textAndTypeArray$sli;
29308
-
29309
29155
  var _onClose = _ref.onClose,
29310
- textAndTypeArray = _ref.textAndTypeArray;
29311
-
29156
+ textAndTypeArray = _ref.textAndTypeArray;
29312
29157
  var _useState = React.useState(false),
29313
- showGoNextIndicator = _useState[0],
29314
- setShowGoNextIndicator = _useState[1];
29315
-
29158
+ showGoNextIndicator = _useState[0],
29159
+ setShowGoNextIndicator = _useState[1];
29316
29160
  var _useState2 = React.useState(0),
29317
- slide = _useState2[0],
29318
- setSlide = _useState2[1];
29319
-
29161
+ slide = _useState2[0],
29162
+ setSlide = _useState2[1];
29320
29163
  var onHandleSpacePress = function onHandleSpacePress(event) {
29321
29164
  if (event.code === 'Space') {
29322
29165
  if (slide < (textAndTypeArray == null ? void 0 : textAndTypeArray.length) - 1) {
@@ -29329,7 +29172,6 @@ var NPCMultiDialog = function NPCMultiDialog(_ref) {
29329
29172
  }
29330
29173
  }
29331
29174
  };
29332
-
29333
29175
  React.useEffect(function () {
29334
29176
  document.addEventListener('keydown', onHandleSpacePress);
29335
29177
  return function () {
@@ -29411,18 +29253,16 @@ var PressSpaceIndicator$1 = /*#__PURE__*/styled.img.withConfig({
29411
29253
 
29412
29254
  var HistoryDialog = function HistoryDialog(_ref) {
29413
29255
  var backgroundImgPath = _ref.backgroundImgPath,
29414
- fullCoverBackground = _ref.fullCoverBackground,
29415
- questions = _ref.questions,
29416
- answers = _ref.answers,
29417
- text = _ref.text,
29418
- imagePath = _ref.imagePath,
29419
- textAndTypeArray = _ref.textAndTypeArray,
29420
- onClose = _ref.onClose;
29421
-
29256
+ fullCoverBackground = _ref.fullCoverBackground,
29257
+ questions = _ref.questions,
29258
+ answers = _ref.answers,
29259
+ text = _ref.text,
29260
+ imagePath = _ref.imagePath,
29261
+ textAndTypeArray = _ref.textAndTypeArray,
29262
+ onClose = _ref.onClose;
29422
29263
  var _useState = React.useState(0),
29423
- img = _useState[0],
29424
- setImage = _useState[1];
29425
-
29264
+ img = _useState[0],
29265
+ setImage = _useState[1];
29426
29266
  var onHandleSpacePress = function onHandleSpacePress(event) {
29427
29267
  if (event.code === 'Space') {
29428
29268
  if (img < (backgroundImgPath == null ? void 0 : backgroundImgPath.length) - 1) {
@@ -29435,7 +29275,6 @@ var HistoryDialog = function HistoryDialog(_ref) {
29435
29275
  }
29436
29276
  }
29437
29277
  };
29438
-
29439
29278
  React.useEffect(function () {
29440
29279
  document.addEventListener('keydown', onHandleSpacePress);
29441
29280
  return function () {
@@ -29476,6 +29315,183 @@ var DialogContainer = /*#__PURE__*/styled.div.withConfig({
29476
29315
  componentId: "sc-u6oe75-1"
29477
29316
  })(["display:flex;justify-content:center;padding-top:200px;"]);
29478
29317
 
29318
+ var ItemTradingComponent = function ItemTradingComponent(_ref) {
29319
+ var atlasIMG = _ref.atlasIMG,
29320
+ atlasJSON = _ref.atlasJSON,
29321
+ updateChartTotals = _ref.updateChartTotals,
29322
+ traderItem = _ref.traderItem;
29323
+ var _useState = React.useState(0),
29324
+ itemQuantity = _useState[0],
29325
+ setItemQuantity = _useState[1];
29326
+ var onLeftClick = function onLeftClick() {
29327
+ if (itemQuantity > 0) {
29328
+ var newQuantity = itemQuantity - 1;
29329
+ setItemQuantity(newQuantity);
29330
+ updateChartTotals({
29331
+ key: traderItem.key,
29332
+ itemId: traderItem.itemId,
29333
+ qty: newQuantity,
29334
+ price: traderItem.price,
29335
+ texturePath: traderItem.texturePath,
29336
+ name: traderItem.name
29337
+ });
29338
+ }
29339
+ };
29340
+ var onRightClick = function onRightClick() {
29341
+ var newQuantity = itemQuantity + 1;
29342
+ setItemQuantity(newQuantity);
29343
+ updateChartTotals({
29344
+ key: traderItem.key,
29345
+ itemId: traderItem.itemId,
29346
+ qty: newQuantity,
29347
+ price: traderItem.price,
29348
+ texturePath: traderItem.texturePath,
29349
+ name: traderItem.name
29350
+ });
29351
+ };
29352
+ return React__default.createElement(ItemWrapper, null, React__default.createElement(IconContainer, null, React__default.createElement(SpriteContainer$1, null, React__default.createElement(SpriteFromAtlas, {
29353
+ atlasIMG: atlasIMG,
29354
+ atlasJSON: atlasJSON,
29355
+ spriteKey: traderItem.texturePath,
29356
+ imgScale: 2.5
29357
+ }))), React__default.createElement(NameValue, null, React__default.createElement("p", null, traderItem.name), React__default.createElement("p", null, "$", traderItem.price)), React__default.createElement(Container$i, null, React__default.createElement(TextOverlay$2, null, React__default.createElement(Item$1, null, itemQuantity)), React__default.createElement(LeftArrow$2, {
29358
+ onClick: onLeftClick,
29359
+ onTouchStart: onLeftClick
29360
+ }), React__default.createElement(RightArrow$2, {
29361
+ onClick: onRightClick,
29362
+ onTouchStart: onRightClick
29363
+ })));
29364
+ };
29365
+ var ItemWrapper = /*#__PURE__*/styled.div.withConfig({
29366
+ displayName: "itemComponent__ItemWrapper",
29367
+ componentId: "sc-nc2o41-0"
29368
+ })(["width:80%;margin:auto;display:flex;justify-content:space-between;"]);
29369
+ var IconContainer = /*#__PURE__*/styled.div.withConfig({
29370
+ displayName: "itemComponent__IconContainer",
29371
+ componentId: "sc-nc2o41-1"
29372
+ })(["display:flex;justify-content:center;align-items:center;"]);
29373
+ var SpriteContainer$1 = /*#__PURE__*/styled.div.withConfig({
29374
+ displayName: "itemComponent__SpriteContainer",
29375
+ componentId: "sc-nc2o41-2"
29376
+ })(["position:relative;top:-3px;left:0;"]);
29377
+ var NameValue = /*#__PURE__*/styled.div.withConfig({
29378
+ displayName: "itemComponent__NameValue",
29379
+ componentId: "sc-nc2o41-3"
29380
+ })([""]);
29381
+ var Item$1 = /*#__PURE__*/styled.span.withConfig({
29382
+ displayName: "itemComponent__Item",
29383
+ componentId: "sc-nc2o41-4"
29384
+ })(["font-size:1rem;color:white;text-align:center;z-index:1;position:absolute;top:-12px;width:100%;"]);
29385
+ var TextOverlay$2 = /*#__PURE__*/styled.div.withConfig({
29386
+ displayName: "itemComponent__TextOverlay",
29387
+ componentId: "sc-nc2o41-5"
29388
+ })(["width:100%;position:relative;"]);
29389
+ var Container$i = /*#__PURE__*/styled.div.withConfig({
29390
+ displayName: "itemComponent__Container",
29391
+ componentId: "sc-nc2o41-6"
29392
+ })(["position:relative;display:flex;flex-direction:column;justify-content:space-around;align-items:flex-start;min-width:100px;width:40%;"]);
29393
+ var LeftArrow$2 = /*#__PURE__*/styled.div.withConfig({
29394
+ displayName: "itemComponent__LeftArrow",
29395
+ componentId: "sc-nc2o41-7"
29396
+ })(["background-image:url(", ");background-size:100% 100%;left:0;position:absolute;width:40px;height:42px;:active{background-image:url(", ");}z-index:2;"], img$3, img$2);
29397
+ var RightArrow$2 = /*#__PURE__*/styled.div.withConfig({
29398
+ displayName: "itemComponent__RightArrow",
29399
+ componentId: "sc-nc2o41-8"
29400
+ })(["background-image:url(", ");right:0;position:absolute;width:40px;background-size:100% 100%;height:42px;:active{background-image:url(", ");}z-index:2;"], img$5, img$4);
29401
+
29402
+ var TrandingMenu = function TrandingMenu(_ref) {
29403
+ var traderItems = _ref.traderItems,
29404
+ onClose = _ref.onClose,
29405
+ type = _ref.type,
29406
+ atlasJSON = _ref.atlasJSON,
29407
+ atlasIMG = _ref.atlasIMG,
29408
+ characterAvailableGold = _ref.characterAvailableGold,
29409
+ onChangeTraderItems = _ref.onChangeTraderItems;
29410
+ var _useState = React.useState(0),
29411
+ sum = _useState[0],
29412
+ setSum = _useState[1];
29413
+ var newSumArray = 0;
29414
+ var updateChartTotals = function updateChartTotals(item) {
29415
+ var itemIndex = traderItems.findIndex(function (itemArray) {
29416
+ return itemArray.itemId === item.itemId;
29417
+ });
29418
+ traderItems[itemIndex] = item;
29419
+ traderItems.forEach(function (item) {
29420
+ if (item.qty) newSumArray += item.qty * item.price;
29421
+ setSum(newSumArray);
29422
+ });
29423
+ };
29424
+ React.useEffect(function () {
29425
+ if (onChangeTraderItems) {
29426
+ onChangeTraderItems(traderItems);
29427
+ }
29428
+ }, [traderItems]);
29429
+ var Capitalize = function Capitalize(word) {
29430
+ return word[0].toUpperCase() + word.substring(1);
29431
+ };
29432
+ return React__default.createElement(TradingMenuDraggableContainer, {
29433
+ type: exports.RPGUIContainerTypes.Framed,
29434
+ onCloseButton: function onCloseButton() {
29435
+ if (onClose) onClose();
29436
+ },
29437
+ width: "500px",
29438
+ cancelDrag: ".equipment-container-body .arrow-selector"
29439
+ }, React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
29440
+ style: {
29441
+ width: '100%'
29442
+ }
29443
+ }, React__default.createElement(Title$3, null, Capitalize(type)), React__default.createElement("hr", {
29444
+ className: "golden"
29445
+ })), React__default.createElement(TrandingComponentScrollWrapper, null, traderItems.map(function (tradeItem) {
29446
+ return React__default.createElement(ItemWrapper$1, {
29447
+ key: uuid.v4()
29448
+ }, React__default.createElement(ItemTradingComponent, {
29449
+ key: uuid.v4(),
29450
+ atlasIMG: atlasIMG,
29451
+ atlasJSON: atlasJSON,
29452
+ updateChartTotals: updateChartTotals,
29453
+ traderItem: tradeItem
29454
+ }));
29455
+ })), React__default.createElement(GoldWrapper, null, React__default.createElement("p", null, "Available Gold:"), React__default.createElement("p", null, "$", characterAvailableGold)), React__default.createElement(TotalWrapper, null, React__default.createElement("p", null, "Total:"), React__default.createElement("p", null, "$", sum)), sum > characterAvailableGold ? React__default.createElement(AlertWrapper, null, React__default.createElement("p", null, " Sorry, not enough money.")) : React__default.createElement(GoldWrapper, null, React__default.createElement("p", null, "Final Gold:"), React__default.createElement("p", null, "$", characterAvailableGold - sum)), React__default.createElement(ButtonWrapper, null, React__default.createElement(Button, {
29456
+ buttonType: exports.ButtonTypes.RPGUIButton,
29457
+ disabled: sum > characterAvailableGold
29458
+ }, "Confirm"), React__default.createElement(Button, {
29459
+ buttonType: exports.ButtonTypes.RPGUIButton
29460
+ }, "Cancel"))));
29461
+ };
29462
+ var TradingMenuDraggableContainer = /*#__PURE__*/styled(DraggableContainer).withConfig({
29463
+ displayName: "TrandingMenu__TradingMenuDraggableContainer",
29464
+ componentId: "sc-1lbop40-0"
29465
+ })([".container-close{top:10px;right:10px;}.quest-title{text-align:left;margin-left:44px;margin-top:20px;color:yellow;}.quest-desc{margin-top:12px;margin-left:44px;}.rpgui-progress{min-width:80%;margin:0 auto;}"]);
29466
+ var Title$3 = /*#__PURE__*/styled.h1.withConfig({
29467
+ displayName: "TrandingMenu__Title",
29468
+ componentId: "sc-1lbop40-1"
29469
+ })(["z-index:22;font-size:0.6rem;color:yellow !important;"]);
29470
+ var TrandingComponentScrollWrapper = /*#__PURE__*/styled.div.withConfig({
29471
+ displayName: "TrandingMenu__TrandingComponentScrollWrapper",
29472
+ componentId: "sc-1lbop40-2"
29473
+ })(["overflow-y:scroll;height:500px;width:100%;"]);
29474
+ var ItemWrapper$1 = /*#__PURE__*/styled.div.withConfig({
29475
+ displayName: "TrandingMenu__ItemWrapper",
29476
+ componentId: "sc-1lbop40-3"
29477
+ })(["width:80%;margin:auto;display:flex;justify-content:space-between;"]);
29478
+ var TotalWrapper = /*#__PURE__*/styled.div.withConfig({
29479
+ displayName: "TrandingMenu__TotalWrapper",
29480
+ componentId: "sc-1lbop40-4"
29481
+ })(["width:80%;display:flex;margin:auto;justify-content:space-between;height:20px;"]);
29482
+ var GoldWrapper = /*#__PURE__*/styled.div.withConfig({
29483
+ displayName: "TrandingMenu__GoldWrapper",
29484
+ componentId: "sc-1lbop40-5"
29485
+ })(["width:80%;display:flex;margin:auto;justify-content:space-between;height:20px;p{color:yellow !important;}"]);
29486
+ var AlertWrapper = /*#__PURE__*/styled.div.withConfig({
29487
+ displayName: "TrandingMenu__AlertWrapper",
29488
+ componentId: "sc-1lbop40-6"
29489
+ })(["width:80%;display:flex;margin:auto;justify-content:center;height:20px;p{color:red !important;}"]);
29490
+ var ButtonWrapper = /*#__PURE__*/styled.div.withConfig({
29491
+ displayName: "TrandingMenu__ButtonWrapper",
29492
+ componentId: "sc-1lbop40-7"
29493
+ })(["width:80%;margin:auto;display:flex;justify-content:space-around;padding-top:20px;"]);
29494
+
29479
29495
  exports.Button = Button;
29480
29496
  exports.CharacterSelection = CharacterSelection;
29481
29497
  exports.Chat = Chat;
@@ -29504,6 +29520,7 @@ exports.SkillProgressBar = SkillProgressBar;
29504
29520
  exports.SkillsContainer = SkillsContainer;
29505
29521
  exports.SpriteFromAtlas = SpriteFromAtlas;
29506
29522
  exports.TextArea = TextArea;
29523
+ exports.TrandingMenu = TrandingMenu;
29507
29524
  exports.Truncate = Truncate;
29508
29525
  exports._RPGUI = _RPGUI;
29509
29526
  exports.useEventListener = useEventListener;