@rpg-engine/long-bow 0.2.27 → 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.
Files changed (34) hide show
  1. package/dist/components/SkillProgressBar.d.ts +2 -0
  2. package/dist/components/SkillsContainer.d.ts +2 -0
  3. package/dist/components/TradingMenu/TrandingMenu.d.ts +12 -0
  4. package/dist/components/TradingMenu/itemComponent.d.ts +9 -0
  5. package/dist/components/TradingMenu/items.mock.d.ts +2 -0
  6. package/dist/index.d.ts +1 -0
  7. package/dist/long-bow.cjs.development.js +408 -414
  8. package/dist/long-bow.cjs.development.js.map +1 -1
  9. package/dist/long-bow.cjs.production.min.js +1 -1
  10. package/dist/long-bow.cjs.production.min.js.map +1 -1
  11. package/dist/long-bow.esm.js +407 -418
  12. package/dist/long-bow.esm.js.map +1 -1
  13. package/dist/stories/ItemTradingComponent.stories.d.ts +5 -0
  14. package/dist/stories/TrandingMenu.stories.d.ts +5 -0
  15. package/package.json +2 -2
  16. package/src/components/Character/CharacterSelection.tsx +1 -1
  17. package/src/components/Item/Inventory/ItemSlot.tsx +6 -4
  18. package/src/components/NPCDialog/.DS_Store +0 -0
  19. package/src/components/ScrollList.tsx +2 -1
  20. package/src/components/SkillProgressBar.tsx +4 -2
  21. package/src/components/SkillsContainer.tsx +8 -37
  22. package/src/components/TradingMenu/TrandingMenu.tsx +190 -0
  23. package/src/components/TradingMenu/itemComponent.tsx +158 -0
  24. package/src/components/TradingMenu/items.mock.ts +87 -0
  25. package/src/index.tsx +1 -0
  26. package/src/mocks/.DS_Store +0 -0
  27. package/src/mocks/equipmentSet.mocks.ts +3 -5
  28. package/src/mocks/itemContainer.mocks.ts +20 -32
  29. package/src/stories/ItemTradingComponent.stories.tsx +39 -0
  30. package/src/stories/SkillProgressBar.stories.tsx +4 -0
  31. package/src/stories/SkillsContainer.stories.tsx +4 -0
  32. package/src/stories/TrandingMenu.stories.tsx +38 -0
  33. package/dist/libs/ItemSlotHelper.d.ts +0 -2
  34. package/src/libs/ItemSlotHelper.ts +0 -25
@@ -1,6 +1,6 @@
1
1
  import React, { Component, useState, useEffect, useRef } from 'react';
2
2
  import styled from 'styled-components';
3
- import { GRID_WIDTH, GRID_HEIGHT, ItemContainerType, ItemType, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemSlotType, getSPForLevel } from '@rpg-engine/shared';
3
+ import { GRID_WIDTH, GRID_HEIGHT, ItemContainerType, ItemType, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, getItemTextureKeyPath, ItemSlotType, getSPForLevel } from '@rpg-engine/shared';
4
4
  import dayjs from 'dayjs';
5
5
  import { ErrorBoundary as ErrorBoundary$1 } from 'react-error-boundary';
6
6
  import Draggable from 'react-draggable';
@@ -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
- if (spriteKey == selectedSpriteKey) {
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);
@@ -27840,41 +27785,17 @@ var Dropdown = function Dropdown(_ref) {
27840
27785
  }));
27841
27786
  };
27842
27787
 
