@rpg-engine/long-bow 0.5.2 → 0.5.3

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
  };
@@ -15442,19 +15465,19 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
15442
15465
  atlasJSON = _ref.atlasJSON,
15443
15466
  atlasIMG = _ref.atlasIMG;
15444
15467
  var getContent = function getContent(index) {
15445
- var _shortcuts$index, _shortcuts$index3;
15468
+ var _shortcuts$index;
15446
15469
  if (((_shortcuts$index = shortcuts[index]) == null ? void 0 : _shortcuts$index.type) === ShortcutType.Item) {
15447
15470
  var _shortcuts$index2;
15448
- var _payload = (_shortcuts$index2 = shortcuts[index]) == null ? void 0 : _shortcuts$index2.payload;
15449
- if (!_payload) return null;
15471
+ var payload = (_shortcuts$index2 = shortcuts[index]) == null ? void 0 : _shortcuts$index2.payload;
15472
+ if (!payload) return null;
15450
15473
  return React.createElement(SpriteFromAtlas, {
15451
15474
  atlasIMG: atlasIMG,
15452
15475
  atlasJSON: atlasJSON,
15453
15476
  spriteKey: getItemTextureKeyPath({
15454
- key: _payload.texturePath,
15455
- texturePath: _payload.texturePath,
15456
- stackQty: _payload.stackQty || 1,
15457
- isStackable: _payload.isStackable
15477
+ key: payload.texturePath,
15478
+ texturePath: payload.texturePath,
15479
+ stackQty: payload.stackQty || 1,
15480
+ isStackable: payload.isStackable
15458
15481
  }, atlasJSON),
15459
15482
  width: 32,
15460
15483
  height: 32,
@@ -15464,10 +15487,24 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
15464
15487
  }
15465
15488
  });
15466
15489
  }
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
- }));
15490
+ var IMAGE_SIZE = 32;
15491
+ var IMAGE_SCALE = 1;
15492
+ var shortcut = shortcuts[index];
15493
+ if ((shortcut == null ? void 0 : shortcut.type) === ShortcutType.Spell && shortcut.payload) {
15494
+ var _payload$texturePath;
15495
+ var _payload = shortcut.payload; // TypeScript type assertion
15496
+ return React.createElement(SpriteFromAtlas, {
15497
+ atlasIMG: _payload.atlasIMG,
15498
+ atlasJSON: _payload.atlasJSON,
15499
+ spriteKey: (_payload$texturePath = _payload.texturePath) != null ? _payload$texturePath : '',
15500
+ width: IMAGE_SIZE,
15501
+ height: IMAGE_SIZE,
15502
+ imgScale: IMAGE_SCALE,
15503
+ centered: true,
15504
+ borderRadius: "50%"
15505
+ });
15506
+ }
15507
+ return null;
15471
15508
  };
