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