27843
- var getItemTextureKeyPath = function getItemTextureKeyPath(itemToRender, atlasJSON) {
27844
- var _itemToRender$stackQt;
27845
-
27846
- var stackQty = (_itemToRender$stackQt = itemToRender == null ? void 0 : itemToRender.stackQty) != null ? _itemToRender$stackQt : 0;
27847
- var itemTexturePath = itemToRender.texturePath;
27848
-
27849
- if (itemToRender && stackQty >= 1) {
27850
- var idx = stackQty >= 5 ? '5' : stackQty;
27851
- var textureBreakPath = itemTexturePath.split('.');
27852
- var txtPrefix = textureBreakPath[0];
27853
- var txtExtension = textureBreakPath[1];
27854
- console.log(txtPrefix + "-qty-" + idx + "." + txtExtension);
27855
- var newTexturePath = txtPrefix + "-qty-" + idx + "." + txtExtension;
27856
- var spriteData = atlasJSON.frames[newTexturePath];
27857
-
27858
- if (spriteData !== undefined) {
27859
- return newTexturePath;
27860
- }
27861
- }
27862
-
27863
- return itemTexturePath;
27864
- };
27865
-
27866
27788
  var RelativeListMenu = function RelativeListMenu(_ref) {
27867
27789
  var options = _ref.options,
27868
- onSelected = _ref.onSelected,
27869
- onOutsideClick = _ref.onOutsideClick,
27870
- _ref$fontSize = _ref.fontSize,
27871
- 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;
27872
27794
  var ref = useRef(null);
27873
27795
  useOutsideClick(ref, 'relative-context-menu');
27874
27796
  useEffect(function () {
27875
27797
  document.addEventListener('clickOutside', function (event) {
27876
27798
  var e = event;
27877
-
27878
27799
  if (e.detail.id === 'relative-context-menu') {
27879
27800
  if (onOutsideClick) {
27880
27801
  onOutsideClick();
@@ -27931,10 +27852,8 @@ var generateContextMenuListOptions = function generateContextMenuListOptions(act
27931
27852
  });
27932
27853
  return contextMenu;
27933
27854
  };
27934
-
27935
27855
  var generateContextMenu = function generateContextMenu(itemType, itemContainerType) {
27936
27856
  var contextActionMenu = [];
27937
-
27938
27857
  if (itemContainerType === ItemContainerType.Inventory) {
27939
27858
  switch (itemType) {
27940
27859
  case ItemType.Weapon:
@@ -27943,40 +27862,32 @@ var generateContextMenu = function generateContextMenu(itemType, itemContainerTy
27943
27862
  case ItemType.Jewelry:
27944
27863
  contextActionMenu = generateContextMenuListOptions(ActionsForInventory.Equipment);
27945
27864
  break;
27946
-
27947
27865
  case ItemType.Container:
27948
27866
  contextActionMenu = generateContextMenuListOptions(ActionsForInventory.Container);
27949
27867
  break;
27950
-
27951
27868
  case ItemType.Consumable:
27952
27869
  contextActionMenu = generateContextMenuListOptions(ActionsForInventory.Consumable);
27953
27870
  break;
27954
-
27955
27871
  case ItemType.CraftMaterial:
27956
27872
  contextActionMenu = generateContextMenuListOptions(ActionsForInventory.CraftMaterial);
27957
27873
  break;
27958
-
27959
27874
  case ItemType.Tool:
27960
27875
  contextActionMenu = generateContextMenuListOptions(ActionsForInventory.Tool);
27961
27876
  break;
27962
-
27963
27877
  default:
27964
27878
  contextActionMenu = generateContextMenuListOptions(ActionsForInventory.Other);
27965
27879
  break;
27966
27880
  }
27967
27881
  }
27968
-
27969
27882
  if (itemContainerType === ItemContainerType.Equipment) {
27970
27883
  switch (itemType) {
27971
27884
  case ItemType.Container:
27972
27885
  contextActionMenu = generateContextMenuListOptions(ActionsForEquipmentSet.Container);
27973
27886
  break;
27974
-
27975
27887
  default:
27976
27888
  contextActionMenu = generateContextMenuListOptions(ActionsForEquipmentSet.Equipment);
27977
27889
  }
27978
27890
  }
27979
-
27980
27891
  if (itemContainerType === ItemContainerType.Loot) {
27981
27892
  switch (itemType) {
27982
27893
  case ItemType.Weapon:
@@ -27985,25 +27896,20 @@ var generateContextMenu = function generateContextMenu(itemType, itemContainerTy
27985
27896
  case ItemType.Jewelry:
27986
27897
  contextActionMenu = generateContextMenuListOptions(ActionsForLoot.Equipment);
27987
27898
  break;
27988
-
27989
27899
  case ItemType.Consumable:
27990
27900
  contextActionMenu = generateContextMenuListOptions(ActionsForLoot.Consumable);
27991
27901
  break;
27992
-
27993
27902
  case ItemType.CraftMaterial:
27994
27903
  contextActionMenu = generateContextMenuListOptions(ActionsForLoot.CraftMaterial);
27995
27904
  break;
27996
-
27997
27905
  case ItemType.Tool:
27998
27906
  contextActionMenu = generateContextMenuListOptions(ActionsForLoot.Tool);
27999
27907
  break;
28000
-
28001
27908
  default:
28002
27909
  contextActionMenu = generateContextMenuListOptions(ActionsForLoot.Other);
28003
27910
  break;
28004
27911
  }
28005
27912
  }
28006
-
28007
27913
  if (itemContainerType === ItemContainerType.MapContainer) {
28008
27914
  switch (itemType) {
28009
27915
  case ItemType.Weapon:
@@ -28012,25 +27918,20 @@ var generateContextMenu = function generateContextMenu(itemType, itemContainerTy
28012
27918
  case ItemType.Jewelry:
28013
27919
  contextActionMenu = generateContextMenuListOptions(ActionsForMapContainer.Equipment);
28014
27920
  break;
28015
-
28016
27921
  case ItemType.Consumable:
28017
27922
  contextActionMenu = generateContextMenuListOptions(ActionsForMapContainer.Consumable);
28018
27923
  break;
28019
-
28020
27924
  case ItemType.CraftMaterial:
28021
27925
  contextActionMenu = generateContextMenuListOptions(ActionsForMapContainer.CraftMaterial);
28022
27926
  break;
28023
-
28024
27927
  case ItemType.Tool:
28025
27928
  contextActionMenu = generateContextMenuListOptions(ActionsForMapContainer.Tool);
28026
27929
  break;
28027
-
28028
27930
  default:
28029
27931
  contextActionMenu = generateContextMenuListOptions(ActionsForMapContainer.Other);
28030
27932
  break;
28031
27933
  }
28032
27934
  }
28033
-
28034
27935
  return contextActionMenu;
28035
27936
  };
28036
27937
 
@@ -28048,39 +27949,33 @@ var EquipmentSlotSpriteByType = {
28048
27949
  };
28049
27950
  var ItemSlot = /*#__PURE__*/observer(function (_ref) {
28050
27951
  var slotIndex = _ref.slotIndex,
28051
- item = _ref.item,
28052
- containerType = _ref.itemContainerType,
28053
- slotSpriteMask = _ref.slotSpriteMask,
28054
- _onMouseOver = _ref.onMouseOver,
28055
- _onMouseOut = _ref.onMouseOut,
28056
- _onClick = _ref.onClick,
28057
- _onSelected = _ref.onSelected,
28058
- atlasJSON = _ref.atlasJSON,
28059
- atlasIMG = _ref.atlasIMG;
28060
-
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;
28061
27961
  var _useState = useState(false),
28062
- isTooltipVisible = _useState[0],
28063
- setTooltipVisible = _useState[1];
28064
-
27962
+ isTooltipVisible = _useState[0],
27963
+ setTooltipVisible = _useState[1];
28065
27964
  var _useState2 = useState(false),
28066
- isContextMenuVisible = _useState2[0],
28067
- setIsContextMenuVisible = _useState2[1];
28068
-
27965
+ isContextMenuVisible = _useState2[0],
27966
+ setIsContextMenuVisible = _useState2[1];
28069
27967
  var _useState3 = useState([]),
28070
- contextActions = _useState3[0],
28071
- setContextActions = _useState3[1];
28072
-
27968
+ contextActions = _useState3[0],
27969
+ setContextActions = _useState3[1];
28073
27970
  useEffect(function () {
28074
27971
  if (item) {
28075
27972
  setContextActions(generateContextMenu(item.type, containerType));
28076
27973
  }
28077
27974
  }, [item]);
28078
-
28079
27975
  var getLeftPositionValue = function getLeftPositionValue(quantity) {
28080
27976
  if (quantity > 0 && quantity < 10) return '2.5rem';else if (quantity > 9 && quantity < 100) return '2.0rem';else if (quantity > 99) return '1rem';
28081
27977
  return '2.5rem';
28082
27978
  };
28083
-
28084
27979
  var getStackInfo = function getStackInfo(itemId, stackQty) {
28085
27980
  // if (itemToRender?.isStackable && itemToRender?.stackQty) {
28086
27981
  if (stackQty > 1) {
@@ -28089,17 +27984,15 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
28089
27984
  key: "qty-" + itemId
28090
27985
  }, ' ', stackQty, ' ');
28091
27986
  }
28092
-
28093
27987
  return undefined;
28094
27988
  };
28095
-
28096
27989
  var renderItem = function renderItem(itemToRender) {
28097
27990
  var _itemToRender$_id, _itemToRender$stackQt;
28098
-
28099
27991
  var element = [];
28100
-
28101
27992
  if (itemToRender != null && itemToRender.texturePath) {
28102
- element.push(React.createElement(ErrorBoundary, null, React.createElement(SpriteFromAtlas, {
27993
+ element.push(React.createElement(ErrorBoundary, {
27994
+ key: itemToRender._id
27995
+ }, React.createElement(SpriteFromAtlas, {
28103
27996
  key: itemToRender._id,
28104
27997
  atlasIMG: atlasIMG,
28105
27998
  atlasJSON: atlasJSON,
@@ -28107,24 +28000,20 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
28107
28000
  imgScale: 3
28108
28001
  })));
28109
28002
  }
28110
-
28111
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);
28112
-
28113
28004
  if (stackInfo) {
28114
28005
  element.push(stackInfo);
28115
28006
  }
28116
-
28117
28007
  return element;
28118
28008
  };
28119
-
28120
28009
  var renderEquipment = function renderEquipment(itemToRender) {
28121
28010
  var _itemToRender$allowed;
28122
-
28123
28011
  if (itemToRender != null && itemToRender.texturePath && (_itemToRender$allowed = itemToRender.allowedEquipSlotType) != null && _itemToRender$allowed.includes(slotSpriteMask)) {
28124
28012
  var _itemToRender$_id2, _itemToRender$stackQt2;
28125
-
28126
28013
  var element = [];
28127
- element.push(React.createElement(ErrorBoundary, null, React.createElement(SpriteFromAtlas, {
28014
+ element.push(React.createElement(ErrorBoundary, {
28015
+ key: itemToRender._id
28016
+ }, React.createElement(SpriteFromAtlas, {
28128
28017
  key: itemToRender._id,
28129
28018
  atlasIMG: atlasIMG,
28130
28019
  atlasJSON: atlasJSON,
@@ -28132,14 +28021,15 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
28132
28021
  imgScale: 3
28133
28022
  })));
28134
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);
28135
-
28136
28024
  if (stackInfo) {
28137
28025
  element.push(stackInfo);
28138
28026
  }
28139
-
28140
28027
  return element;
28141
28028
  } else {
28142
- return React.createElement(ErrorBoundary, null, React.createElement(SpriteFromAtlas, {
28029
+ return React.createElement(ErrorBoundary, {
28030
+ key: v4()
28031
+ }, React.createElement(SpriteFromAtlas, {
28032
+ key: v4(),
28143
28033
  atlasIMG: atlasIMG,
28144
28034
  atlasJSON: atlasJSON,
28145
28035
  spriteKey: EquipmentSlotSpriteByType[slotSpriteMask],
@@ -28149,20 +28039,16 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
28149
28039
  }));
28150
28040
  }
28151
28041
  };
28152
-
28153
28042
  var onRenderSlot = function onRenderSlot(itemToRender) {
28154
28043
  switch (containerType) {
28155
28044
  case ItemContainerType.Equipment:
28156
28045
  return renderEquipment(itemToRender);
28157
-
28158
28046
  case ItemContainerType.Inventory:
28159
28047
  return renderItem(itemToRender);
28160
-
28161
28048
  default:
28162
28049
  return renderItem(itemToRender);
28163
28050
  }
28164
28051
  };
28165
-
28166
28052
  return React.createElement(Container$9, {
28167
28053
  className: "rpgui-icon empty-slot",
28168
28054
  onMouseOver: function onMouseOver(event) {
@@ -28179,10 +28065,8 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
28179
28065
  },
28180
28066
  onClick: function onClick() {
28181
28067
  setTooltipVisible(false);
28182
-
28183
28068
  if (item) {
28184
28069
  setIsContextMenuVisible(!isContextMenuVisible);
28185
-
28186
28070
  _onClick(item.type, containerType, item);
28187
28071
  }
28188
28072
  }
@@ -28190,7 +28074,6 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
28190
28074
  options: contextActions,
28191
28075
  onSelected: function onSelected(optionId) {
28192
28076
  setIsContextMenuVisible(false);
28193
-
28194
28077
  if (item) {
28195
28078
  _onSelected(optionId, item);
28196
28079
  }
@@ -28215,31 +28098,29 @@ var ItemQty = /*#__PURE__*/styled.span.withConfig({
28215
28098
 
28216
28099
  var EquipmentSet = function EquipmentSet(_ref) {
28217
28100
  var equipmentSet = _ref.equipmentSet,
28218
- onClose = _ref.onClose,
28219
- _onMouseOver = _ref.onMouseOver,
28220
- _onSelected = _ref.onSelected,
28221
- onItemClick = _ref.onItemClick,
28222
- atlasIMG = _ref.atlasIMG,
28223
- 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;
28224
28107
  var neck = equipmentSet.neck,
28225
- leftHand = equipmentSet.leftHand,
28226
- ring = equipmentSet.ring,
28227
- head = equipmentSet.head,
28228
- armor = equipmentSet.armor,
28229
- legs = equipmentSet.legs,
28230
- boot = equipmentSet.boot,
28231
- inventory = equipmentSet.inventory,
28232
- rightHand = equipmentSet.rightHand,
28233
- 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;
28234
28117
  var equipmentData = [neck, leftHand, ring, head, armor, legs, boot, inventory, rightHand, accessory];
28235
28118
  var equipmentMaskSlots = [ItemSlotType.Neck, ItemSlotType.LeftHand, ItemSlotType.Ring, ItemSlotType.Head, ItemSlotType.Torso, ItemSlotType.Legs, ItemSlotType.Feet, ItemSlotType.Inventory, ItemSlotType.RightHand, ItemSlotType.Accessory];
28236
-
28237
28119
  var onRenderEquipmentSlotRange = function onRenderEquipmentSlotRange(start, end) {
28238
28120
  var equipmentRange = equipmentData.slice(start, end);
28239
28121
  var slotMaksRange = equipmentMaskSlots.slice(start, end);
28240
28122
  return equipmentRange.map(function (data, i) {
28241
28123
  var _ref2;
28242
-
28243
28124
  var item = data;
28244
28125
  var itemContainer = (_ref2 = item && item.itemContainer) != null ? _ref2 : null;
28245
28126
  return React.createElement(ItemSlot, {
@@ -28263,7 +28144,6 @@ var EquipmentSet = function EquipmentSet(_ref) {
28263
28144
  });
28264
28145
  });
28265
28146
  };
28266
-
28267
28147
  return React.createElement(DraggableContainer, {
28268
28148
  title: 'Equipments',
28269
28149
  type: RPGUIContainerTypes.Framed,
@@ -28287,10 +28167,10 @@ var EquipmentColumn = /*#__PURE__*/styled.div.withConfig({
28287
28167
 
28288
28168
  var SlotsContainer = function SlotsContainer(_ref) {
28289
28169
  var children = _ref.children,
28290
- title = _ref.title,
28291
- onClose = _ref.onClose,
28292
- _onPositionChange = _ref.onPositionChange,
28293
- onOutsideClick = _ref.onOutsideClick;
28170
+ title = _ref.title,
28171
+ onClose = _ref.onClose,
28172
+ _onPositionChange = _ref.onPositionChange,
28173
+ onOutsideClick = _ref.onOutsideClick;
28294
28174
  return React.createElement(DraggableContainer, {
28295
28175
  title: title,
28296
28176
  type: RPGUIContainerTypes.Framed,
@@ -28303,8 +28183,7 @@ var SlotsContainer = function SlotsContainer(_ref) {
28303
28183
  cancelDrag: ".item-container-body",
28304
28184
  onPositionChange: function onPositionChange(_ref2) {
28305
28185
  var x = _ref2.x,
28306
- y = _ref2.y;
28307
-
28186
+ y = _ref2.y;
28308
28187
  if (_onPositionChange) {
28309
28188
  _onPositionChange({
28310
28189
  x: x,
@@ -28318,20 +28197,17 @@ var SlotsContainer = function SlotsContainer(_ref) {
28318
28197
 
28319
28198
  var ItemContainer = function ItemContainer(_ref) {
28320
28199
  var itemContainer = _ref.itemContainer,
28321
- onClose = _ref.onClose,
28322
- _onMouseOver = _ref.onMouseOver,
28323
- _onSelected = _ref.onSelected,
28324
- onItemClick = _ref.onItemClick,
28325
- type = _ref.type,
28326
- atlasJSON = _ref.atlasJSON,
28327
- atlasIMG = _ref.atlasIMG;
28328
-
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;
28329
28207
  var onRenderSlots = function onRenderSlots() {
28330
28208
  var slots = [];
28331
-
28332
28209
  for (var i = 0; i < itemContainer.slotQty; i++) {
28333
28210
  var _itemContainer$slots;
28334
-
28335
28211
  slots.push(React.createElement(ItemSlot, {
28336
28212
  key: i,
28337
28213
  slotIndex: i,
@@ -28350,10 +28226,8 @@ var ItemContainer = function ItemContainer(_ref) {
28350
28226
  atlasJSON: atlasJSON
28351
28227
  }));
28352
28228
  }
28353
-
28354
28229
  return slots;
28355
28230
  };
28356
-
28357
28231
  return React.createElement(SlotsContainer, {
28358
28232
  title: itemContainer.name || 'Container',
28359
28233
  onClose: onClose
@@ -28368,11 +28242,11 @@ var ItemsContainer = /*#__PURE__*/styled.div.withConfig({
28368
28242
 
28369
28243
  var ListMenu = function ListMenu(_ref) {
28370
28244
  var options = _ref.options,
28371
- onSelected = _ref.onSelected,
28372
- x = _ref.x,
28373
- y = _ref.y,
28374
- _ref$fontSize = _ref.fontSize,
28375
- 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;
28376
28250
  return React.createElement(Container$a, {
28377
28251
  x: x,
28378
28252
  y: y,
@@ -28416,13 +28290,11 @@ var chunkString = function chunkString(str, length) {
28416
28290
 
28417
28291
  var DynamicText = function DynamicText(_ref) {
28418
28292
  var text = _ref.text,
28419
- onFinish = _ref.onFinish,
28420
- onStart = _ref.onStart;
28421
-
28293
+ onFinish = _ref.onFinish,
28294
+ onStart = _ref.onStart;
28422
28295
  var _useState = useState(''),
28423
- textState = _useState[0],
28424
- setTextState = _useState[1];
28425
-
28296
+ textState = _useState[0],
28297
+ setTextState = _useState[1];
28426
28298
  useEffect(function () {
28427
28299
  var i = 0;
28428
28300
  var interval = setInterval(function () {
@@ -28432,13 +28304,11 @@ var DynamicText = function DynamicText(_ref) {
28432
28304
  onStart();
28433
28305
  }
28434
28306
  }
28435
-
28436
28307
  if (i < text.length) {
28437
28308
  setTextState(text.substring(0, i + 1));
28438
28309
  i++;
28439
28310
  } else {
28440
28311
  clearInterval(interval);
28441
-
28442
28312
  if (onFinish) {
28443
28313
  onFinish();
28444
28314
  }
@@ -28457,19 +28327,16 @@ var TextContainer = /*#__PURE__*/styled.p.withConfig({
28457
28327
 
28458
28328
  var NPCDialogText = function NPCDialogText(_ref) {
28459
28329
  var text = _ref.text,
28460
- onClose = _ref.onClose,
28461
- onEndStep = _ref.onEndStep,
28462
- onStartStep = _ref.onStartStep;
28330
+ onClose = _ref.onClose,
28331
+ onEndStep = _ref.onEndStep,
28332
+ onStartStep = _ref.onStartStep;
28463
28333
  var textChunks = chunkString(text, 85);
28464
-
28465
28334
  var _useState = useState(0),
28466
- chunkIndex = _useState[0],
28467
- setChunkIndex = _useState[1];
28468
-
28335
+ chunkIndex = _useState[0],
28336
+ setChunkIndex = _useState[1];
28469
28337
  var onHandleSpacePress = function onHandleSpacePress(event) {
28470
28338
  if (event.code === 'Space') {
28471
28339
  var hasNextChunk = (textChunks == null ? void 0 : textChunks[chunkIndex + 1]) || false;
28472
-
28473
28340
  if (hasNextChunk) {
28474
28341
  setChunkIndex(function (prev) {
28475
28342
  return prev + 1;
@@ -28480,7 +28347,6 @@ var NPCDialogText = function NPCDialogText(_ref) {
28480
28347
  }
28481
28348
  }
28482
28349
  };
28483
-
28484
28350
  useEffect(function () {
28485
28351
  document.addEventListener('keydown', onHandleSpacePress);
28486
28352
  return function () {
@@ -28498,11 +28364,11 @@ var Container$b = /*#__PURE__*/styled.div.withConfig({
28498
28364
  componentId: "sc-1cxkdh9-0"
28499
28365
  })([""]);
28500
28366
 
28367
+ //@ts-ignore
28501
28368
  var useEventListener = function useEventListener(type, handler, el) {
28502
28369
  if (el === void 0) {
28503
28370
  el = window;
28504
28371
  }
28505
-
28506
28372
  var savedHandler = React.useRef();
28507
28373
  React.useEffect(function () {
28508
28374
  savedHandler.current = handler;
@@ -28512,7 +28378,6 @@ var useEventListener = function useEventListener(type, handler, el) {
28512
28378
  var listener = function listener(e) {
28513
28379
  return savedHandler.current(e);
28514
28380
  };
28515
-
28516
28381
  el.addEventListener(type, listener);
28517
28382
  return function () {
28518
28383
  el.removeEventListener(type, listener);
@@ -28522,36 +28387,29 @@ var useEventListener = function useEventListener(type, handler, el) {
28522
28387
 
28523
28388
  var QuestionDialog = function QuestionDialog(_ref) {
28524
28389
  var questions = _ref.questions,
28525
- answers = _ref.answers,
28526
- onClose = _ref.onClose;
28527
-
28390
+ answers = _ref.answers,
28391
+ onClose = _ref.onClose;
28528
28392
  var _useState = useState(questions[0]),
28529
- currentQuestion = _useState[0],
28530
- setCurrentQuestion = _useState[1];
28531
-
28393
+ currentQuestion = _useState[0],
28394
+ setCurrentQuestion = _useState[1];
28532
28395
  var _useState2 = useState(false),
28533
- canShowAnswers = _useState2[0],
28534
- setCanShowAnswers = _useState2[1];
28535
-
28396
+ canShowAnswers = _useState2[0],
28397
+ setCanShowAnswers = _useState2[1];
28536
28398
  var onGetFirstAnswer = function onGetFirstAnswer() {
28537
28399
  if (!currentQuestion.answerIds || currentQuestion.answerIds.length === 0) {
28538
28400
  return null;
28539
28401
  }
28540
-
28541
28402
  var firstAnswerId = currentQuestion.answerIds[0];
28542
28403
  return answers.find(function (answer) {
28543
28404
  return answer.id === firstAnswerId;
28544
28405
  });
28545
28406
  };
28546
-
28547
28407
  var _useState3 = useState(onGetFirstAnswer()),
28548
- currentAnswer = _useState3[0],
28549
- setCurrentAnswer = _useState3[1];
28550
-
28408
+ currentAnswer = _useState3[0],
28409
+ setCurrentAnswer = _useState3[1];
28551
28410
  useEffect(function () {
28552
28411
  setCurrentAnswer(onGetFirstAnswer());
28553
28412
  }, [currentQuestion]);
28554
-
28555
28413
  var onGetAnswers = function onGetAnswers(answerIds) {
28556
28414
  return answerIds.map(function (answerId) {
28557
28415
  return answers.find(function (answer) {
@@ -28559,7 +28417,6 @@ var QuestionDialog = function QuestionDialog(_ref) {
28559
28417
  });
28560
28418
  });
28561
28419
  };
28562
-
28563
28420
  var onKeyPress = function onKeyPress(e) {
28564
28421
  switch (e.key) {
28565
28422
  case 'ArrowDown':
@@ -28577,7 +28434,6 @@ var QuestionDialog = function QuestionDialog(_ref) {
28577
28434
  });
28578
28435
  setCurrentAnswer(nextAnswer || onGetFirstAnswer());
28579
28436
  break;
28580
-
28581
28437
  case 'ArrowUp':
28582
28438
  // select previous answer, if any.
28583
28439
  // if no previous answer, select last answer
@@ -28588,18 +28444,14 @@ var QuestionDialog = function QuestionDialog(_ref) {
28588
28444
  var previousAnswer = onGetAnswers(currentQuestion.answerIds).find(function (answer) {
28589
28445
  return (answer == null ? void 0 : answer.id) === previousAnswerID;
28590
28446
  });
28591
-
28592
28447
  if (previousAnswer) {
28593
28448
  setCurrentAnswer(previousAnswer);
28594
28449
  } else {
28595
28450
  setCurrentAnswer(onGetAnswers(currentQuestion.answerIds).pop());
28596
28451
  }
28597
-
28598
28452
  break;
28599
-
28600
28453
  case 'Enter':
28601
28454
  setCanShowAnswers(false);
28602
-
28603
28455
  if (!(currentAnswer != null && currentAnswer.nextQuestionId)) {
28604
28456
  onClose();
28605
28457
  return;
@@ -28608,16 +28460,12 @@ var QuestionDialog = function QuestionDialog(_ref) {
28608
28460
  return question.id === currentAnswer.nextQuestionId;
28609
28461
  }));
28610
28462
  }
28611
-
28612
28463
  break;
28613
28464
  }
28614
28465
  };
28615
-
28616
28466
  useEventListener('keydown', onKeyPress);
28617
-
28618
28467
  var onAnswerClick = function onAnswerClick(answer) {
28619
28468
  setCanShowAnswers(false);
28620
-
28621
28469
  if (answer.nextQuestionId) {
28622
28470
  // if there is a next question, go to it
28623
28471
  setCurrentQuestion(questions.find(function (question) {
@@ -28628,24 +28476,18 @@ var QuestionDialog = function QuestionDialog(_ref) {
28628
28476
  onClose();
28629
28477
  }
28630
28478
  };
28631
-
28632
28479
  var onRenderCurrentAnswers = function onRenderCurrentAnswers() {
28633
28480
  var answerIds = currentQuestion.answerIds;
28634
-
28635
28481
  if (!answerIds) {
28636
28482
  return null;
28637
28483
  }
28638
-
28639
28484
  var answers = onGetAnswers(answerIds);
28640
-
28641
28485
  if (!answers) {
28642
28486
  return null;
28643
28487
  }
28644
-
28645
28488
  return answers.map(function (answer) {
28646
28489
  var isSelected = (currentAnswer == null ? void 0 : currentAnswer.id) === (answer == null ? void 0 : answer.id);
28647
28490
  var selectedColor = isSelected ? 'yellow' : 'white';
28648
-
28649
28491
  if (answer) {
28650
28492
  return React.createElement(AnswerRow, {
28651
28493
  key: "answer_" + answer.id
@@ -28659,11 +28501,9 @@ var QuestionDialog = function QuestionDialog(_ref) {
28659
28501
  color: selectedColor
28660
28502
  }, answer.text));
28661
28503
  }
28662
-
28663
28504
  return null;
28664
28505
  });
28665
28506
  };
28666
-
28667
28507
  return React.createElement(Container$c, null, React.createElement(QuestionContainer, null, React.createElement(DynamicText, {
28668
28508
  text: currentQuestion.text,
28669
28509
  onStart: function onStart() {
@@ -28704,26 +28544,22 @@ var AnswerRow = /*#__PURE__*/styled.div.withConfig({
28704
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;}"]);
28705
28545
 
28706
28546
  var NPCDialogType;
28707
-
28708
28547
  (function (NPCDialogType) {
28709
28548
  NPCDialogType["TextOnly"] = "TextOnly";
28710
28549
  NPCDialogType["TextAndThumbnail"] = "TextAndThumbnail";
28711
28550
  })(NPCDialogType || (NPCDialogType = {}));
28712
-
28713
28551
  var NPCDialog = function NPCDialog(_ref) {
28714
28552
  var text = _ref.text,
28715
- type = _ref.type,
28716
- _onClose = _ref.onClose,
28717
- imagePath = _ref.imagePath,
28718
- _ref$isQuestionDialog = _ref.isQuestionDialog,
28719
- isQuestionDialog = _ref$isQuestionDialog === void 0 ? false : _ref$isQuestionDialog,
28720
- questions = _ref.questions,
28721
- answers = _ref.answers;
28722
-
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;
28723
28560
  var _useState = useState(false),
28724
- showGoNextIndicator = _useState[0],
28725
- setShowGoNextIndicator = _useState[1];
28726
-
28561
+ showGoNextIndicator = _useState[0],
28562
+ setShowGoNextIndicator = _useState[1];
28727
28563
  return React.createElement(RPGUIContainer, {
28728
28564
  type: RPGUIContainerTypes.FramedGold,
28729
28565
  width: isQuestionDialog ? '600px' : '50%',
@@ -28791,24 +28627,21 @@ var PressSpaceIndicator = /*#__PURE__*/styled.img.withConfig({
28791
28627
 
28792
28628
  var ProgressBar = function ProgressBar(_ref) {
28793
28629
  var max = _ref.max,
28794
- value = _ref.value,
28795
- color = _ref.color,
28796
- _ref$displayText = _ref.displayText,
28797
- displayText = _ref$displayText === void 0 ? true : _ref$displayText,
28798
- _ref$percentageWidth = _ref.percentageWidth,
28799
- percentageWidth = _ref$percentageWidth === void 0 ? 40 : _ref$percentageWidth,
28800
- _ref$minWidth = _ref.minWidth,
28801
- minWidth = _ref$minWidth === void 0 ? 100 : _ref$minWidth,
28802
- style = _ref.style;
28803
-
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;
28804
28639
  var calculatePercentageValue = function calculatePercentageValue(max, value) {
28805
28640
  if (value > max) {
28806
28641
  value = max;
28807
28642
  }
28808
-
28809
28643
  return value * 100 / max;
28810
28644
  };
28811
-
28812
28645
  return React.createElement(Container$e, {
28813
28646
  className: "rpgui-progress",
28814
28647
  "data-value": calculatePercentageValue(max, value) / 100,
@@ -28853,33 +28686,28 @@ var img$8 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCA
28853
28686
 
28854
28687
  var QuestInfo = function QuestInfo(_ref) {
28855
28688
  var quests = _ref.quests,
28856
- onClose = _ref.onClose,
28857
- buttons = _ref.buttons,
28858
- onChangeQuest = _ref.onChangeQuest;
28859
-
28689
+ onClose = _ref.onClose,
28690
+ buttons = _ref.buttons,
28691
+ onChangeQuest = _ref.onChangeQuest;
28860
28692
  var _useState = useState(0),
28861
- currentIndex = _useState[0],
28862
- setCurrentIndex = _useState[1];
28863
-
28693
+ currentIndex = _useState[0],
28694
+ setCurrentIndex = _useState[1];
28864
28695
  var questsLength = quests.length - 1;
28865
28696
  useEffect(function () {
28866
28697
  if (onChangeQuest) {
28867
28698
  onChangeQuest(currentIndex, quests[currentIndex]._id);
28868
28699
  }
28869
28700
  }, [currentIndex]);
28870
-
28871
28701
  var onLeftClick = function onLeftClick() {
28872
28702
  if (currentIndex === 0) setCurrentIndex(questsLength);else setCurrentIndex(function (index) {
28873
28703
  return index - 1;
28874
28704
  });
28875
28705
  };
28876
-
28877
28706
  var onRightClick = function onRightClick() {
28878
28707
  if (currentIndex === questsLength) setCurrentIndex(0);else setCurrentIndex(function (index) {
28879
28708
  return index + 1;
28880
28709
  });
28881
28710
  };
28882
-
28883
28711
  return React.createElement(QuestDraggableContainer, {
28884
28712
  type: RPGUIContainerTypes.Framed,
28885
28713
  onCloseButton: function onCloseButton() {
@@ -28982,7 +28810,7 @@ var RightArrow$1 = /*#__PURE__*/styled.div.withConfig({
28982
28810
 
28983
28811
  var QuestList = function QuestList(_ref) {
28984
28812
  var quests = _ref.quests,
28985
- onClose = _ref.onClose;
28813
+ onClose = _ref.onClose;
28986
28814
  return React.createElement(QuestDraggableContainer$1, {
28987
28815
  type: RPGUIContainerTypes.Framed,
28988
28816
  onCloseButton: function onCloseButton() {
@@ -29029,19 +28857,16 @@ var NoQuestContainer = /*#__PURE__*/styled.div.withConfig({
29029
28857
 
29030
28858
  var InputRadio = function InputRadio(_ref) {
29031
28859
  var name = _ref.name,
29032
- items = _ref.items,
29033
- onChange = _ref.onChange;
29034
-
28860
+ items = _ref.items,
28861
+ onChange = _ref.onChange;
29035
28862
  var _useState = useState(),
29036
- selectedValue = _useState[0],
29037
- setSelectedValue = _useState[1];
29038
-
28863
+ selectedValue = _useState[0],
28864
+ setSelectedValue = _useState[1];
29039
28865
  var handleClick = function handleClick() {
29040
28866
  var element = document.querySelector("input[name=" + name + "]:checked");
29041
28867
  var elementValue = element.value;
29042
28868
  setSelectedValue(elementValue);
29043
28869
  };
29044
-
29045
28870
  useEffect(function () {
29046
28871
  if (selectedValue) {
29047
28872
  onChange(selectedValue);
@@ -29063,28 +28888,22 @@ var InputRadio = function InputRadio(_ref) {
29063
28888
  };
29064
28889
 
29065
28890
  var RangeSliderType;
29066
-
29067
28891
  (function (RangeSliderType) {
29068
28892
  RangeSliderType["Slider"] = "rpgui-slider";
29069
28893
  RangeSliderType["GoldSlider"] = "rpgui-slider golden";
29070
28894
  })(RangeSliderType || (RangeSliderType = {}));
29071
-
29072
28895
  var RangeSlider = function RangeSlider(_ref) {
29073
28896
  var type = _ref.type,
29074
- valueMin = _ref.valueMin,
29075
- valueMax = _ref.valueMax,
29076
- width = _ref.width,
29077
- onChange = _ref.onChange;
28897
+ valueMin = _ref.valueMin,
28898
+ valueMax = _ref.valueMax,
28899
+ width = _ref.width,
28900
+ onChange = _ref.onChange;
29078
28901
  var sliderId = v4();
29079
-
29080
28902
  var onHandleMouseUp = function onHandleMouseUp() {
29081
28903
  var rpguiSlider = document.getElementById("rpgui-slider-" + sliderId);
29082
-
29083
28904
  var value = _RPGUI.get_value(rpguiSlider);
29084
-
29085
28905
  onChange(Number(value));
29086
28906
  };
29087
-
29088
28907
  return React.createElement("div", {
29089
28908
  onMouseUp: onHandleMouseUp
29090
28909
  }, React.createElement(Input$1, {
@@ -29105,10 +28924,10 @@ var Input$1 = /*#__PURE__*/styled.input.withConfig({
29105
28924
 
29106
28925
  var SimpleProgressBar = function SimpleProgressBar(_ref) {
29107
28926
  var value = _ref.value,
29108
- _ref$bgColor = _ref.bgColor,
29109
- bgColor = _ref$bgColor === void 0 ? 'red' : _ref$bgColor,
29110
- _ref$margin = _ref.margin,
29111
- 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;
29112
28931
  return React.createElement(Container$f, {
29113
28932
  className: "simple-progress-bar"
29114
28933
  }, React.createElement(ProgressBarContainer, {
@@ -29143,16 +28962,18 @@ var ProgressBarContainer = /*#__PURE__*/styled.div.withConfig({
29143
28962
 
29144
28963
  var SkillProgressBar = function SkillProgressBar(_ref) {
29145
28964
  var bgColor = _ref.bgColor,
29146
- skillName = _ref.skillName,
29147
- level = _ref.level,
29148
- skillPoints = _ref.skillPoints,
29149
- texturePath = _ref.texturePath,
29150
- _ref$showSkillPoints = _ref.showSkillPoints,
29151
- 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;
29152
28973
  var spForNextLevel = getSPForLevel(level + 1);
29153
28974
  var ratio = skillPoints / spForNextLevel * 100;
29154
- 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, {
29155
- 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,
29156
28977
  atlasJSON: atlasJSON,
29157
28978
  spriteKey: texturePath,
29158
28979
  imgScale: 1,
@@ -29237,17 +29058,17 @@ var skillProps = {
29237
29058
  };
29238
29059
  var SkillsContainer = function SkillsContainer(_ref) {
29239
29060
  var onCloseButton = _ref.onCloseButton,
29240
- skill = _ref.skill;
29241
-
29061
+ skill = _ref.skill,
29062
+ atlasIMG = _ref.atlasIMG,
29063
+ atlasJSON = _ref.atlasJSON;
29242
29064
  var onRenderSkillCategory = function onRenderSkillCategory(category) {
29243
29065
  var skillCategory = skillProps[category];
29244
29066
  var skillCategoryColor = skillCategory.color;
29245
29067
  var output = [];
29246
-
29247
29068
  for (var _i = 0, _Object$entries = Object.entries(skillCategory.values); _i < _Object$entries.length; _i++) {
29248
29069
  var _Object$entries$_i = _Object$entries[_i],
29249
- key = _Object$entries$_i[0],
29250
- value = _Object$entries$_i[1];
29070
+ key = _Object$entries$_i[0],
29071
+ value = _Object$entries$_i[1];
29251
29072
  //@ts-ignore
29252
29073
  var skillDetails = skill[key];
29253
29074
  output.push(React.createElement(SkillProgressBar, {
@@ -29257,13 +29078,13 @@ var SkillsContainer = function SkillsContainer(_ref) {
29257
29078
  level: skillDetails.level || 0,
29258
29079
  skillPoints: Math.round(skillDetails.skillPoints) || 0,
29259
29080
  skillPointsToNextLevel: Math.round(skillDetails.skillPointsToNextLevel) || 0,
29260
- texturePath: value
29081
+ texturePath: value,
29082
+ atlasIMG: atlasIMG,
29083
+ atlasJSON: atlasJSON
29261
29084
  }));
29262
29085
  }
29263
-
29264
29086
  return output;
29265
29087
  };
29266
-
29267
29088
  return React.createElement(SkillsDraggableContainer, {
29268
29089
  title: "Skills"
29269
29090
  }, onCloseButton && React.createElement(CloseButton$2, {
@@ -29277,7 +29098,9 @@ var SkillsContainer = function SkillsContainer(_ref) {
29277
29098
  level: Math.round(skill.level) || 0,
29278
29099
  skillPoints: Math.round(skill.experience) || 0,
29279
29100
  skillPointsToNextLevel: Math.round(skill.xpToNextLevel) || 0,
29280
- texturePath: 'swords/broad-sword.png'
29101
+ texturePath: 'swords/broad-sword.png',
29102
+ atlasIMG: atlasIMG,
29103
+ atlasJSON: atlasJSON
29281
29104
  }), React.createElement("p", null, "Combat Skills"), React.createElement("hr", {
29282
29105
  className: "golden"
29283
29106
  })), onRenderSkillCategory('combat'), React.createElement(SkillSplitDiv, null, React.createElement("p", null, "Crafting Skills"), React.createElement("hr", {
@@ -29300,16 +29123,15 @@ var CloseButton$2 = /*#__PURE__*/styled.div.withConfig({
29300
29123
  })(["position:absolute;top:2px;right:2px;color:white;z-index:22;font-size:0.7rem;"]);
29301
29124
 
29302
29125
  var TextArea = function TextArea(_ref) {
29303
- var props = _extends({}, _ref);
29304
-
29126
+ var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
29305
29127
  return React.createElement("textarea", Object.assign({}, props));
29306
29128
  };
29307
29129
 
29308
29130
  /* eslint-disable react/require-default-props */
29309
29131
  var Truncate = function Truncate(_ref) {
29310
29132
  var _ref$maxLines = _ref.maxLines,
29311
- maxLines = _ref$maxLines === void 0 ? 1 : _ref$maxLines,
29312
- children = _ref.children;
29133
+ maxLines = _ref$maxLines === void 0 ? 1 : _ref$maxLines,
29134
+ children = _ref.children;
29313
29135
  return React.createElement(Container$g, {
29314
29136
  maxLines: maxLines
29315
29137
  }, children);
@@ -29322,26 +29144,20 @@ var Container$g = /*#__PURE__*/styled.div.withConfig({
29322
29144
  });
29323
29145
 
29324
29146
  var ImgSide;
29325
-
29326
29147
  (function (ImgSide) {
29327
29148
  ImgSide["right"] = "right";
29328
29149
  ImgSide["left"] = "left";
29329
29150
  })(ImgSide || (ImgSide = {}));
29330
-
29331
29151
  var NPCMultiDialog = function NPCMultiDialog(_ref) {
29332
29152
  var _textAndTypeArray$sli;
29333
-
29334
29153
  var _onClose = _ref.onClose,
29335
- textAndTypeArray = _ref.textAndTypeArray;
29336
-
29154
+ textAndTypeArray = _ref.textAndTypeArray;
29337
29155
  var _useState = useState(false),
29338
- showGoNextIndicator = _useState[0],
29339
- setShowGoNextIndicator = _useState[1];
29340
-
29156
+ showGoNextIndicator = _useState[0],
29157
+ setShowGoNextIndicator = _useState[1];
29341
29158
  var _useState2 = useState(0),
29342
- slide = _useState2[0],
29343
- setSlide = _useState2[1];
29344
-
29159
+ slide = _useState2[0],
29160
+ setSlide = _useState2[1];
29345
29161
  var onHandleSpacePress = function onHandleSpacePress(event) {
29346
29162
  if (event.code === 'Space') {
29347
29163
  if (slide < (textAndTypeArray == null ? void 0 : textAndTypeArray.length) - 1) {
@@ -29354,7 +29170,6 @@ var NPCMultiDialog = function NPCMultiDialog(_ref) {
29354
29170
  }
29355
29171
  }
29356
29172
  };
29357
-
29358
29173
  useEffect(function () {
29359
29174
  document.addEventListener('keydown', onHandleSpacePress);
29360
29175
  return function () {
@@ -29436,18 +29251,16 @@ var PressSpaceIndicator$1 = /*#__PURE__*/styled.img.withConfig({
29436
29251
 
29437
29252
  var HistoryDialog = function HistoryDialog(_ref) {
29438
29253
  var backgroundImgPath = _ref.backgroundImgPath,
29439
- fullCoverBackground = _ref.fullCoverBackground,
29440
- questions = _ref.questions,
29441
- answers = _ref.answers,
29442
- text = _ref.text,
29443
- imagePath = _ref.imagePath,
29444
- textAndTypeArray = _ref.textAndTypeArray,
29445
- onClose = _ref.onClose;
29446
-
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;
29447
29261
  var _useState = useState(0),
29448
- img = _useState[0],
29449
- setImage = _useState[1];
29450
-
29262
+ img = _useState[0],
29263
+ setImage = _useState[1];
29451
29264
  var onHandleSpacePress = function onHandleSpacePress(event) {
29452
29265
  if (event.code === 'Space') {
29453
29266
  if (img < (backgroundImgPath == null ? void 0 : backgroundImgPath.length) - 1) {
@@ -29460,7 +29273,6 @@ var HistoryDialog = function HistoryDialog(_ref) {
29460
29273
  }
29461
29274
  }
29462
29275
  };
29463
-
29464
29276
  useEffect(function () {
29465
29277
  document.addEventListener('keydown', onHandleSpacePress);
29466
29278
  return function () {
@@ -29501,5 +29313,182 @@ var DialogContainer = /*#__PURE__*/styled.div.withConfig({
29501
29313
  componentId: "sc-u6oe75-1"
29502
29314
  })(["display:flex;justify-content:center;padding-top:200px;"]);
29503
29315
 
29504
- 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 };
29505
29494
  //# sourceMappingURL=long-bow.esm.js.map