@rpg-engine/long-bow 0.5.2 → 0.5.4

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.
@@ -111,7 +111,9 @@ var SpriteFromAtlas = function SpriteFromAtlas(_ref) {
111
111
  grayScale = _ref$grayScale === void 0 ? false : _ref$grayScale,
112
112
  _ref$opacity = _ref.opacity,
113
113
  opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
114
- imgClassname = _ref.imgClassname;
114
+ imgClassname = _ref.imgClassname,
115
+ centered = _ref.centered,
116
+ borderRadius = _ref.borderRadius;
115
117
  //! 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).
116
118
  //!Due to React's limitations, we cannot import it from the public folder directly!
117
119
  var spriteData = atlasJSON.frames[spriteKey] || atlasJSON.frames['others/no-image.png'];
@@ -129,7 +131,9 @@ var SpriteFromAtlas = function SpriteFromAtlas(_ref) {
129
131
  scale: imgScale,
130
132
  grayScale: grayScale,
131
133
  opacity: opacity,
132
- style: imgStyle
134
+ style: imgStyle,
135
+ centered: centered,
136
+ borderRadius: borderRadius
133
137
  }));
134
138
  };
135
139
  var Container = /*#__PURE__*/styled.div.withConfig({
@@ -145,7 +149,7 @@ var Container = /*#__PURE__*/styled.div.withConfig({
145
149
  var ImgSprite = /*#__PURE__*/styled.div.withConfig({
146
150
  displayName: "SpriteFromAtlas__ImgSprite",
147
151
  componentId: "sc-1lpani8-1"
148
- })(["width:", "px;height:", "px;background-image:url(", ");background-position:-", "px -", "px;transform:scale(", ");position:relative;top:8px;left:8px;filter:", ";opacity:", ";"], function (props) {
152
+ })(["width:", "px;height:", "px;background-image:url(", ");background-position:-", "px -", "px;transform:scale(", ");position:relative;top:", ";left:", ";filter:", ";opacity:", ";border-radius:", ";"], function (props) {
149
153
  return props.frame.w;
150
154
  }, function (props) {
151
155
  return props.frame.h;
@@ -157,10 +161,16 @@ var ImgSprite = /*#__PURE__*/styled.div.withConfig({
157
161
  return props.frame.y;
158
162
  }, function (props) {
159
163
  return props.scale;
164
+ }, function (props) {
165
+ return props.centered ? '0' : '8px';
166
+ }, function (props) {
167
+ return props.centered ? '0' : '8px';
160
168
  }, function (props) {
161
169
  return props.grayScale ? 'grayscale(100%)' : 'none';
162
170
  }, function (props) {
163
171
  return props.opacity;
172
+ }, function (props) {
173
+ return props.borderRadius ? props.borderRadius : '0';
164
174
  });
165
175
 
166
176
  var frames = {
@@ -12954,6 +12964,11 @@ var CircularController = function CircularController(_ref) {
12954
12964
  var spellCooldown = !payload ? 0 : (_spellCooldowns$paylo = spellCooldowns == null ? void 0 : spellCooldowns[payload.magicWords.replaceAll(' ', '_')]) != null ? _spellCooldowns$paylo : shortcutCooldown;
12955
12965
  var cooldown = spellCooldown > shortcutCooldown ? spellCooldown : shortcutCooldown;
12956
12966
  var isOnCooldown = cooldown > 0 && !!payload;
12967
+ var CONTAINER_STYLE = {
12968
+ width: '32px',
12969
+ height: '32px'
12970
+ };
12971
+ var IMAGE_SCALE = 1.5;
12957
12972
  return React.createElement(StyledShortcut, {
12958
12973
  key: i,
12959
12974
  onTouchStart: onTouchStart,
@@ -12966,7 +12981,15 @@ var CircularController = function CircularController(_ref) {
12966
12981
  className: buildClassName('mana', isOnCooldown)
12967
12982
  }, payload && payload.manaCost), React.createElement("span", {
12968
12983
  className: "magicWords"
12969
- }, payload == null ? void 0 : payload.magicWords.split(' ').map(function (word) {
12984
+ }, payload != null && payload.texturePath ? React.createElement(SpriteFromAtlas, {
12985
+ atlasIMG: payload.atlasIMG,
12986
+ atlasJSON: payload.atlasJSON,
12987
+ spriteKey: payload.texturePath,
12988
+ imgScale: IMAGE_SCALE,
12989
+ containerStyle: CONTAINER_STYLE,
12990
+ centered: true,
12991
+ borderRadius: "50%"
12992
+ }) : payload == null ? void 0 : payload.magicWords.split(' ').map(function (word) {
12970
12993
  return word[0];
12971
12994
  })));
12972
12995
  };
@@ -15140,7 +15163,8 @@ var DialogContainer = /*#__PURE__*/styled.div.withConfig({
15140
15163
  var ImageCarousel = function ImageCarousel(_ref) {
15141
15164
  var _textImageSelected$te, _textImageSelected$te2;
15142
15165
  var textImage = _ref.textImage,
15143
- isTextFixed = _ref.isTextFixed;
15166
+ isTextFixed = _ref.isTextFixed,
15167
+ onCloseButton = _ref.onCloseButton;
15144
15168
  var _useState = useState(textImage[0]),
15145
15169
  textImageSelected = _useState[0],
15146
15170
  setTextImageSelected = _useState[1];
@@ -15194,7 +15218,10 @@ var ImageCarousel = function ImageCarousel(_ref) {
15194
15218
  onPointerDown: function onPointerDown() {
15195
15219
  return goToNextImage();
15196
15220
  }
15197
- }))));
15221
+ }))), onCloseButton && React.createElement(CloseButton$2, {
15222
+ className: "container-close",
15223
+ onPointerDown: onCloseButton
15224
+ }, "X"));
15198
15225
  };
15199
15226
  var CarouselWrapper = /*#__PURE__*/styled(DraggableContainer).withConfig({
15200
15227
  displayName: "ImageCarousel__CarouselWrapper",
@@ -15222,6 +15249,10 @@ var Description$1 = /*#__PURE__*/styled.div.withConfig({
15222
15249
  }, function (props) {
15223
15250
  return props.isTextFixed ? 'none' : 'rgba(0, 0, 0, 0.6)';
15224
15251
  });
15252
+ var CloseButton$2 = /*#__PURE__*/styled.div.withConfig({
15253
+ displayName: "ImageCarousel__CloseButton",
15254
+ componentId: "sc-jl6f8-4"
15255
+ })(["position:absolute;top:3px;right:0px;color:white;z-index:22;font-size:1.5rem;@media (max-width:950px){font-size:1.7rem;padding:12px;}"]);
15225
15256
 
15226
15257
  var SlotsContainer = function SlotsContainer(_ref) {
15227
15258
  var children = _ref.children,
@@ -15371,7 +15402,7 @@ var ItemQuantitySelector = function ItemQuantitySelector(_ref) {
15371
15402
  return React.createElement(StyledContainer, {
15372
15403
  type: RPGUIContainerTypes.Framed,
15373
15404
  width: "25rem"
15374
- }, React.createElement(CloseButton$2, {
15405
+ }, React.createElement(CloseButton$3, {
15375
15406
  className: "container-close",
15376
15407
  onPointerDown: onClose
15377
15408
  }, "X"), React.createElement("h2", null, "Select quantity to move"), React.createElement(StyledForm, {
@@ -15429,7 +15460,7 @@ var StyledInput = /*#__PURE__*/styled(Input).withConfig({
15429
15460
  displayName: "ItemQuantitySelector__StyledInput",
15430
15461
  componentId: "sc-yfdtpn-2"
15431
15462
  })(["text-align:center;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}&[type='number']{-moz-appearance:textfield;}"]);
15432
- var CloseButton$2 = /*#__PURE__*/styled.div.withConfig({
15463
+ var CloseButton$3 = /*#__PURE__*/styled.div.withConfig({
15433
15464
  displayName: "ItemQuantitySelector__CloseButton",
15434
15465
  componentId: "sc-yfdtpn-3"
15435
15466
  })(["position:absolute;top:3px;right:0px;color:white;z-index:22;font-size:0.8rem;"]);
@@ -15442,19 +15473,19 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
15442
15473
  atlasJSON = _ref.atlasJSON,
15443
15474
  atlasIMG = _ref.atlasIMG;
15444
15475
  var getContent = function getContent(index) {
15445
- var _shortcuts$index, _shortcuts$index3;
15476
+ var _shortcuts$index;
15446
15477
  if (((_shortcuts$index = shortcuts[index]) == null ? void 0 : _shortcuts$index.type) === ShortcutType.Item) {
15447
15478
  var _shortcuts$index2;
15448
- var _payload = (_shortcuts$index2 = shortcuts[index]) == null ? void 0 : _shortcuts$index2.payload;
15449
- if (!_payload) return null;
15479
+ var payload = (_shortcuts$index2 = shortcuts[index]) == null ? void 0 : _shortcuts$index2.payload;
15480
+ if (!payload) return null;
15450
15481
  return React.createElement(SpriteFromAtlas, {
15451
15482
  atlasIMG: atlasIMG,
15452
15483
  atlasJSON: atlasJSON,
15453
15484
  spriteKey: getItemTextureKeyPath({
15454
- key: _payload.texturePath,
15455
- texturePath: _payload.texturePath,
15456
- stackQty: _payload.stackQty || 1,
15457
- isStackable: _payload.isStackable
15485
+ key: payload.texturePath,
15486
+ texturePath: payload.texturePath,
15487
+ stackQty: payload.stackQty || 1,
15488
+ isStackable: payload.isStackable
15458
15489
  }, atlasJSON),
15459
15490
  width: 32,
15460
15491
  height: 32,
@@ -15464,10 +15495,24 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
15464
15495
  }
15465
15496
  });
15466
15497
  }
15467
- var payload = (_shortcuts$index3 = shortcuts[index]) == null ? void 0 : _shortcuts$index3.payload;
15468
- return React.createElement("span", null, payload == null ? void 0 : payload.magicWords.split(' ').map(function (word) {
15469
- return word[0];
15470
- }));
15498
+ var IMAGE_SIZE = 32;
15499
+ var IMAGE_SCALE = 1;
15500
+ var shortcut = shortcuts[index];
15501
+ if ((shortcut == null ? void 0 : shortcut.type) === ShortcutType.Spell && shortcut.payload) {
15502
+ var _payload$texturePath;
15503
+ var _payload = shortcut.payload; // TypeScript type assertion
15504
+ return React.createElement(SpriteFromAtlas, {
15505
+ atlasIMG: _payload.atlasIMG,
15506
+ atlasJSON: _payload.atlasJSON,
15507
+ spriteKey: (_payload$texturePath = _payload.texturePath) != null ? _payload$texturePath : '',
15508
+ width: IMAGE_SIZE,
15509
+ height: IMAGE_SIZE,
15510
+ imgScale: IMAGE_SCALE,
15511
+ centered: true,
15512
+ borderRadius: "50%"
15513
+ });
15514
+ }
15515
+ return null;
15471
15516
  };
15472
15517
  return React.createElement(Container$i, null, React.createElement("p", null, "Shortcuts:"), React.createElement(List, {
15473
15518
  id: "shortcuts_list"
@@ -16986,7 +17031,7 @@ var Shortcuts = function Shortcuts(_ref) {
16986
17031
  return React.createElement(List$1, null, Array.from({
16987
17032
  length: 12
16988
17033
  }).map(function (_, i) {
16989
- var _shortcuts$i, _shortcuts$i3, _spellCooldowns$paylo, _payload$manaCost;
17034
+ var _shortcuts$i, _shortcuts$i3, _spellCooldowns$paylo, _payload$manaCost, _payload$texturePath;
16990
17035
  var buildClassName = function buildClassName(classBase, isOnCooldown) {
16991
17036
  return classBase + " " + (isOnCooldown ? 'onCooldown' : '');
16992
17037
  };
@@ -17035,6 +17080,8 @@ var Shortcuts = function Shortcuts(_ref) {
17035
17080
  var spellCooldown = !payload ? 0 : (_spellCooldowns$paylo = spellCooldowns == null ? void 0 : spellCooldowns[payload.magicWords.replaceAll(' ', '_')]) != null ? _spellCooldowns$paylo : shortcutCooldown;
17036
17081
  var cooldown = spellCooldown > shortcutCooldown ? spellCooldown : shortcutCooldown;
17037
17082
  var isOnCooldown = cooldown > 0 && !!payload;
17083
+ var IMAGE_SCALE = 1.5;
17084
+ var IMAGE_SIZE = 32;
17038
17085
  return React.createElement(StyledShortcut$1, {
17039
17086
  key: i,
17040
17087
  onPointerDown: handleShortcutCast.bind(null, i),
@@ -17044,13 +17091,18 @@ var Shortcuts = function Shortcuts(_ref) {
17044
17091
  }
17045
17092
  }, isOnCooldown && React.createElement("span", {
17046
17093
  className: "cooldown"
17047
- }, cooldown.toFixed(cooldown < 10 ? 1 : 0)), React.createElement("span", {
17094
+ }, cooldown.toFixed(cooldown < 10 ? 1 : 0)), React.createElement("span", null, (payload == null ? void 0 : payload.atlasIMG) && React.createElement(SpriteFromAtlas, {
17095
+ atlasIMG: payload.atlasIMG,
17096
+ atlasJSON: payload.atlasJSON,
17097
+ spriteKey: (_payload$texturePath = payload.texturePath) != null ? _payload$texturePath : '',
17098
+ width: IMAGE_SIZE,
17099
+ height: IMAGE_SIZE,
17100
+ imgScale: IMAGE_SCALE,
17101
+ centered: true,
17102
+ borderRadius: "50%"
17103
+ })), React.createElement("span", {
17048
17104
  className: buildClassName('mana', isOnCooldown)
17049
17105
  }, payload && payload.manaCost), React.createElement("span", {
17050
- className: "magicWords"
17051
- }, payload == null ? void 0 : payload.magicWords.split(' ').map(function (word) {
17052
- return word[0];
17053
- })), React.createElement("span", {
17054
17106
  className: buildClassName('keyboard', isOnCooldown)
17055
17107
  }, i + 1));
17056
17108
  }));
@@ -17310,7 +17362,7 @@ var SkillsContainer = function SkillsContainer(_ref) {
17310
17362
  cancelDrag: "#skillsDiv",
17311
17363
  scale: scale,
17312
17364
  width: "100%"
17313
- }, onCloseButton && React.createElement(CloseButton$3, {
17365
+ }, onCloseButton && React.createElement(CloseButton$4, {
17314
17366
  onPointerDown: onCloseButton
17315
17367
  }, "X"), React.createElement(SkillsContainerDiv, {
17316
17368
  id: "skillsDiv"
@@ -17346,7 +17398,7 @@ var SkillSplitDiv = /*#__PURE__*/styled.div.withConfig({
17346
17398
  displayName: "SkillsContainer__SkillSplitDiv",
17347
17399
  componentId: "sc-1g0c67q-2"
17348
17400
  })(["width:100%;font-size:11px;hr{margin:0;margin-bottom:1rem;padding:0px;}p{margin-bottom:0px;}"]);
17349
- var CloseButton$3 = /*#__PURE__*/styled.div.withConfig({
17401
+ var CloseButton$4 = /*#__PURE__*/styled.div.withConfig({
17350
17402
  displayName: "SkillsContainer__CloseButton",
17351
17403
  componentId: "sc-1g0c67q-3"
17352
17404
  })(["position:absolute;top:2px;right:2px;color:white;z-index:22;font-size:1.1rem;"]);
@@ -17557,7 +17609,10 @@ var SpellInfoWrapper = function SpellInfoWrapper(_ref) {
17557
17609
  };
17558
17610
 
17559
17611
  var Spell = function Spell(_ref) {
17560
- var spellKey = _ref.spellKey,
17612
+ var _spell$texturePath;
17613
+ var atlasIMG = _ref.atlasIMG,
17614
+ atlasJSON = _ref.atlasJSON,
17615
+ spellKey = _ref.spellKey,
17561
17616
  charMana = _ref.charMana,
17562
17617
  charMagicLevel = _ref.charMagicLevel,
17563
17618
  onPointerUp = _ref.onPointerUp,
@@ -17570,6 +17625,11 @@ var Spell = function Spell(_ref) {
17570
17625
  name = spell.name,
17571
17626
  description = spell.description;
17572
17627
  var disabled = isSettingShortcut ? charMagicLevel < minMagicLevelRequired : manaCost > charMana || charMagicLevel < minMagicLevelRequired;
17628
+ var CONTAINER_STYLE = {
17629
+ width: '32px',
17630
+ height: '32px'
17631
+ };
17632
+ var IMAGE_SCALE = 2;
17573
17633
  return React.createElement(SpellInfoWrapper, {
17574
17634
  spell: spell
17575
17635
  }, React.createElement(Container$r, {
@@ -17578,8 +17638,13 @@ var Spell = function Spell(_ref) {
17578
17638
  className: "spell"
17579
17639
  }, disabled && React.createElement(Overlay, null, charMagicLevel < minMagicLevelRequired ? 'Low magic level' : manaCost > charMana && 'No mana'), React.createElement(SpellImage, null, activeCooldown && activeCooldown > 0 ? React.createElement("span", {
17580
17640
  className: "cooldown"
17581
- }, activeCooldown.toFixed(activeCooldown > 10 ? 0 : 1)) : null, magicWords.split(' ').map(function (word) {
17582
- return word[0];
17641
+ }, activeCooldown.toFixed(activeCooldown > 10 ? 0 : 1)) : null, React.createElement(SpriteFromAtlas, {
17642
+ atlasIMG: atlasIMG,
17643
+ atlasJSON: atlasJSON,
17644
+ spriteKey: (_spell$texturePath = spell.texturePath) != null ? _spell$texturePath : '',
17645
+ imgScale: IMAGE_SCALE,
17646
+ containerStyle: CONTAINER_STYLE,
17647
+ centered: true
17583
17648
  })), React.createElement(Info, null, React.createElement(Title$a, null, React.createElement("span", null, name), React.createElement("span", {
17584
17649
  className: "spell"
17585
17650
  }, "(", magicWords, ")")), React.createElement(Description$3, null, description)), React.createElement(Divider, null), React.createElement(Cost, null, React.createElement("span", null, "Mana cost:"), React.createElement("span", {
@@ -17635,6 +17700,8 @@ var Spellbook = function Spellbook(_ref) {
17635
17700
  removeShortcut = _ref.removeShortcut,
17636
17701
  atlasIMG = _ref.atlasIMG,
17637
17702
  atlasJSON = _ref.atlasJSON,
17703
+ iconAtlasIMG = _ref.iconAtlasIMG,
17704
+ iconAtlasJSON = _ref.iconAtlasJSON,
17638
17705
  scale = _ref.scale,
17639
17706
  spellCooldowns = _ref.spellCooldowns;
17640
17707
  var _useState = useState(''),
@@ -17683,6 +17750,8 @@ var Spellbook = function Spellbook(_ref) {
17683
17750
  return React.createElement(Fragment, {
17684
17751
  key: spell.key
17685
17752
  }, React.createElement(Spell, Object.assign({
17753
+ atlasIMG: iconAtlasIMG,
17754
+ atlasJSON: iconAtlasJSON,
17686
17755
  charMana: mana,
17687
17756
  charMagicLevel: magicLevel,
17688
17757
  onPointerUp: settingShortcutIndex !== -1 ? setShortcut : onSpellClick,
@@ -17739,7 +17808,7 @@ var TimeWidget = function TimeWidget(_ref) {
17739
17808
  scale = _ref.scale;
17740
17809
  return React.createElement(Draggable, {
17741
17810
  scale: scale
17742
- }, React.createElement(WidgetContainer, null, React.createElement(CloseButton$4, {
17811
+ }, React.createElement(WidgetContainer, null, React.createElement(CloseButton$5, {
17743
17812
  onPointerDown: onClose
17744
17813
  }, "X"), React.createElement(DayNightContainer, null, React.createElement(DayNightPeriod, {
17745
17814
  periodOfDay: periodOfDay
@@ -17753,7 +17822,7 @@ var Time = /*#__PURE__*/styled.div.withConfig({
17753
17822
  displayName: "TimeWidget__Time",
17754
17823
  componentId: "sc-1ja236h-1"
17755
17824
  })(["top:0.75rem;right:0.5rem;position:absolute;font-size:", ";color:white;"], uiFonts.size.small);
17756
- var CloseButton$4 = /*#__PURE__*/styled.p.withConfig({
17825
+ var CloseButton$5 = /*#__PURE__*/styled.p.withConfig({
17757
17826
  displayName: "TimeWidget__CloseButton",
17758
17827
  componentId: "sc-1ja236h-2"
17759
17828
  })(["position:absolute;top:-0.5rem;margin:0;right:-0.2rem;font-size:", " !important;z-index:1;"], uiFonts.size.small);