15472
15509
  return React.createElement(Container$i, null, React.createElement("p", null, "Shortcuts:"), React.createElement(List, {
15473
15510
  id: "shortcuts_list"
@@ -16986,7 +17023,7 @@ var Shortcuts = function Shortcuts(_ref) {
16986
17023
  return React.createElement(List$1, null, Array.from({
16987
17024
  length: 12
16988
17025
  }).map(function (_, i) {
16989
- var _shortcuts$i, _shortcuts$i3, _spellCooldowns$paylo, _payload$manaCost;
17026
+ var _shortcuts$i, _shortcuts$i3, _spellCooldowns$paylo, _payload$manaCost, _payload$texturePath;
16990
17027
  var buildClassName = function buildClassName(classBase, isOnCooldown) {
16991
17028
  return classBase + " " + (isOnCooldown ? 'onCooldown' : '');
16992
17029
  };
@@ -17035,6 +17072,8 @@ var Shortcuts = function Shortcuts(_ref) {
17035
17072
  var spellCooldown = !payload ? 0 : (_spellCooldowns$paylo = spellCooldowns == null ? void 0 : spellCooldowns[payload.magicWords.replaceAll(' ', '_')]) != null ? _spellCooldowns$paylo : shortcutCooldown;
17036
17073
  var cooldown = spellCooldown > shortcutCooldown ? spellCooldown : shortcutCooldown;
17037
17074
  var isOnCooldown = cooldown > 0 && !!payload;
17075
+ var IMAGE_SCALE = 1.5;
17076
+ var IMAGE_SIZE = 32;
17038
17077
  return React.createElement(StyledShortcut$1, {
17039
17078
  key: i,
17040
17079
  onPointerDown: handleShortcutCast.bind(null, i),
@@ -17044,13 +17083,18 @@ var Shortcuts = function Shortcuts(_ref) {
17044
17083
  }
17045
17084
  }, isOnCooldown && React.createElement("span", {
17046
17085
  className: "cooldown"
17047
- }, cooldown.toFixed(cooldown < 10 ? 1 : 0)), React.createElement("span", {
17086
+ }, cooldown.toFixed(cooldown < 10 ? 1 : 0)), React.createElement("span", null, (payload == null ? void 0 : payload.atlasIMG) && React.createElement(SpriteFromAtlas, {
17087
+ atlasIMG: payload.atlasIMG,
17088
+ atlasJSON: payload.atlasJSON,
17089
+ spriteKey: (_payload$texturePath = payload.texturePath) != null ? _payload$texturePath : '',
17090
+ width: IMAGE_SIZE,
17091
+ height: IMAGE_SIZE,
17092
+ imgScale: IMAGE_SCALE,
17093
+ centered: true,
17094
+ borderRadius: "50%"
17095
+ })), React.createElement("span", {
17048
17096
  className: buildClassName('mana', isOnCooldown)
17049
17097
  }, 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
17098
  className: buildClassName('keyboard', isOnCooldown)
17055
17099
  }, i + 1));
17056
17100
  }));
@@ -17557,7 +17601,10 @@ var SpellInfoWrapper = function SpellInfoWrapper(_ref) {
17557
17601
  };
17558
17602
 
17559
17603
  var Spell = function Spell(_ref) {
17560
- var spellKey = _ref.spellKey,
17604
+ var _spell$texturePath;
17605
+ var atlasIMG = _ref.atlasIMG,
17606
+ atlasJSON = _ref.atlasJSON,
17607
+ spellKey = _ref.spellKey,
17561
17608
  charMana = _ref.charMana,
17562
17609
  charMagicLevel = _ref.charMagicLevel,
17563
17610
  onPointerUp = _ref.onPointerUp,
@@ -17570,6 +17617,11 @@ var Spell = function Spell(_ref) {
17570
17617
  name = spell.name,
17571
17618
  description = spell.description;
17572
17619
  var disabled = isSettingShortcut ? charMagicLevel < minMagicLevelRequired : manaCost > charMana || charMagicLevel < minMagicLevelRequired;
17620
+ var CONTAINER_STYLE = {
17621
+ width: '32px',
17622
+ height: '32px'
17623
+ };
17624
+ var IMAGE_SCALE = 2;
17573
17625
  return React.createElement(SpellInfoWrapper, {
17574
17626
  spell: spell
17575
17627
  }, React.createElement(Container$r, {
@@ -17578,8 +17630,13 @@ var Spell = function Spell(_ref) {
17578
17630
  className: "spell"
17579
17631
  }, 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
17632
  className: "cooldown"
17581
- }, activeCooldown.toFixed(activeCooldown > 10 ? 0 : 1)) : null, magicWords.split(' ').map(function (word) {
17582
- return word[0];
17633
+ }, activeCooldown.toFixed(activeCooldown > 10 ? 0 : 1)) : null, React.createElement(SpriteFromAtlas, {
17634
+ atlasIMG: atlasIMG,
17635
+ atlasJSON: atlasJSON,
17636
+ spriteKey: (_spell$texturePath = spell.texturePath) != null ? _spell$texturePath : '',
17637
+ imgScale: IMAGE_SCALE,
17638
+ containerStyle: CONTAINER_STYLE,
17639
+ centered: true
17583
17640
  })), React.createElement(Info, null, React.createElement(Title$a, null, React.createElement("span", null, name), React.createElement("span", {
17584
17641
  className: "spell"
17585
17642
  }, "(", 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 +17692,8 @@ var Spellbook = function Spellbook(_ref) {
17635
17692
  removeShortcut = _ref.removeShortcut,
17636
17693
  atlasIMG = _ref.atlasIMG,
17637
17694
  atlasJSON = _ref.atlasJSON,
17695
+ iconAtlasIMG = _ref.iconAtlasIMG,
17696
+ iconAtlasJSON = _ref.iconAtlasJSON,
17638
17697
  scale = _ref.scale,
17639
17698
  spellCooldowns = _ref.spellCooldowns;
17640
17699
  var _useState = useState(''),
@@ -17683,6 +17742,8 @@ var Spellbook = function Spellbook(_ref) {
17683
17742
  return React.createElement(Fragment, {
17684
17743
  key: spell.key
17685
17744
  }, React.createElement(Spell, Object.assign({
17745
+ atlasIMG: iconAtlasIMG,
17746
+ atlasJSON: iconAtlasJSON,
17686
17747
  charMana: mana,
17687
17748
  charMagicLevel: magicLevel,
17688
17749
  onPointerUp: settingShortcutIndex !== -1 ? setShortcut : onSpellClick,