@rpg-engine/long-bow 0.5.1 → 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
  };
@@ -13831,7 +13854,7 @@ var statisticsToDisplay = [{
13831
13854
  higherIsWorse: true
13832
13855
  }];
13833
13856
  var ItemInfo = function ItemInfo(_ref) {
13834
- var _item$stackQty;
13857
+ var _item$minRequirements, _item$minRequirements2, _item$minRequirements3, _item$minRequirements4, _item$minRequirements5, _item$stackQty;
13835
13858
  var item = _ref.item,
13836
13859
  itemToCompare = _ref.itemToCompare,
13837
13860
  atlasIMG = _ref.atlasIMG,
@@ -13908,13 +13931,14 @@ var ItemInfo = function ItemInfo(_ref) {
13908
13931
  }));
13909
13932
  });
13910
13933
  };
13934
+ var skillName = (_item$minRequirements = item.minRequirements) == null ? void 0 : (_item$minRequirements2 = _item$minRequirements.skill) == null ? void 0 : _item$minRequirements2.name;
13911
13935
  return React.createElement(Container$b, {
13912
13936
  item: item
13913
13937
  }, React.createElement(Header, null, React.createElement("div", null, React.createElement(Title$1, null, item.name), item.rarity !== 'Common' && React.createElement(Rarity, {
13914
13938
  item: item
13915
13939
  }, item.rarity), React.createElement(Type, null, item.subType)), React.createElement(AllowedSlots, null, renderAvaibleSlots())), item.minRequirements && React.createElement(LevelRequirement, null, React.createElement("div", {
13916
13940
  className: "title"
13917
- }, "Requirements:"), React.createElement("div", null, "- Level: ", item.minRequirements.level), React.createElement("div", null, "-", ' ', item.minRequirements.skill.name[0].toUpperCase() + item.minRequirements.skill.name.slice(1), ": ", item.minRequirements.skill.level)), renderStatistics(), renderEntityEffects(), item.usableEffectDescription && React.createElement(Statistic, {
13941
+ }, "Requirements:"), React.createElement("div", null, "- Level: ", (_item$minRequirements3 = item.minRequirements) == null ? void 0 : _item$minRequirements3.level), skillName && React.createElement("div", null, "- ", skillName.charAt(0).toUpperCase() + skillName.slice(1), ":", ' ', (_item$minRequirements4 = item.minRequirements) == null ? void 0 : (_item$minRequirements5 = _item$minRequirements4.skill) == null ? void 0 : _item$minRequirements5.level)), renderStatistics(), renderEntityEffects(), item.usableEffectDescription && React.createElement(Statistic, {
13918
13942
  "$isSpecial": true
13919
13943
  }, item.usableEffectDescription), item.equippedBuffDescription && React.createElement(Statistic, {
13920
13944
  "$isSpecial": true
@@ -15441,19 +15465,19 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
15441
15465
  atlasJSON = _ref.atlasJSON,
15442
15466
  atlasIMG = _ref.atlasIMG;
15443
15467
  var getContent = function getContent(index) {
15444
- var _shortcuts$index, _shortcuts$index3;
15468
+ var _shortcuts$index;
15445
15469
  if (((_shortcuts$index = shortcuts[index]) == null ? void 0 : _shortcuts$index.type) === ShortcutType.Item) {
15446
15470
  var _shortcuts$index2;
15447
- var _payload = (_shortcuts$index2 = shortcuts[index]) == null ? void 0 : _shortcuts$index2.payload;
15448
- if (!_payload) return null;
15471
+ var payload = (_shortcuts$index2 = shortcuts[index]) == null ? void 0 : _shortcuts$index2.payload;
15472
+ if (!payload) return null;
15449
15473
  return React.createElement(SpriteFromAtlas, {
15450
15474
  atlasIMG: atlasIMG,
15451
15475
  atlasJSON: atlasJSON,
15452
15476
  spriteKey: getItemTextureKeyPath({
15453
- key: _payload.texturePath,
15454
- texturePath: _payload.texturePath,
15455
- stackQty: _payload.stackQty || 1,
15456
- isStackable: _payload.isStackable
15477
+ key: payload.texturePath,
15478
+ texturePath: payload.texturePath,
15479
+ stackQty: payload.stackQty || 1,
15480
+ isStackable: payload.isStackable
15457
15481
  }, atlasJSON),
15458
15482
  width: 32,
15459
15483
  height: 32,
@@ -15463,10 +15487,24 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
15463
15487
  }
15464
15488
  });
15465
15489
  }
15466
- var payload = (_shortcuts$index3 = shortcuts[index]) == null ? void 0 : _shortcuts$index3.payload;
15467
- return React.createElement("span", null, payload == null ? void 0 : payload.magicWords.split(' ').map(function (word) {
15468
- return word[0];
15469
- }));
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;
15470
15508
  };
15471
15509
  return React.createElement(Container$i, null, React.createElement("p", null, "Shortcuts:"), React.createElement(List, {
15472
15510
  id: "shortcuts_list"
@@ -16985,7 +17023,7 @@ var Shortcuts = function Shortcuts(_ref) {
16985
17023
  return React.createElement(List$1, null, Array.from({
16986
17024
  length: 12
16987
17025
  }).map(function (_, i) {
16988
- var _shortcuts$i, _shortcuts$i3, _spellCooldowns$paylo, _payload$manaCost;
17026
+ var _shortcuts$i, _shortcuts$i3, _spellCooldowns$paylo, _payload$manaCost, _payload$texturePath;
16989
17027
  var buildClassName = function buildClassName(classBase, isOnCooldown) {
16990
17028
  return classBase + " " + (isOnCooldown ? 'onCooldown' : '');
16991
17029
  };
@@ -17034,6 +17072,8 @@ var Shortcuts = function Shortcuts(_ref) {
17034
17072
  var spellCooldown = !payload ? 0 : (_spellCooldowns$paylo = spellCooldowns == null ? void 0 : spellCooldowns[payload.magicWords.replaceAll(' ', '_')]) != null ? _spellCooldowns$paylo : shortcutCooldown;
17035
17073
  var cooldown = spellCooldown > shortcutCooldown ? spellCooldown : shortcutCooldown;
17036
17074
  var isOnCooldown = cooldown > 0 && !!payload;
17075
+ var IMAGE_SCALE = 1.5;
17076
+ var IMAGE_SIZE = 32;
17037
17077
  return React.createElement(StyledShortcut$1, {
17038
17078
  key: i,
17039
17079
  onPointerDown: handleShortcutCast.bind(null, i),
@@ -17043,13 +17083,18 @@ var Shortcuts = function Shortcuts(_ref) {
17043
17083
  }
17044
17084
  }, isOnCooldown && React.createElement("span", {
17045
17085
  className: "cooldown"
17046
- }, 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", {
17047
17096
  className: buildClassName('mana', isOnCooldown)
17048
17097
  }, payload && payload.manaCost), React.createElement("span", {
17049
- className: "magicWords"
17050
- }, payload == null ? void 0 : payload.magicWords.split(' ').map(function (word) {
17051
- return word[0];
17052
- })), React.createElement("span", {
17053
17098
  className: buildClassName('keyboard', isOnCooldown)
17054
17099
  }, i + 1));
17055
17100
  }));
@@ -17556,7 +17601,10 @@ var SpellInfoWrapper = function SpellInfoWrapper(_ref) {
17556
17601
  };
17557
17602
 
17558
17603
  var Spell = function Spell(_ref) {
17559
- var spellKey = _ref.spellKey,
17604
+ var _spell$texturePath;
17605
+ var atlasIMG = _ref.atlasIMG,
17606
+ atlasJSON = _ref.atlasJSON,
17607
+ spellKey = _ref.spellKey,
17560
17608
  charMana = _ref.charMana,
17561
17609
  charMagicLevel = _ref.charMagicLevel,
17562
17610
  onPointerUp = _ref.onPointerUp,
@@ -17569,6 +17617,11 @@ var Spell = function Spell(_ref) {
17569
17617
  name = spell.name,
17570
17618
  description = spell.description;
17571
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;
17572
17625
  return React.createElement(SpellInfoWrapper, {
17573
17626
  spell: spell
17574
17627
  }, React.createElement(Container$r, {
@@ -17577,8 +17630,13 @@ var Spell = function Spell(_ref) {
17577
17630
  className: "spell"
17578
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", {
17579
17632
  className: "cooldown"
17580
- }, activeCooldown.toFixed(activeCooldown > 10 ? 0 : 1)) : null, magicWords.split(' ').map(function (word) {
17581
- 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
17582
17640
  })), React.createElement(Info, null, React.createElement(Title$a, null, React.createElement("span", null, name), React.createElement("span", {
17583
17641
  className: "spell"
17584
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", {
@@ -17634,6 +17692,8 @@ var Spellbook = function Spellbook(_ref) {
17634
17692
  removeShortcut = _ref.removeShortcut,
17635
17693
  atlasIMG = _ref.atlasIMG,
17636
17694
  atlasJSON = _ref.atlasJSON,
17695
+ iconAtlasIMG = _ref.iconAtlasIMG,
17696
+ iconAtlasJSON = _ref.iconAtlasJSON,
17637
17697
  scale = _ref.scale,
17638
17698
  spellCooldowns = _ref.spellCooldowns;
17639
17699
  var _useState = useState(''),
@@ -17682,6 +17742,8 @@ var Spellbook = function Spellbook(_ref) {
17682
17742
  return React.createElement(Fragment, {
17683
17743
  key: spell.key
17684
17744
  }, React.createElement(Spell, Object.assign({
17745
+ atlasIMG: iconAtlasIMG,
17746
+ atlasJSON: iconAtlasJSON,
17685
17747
  charMana: mana,
17686
17748
  charMagicLevel: magicLevel,
17687
17749
  onPointerUp: settingShortcutIndex !== -1 ? setShortcut : onSpellClick,