@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.
- package/dist/components/Spellbook/Spell.d.ts +2 -0
- package/dist/components/Spellbook/Spellbook.d.ts +2 -0
- package/dist/components/shared/SpriteFromAtlas.d.ts +2 -0
- package/dist/long-bow.cjs.development.js +88 -26
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +88 -26
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/mocks/shortcut.mocks.d.ts +2 -0
- package/package.json +2 -2
- package/src/components/CircularController/CircularController.tsx +16 -1
- package/src/components/Item/Cards/ItemInfo.tsx +11 -9
- package/src/components/Shortcuts/Shortcuts.tsx +17 -3
- package/src/components/Shortcuts/ShortcutsSetter.tsx +21 -2
- package/src/components/Spellbook/Spell.tsx +16 -1
- package/src/components/Spellbook/Spellbook.tsx +6 -0
- package/src/components/Spellbook/mockSpells.ts +27 -13
- package/src/components/shared/SpriteFromAtlas.tsx +11 -2
- package/src/mocks/shortcut.mocks.ts +2 -0
- package/src/stories/Spellbook.stories.tsx +11 -5
|
@@ -117,7 +117,9 @@ var SpriteFromAtlas = function SpriteFromAtlas(_ref) {
|
|
|
117
117
|
grayScale = _ref$grayScale === void 0 ? false : _ref$grayScale,
|
|
118
118
|
_ref$opacity = _ref.opacity,
|
|
119
119
|
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
120
|
-
imgClassname = _ref.imgClassname
|
|
120
|
+
imgClassname = _ref.imgClassname,
|
|
121
|
+
centered = _ref.centered,
|
|
122
|
+
borderRadius = _ref.borderRadius;
|
|
121
123
|
//! 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).
|
|
122
124
|
//!Due to React's limitations, we cannot import it from the public folder directly!
|
|
123
125
|
var spriteData = atlasJSON.frames[spriteKey] || atlasJSON.frames['others/no-image.png'];
|
|
@@ -135,7 +137,9 @@ var SpriteFromAtlas = function SpriteFromAtlas(_ref) {
|
|
|
135
137
|
scale: imgScale,
|
|
136
138
|
grayScale: grayScale,
|
|
137
139
|
opacity: opacity,
|
|
138
|
-
style: imgStyle
|
|
140
|
+
style: imgStyle,
|
|
141
|
+
centered: centered,
|
|
142
|
+
borderRadius: borderRadius
|
|
139
143
|
}));
|
|
140
144
|
};
|
|
141
145
|
var Container = /*#__PURE__*/styled.div.withConfig({
|
|
@@ -151,7 +155,7 @@ var Container = /*#__PURE__*/styled.div.withConfig({
|
|
|
151
155
|
var ImgSprite = /*#__PURE__*/styled.div.withConfig({
|
|
152
156
|
displayName: "SpriteFromAtlas__ImgSprite",
|
|
153
157
|
componentId: "sc-1lpani8-1"
|
|
154
|
-
})(["width:", "px;height:", "px;background-image:url(", ");background-position:-", "px -", "px;transform:scale(", ");position:relative;top:
|
|
158
|
+
})(["width:", "px;height:", "px;background-image:url(", ");background-position:-", "px -", "px;transform:scale(", ");position:relative;top:", ";left:", ";filter:", ";opacity:", ";border-radius:", ";"], function (props) {
|
|
155
159
|
return props.frame.w;
|
|
156
160
|
}, function (props) {
|
|
157
161
|
return props.frame.h;
|
|
@@ -163,10 +167,16 @@ var ImgSprite = /*#__PURE__*/styled.div.withConfig({
|
|
|
163
167
|
return props.frame.y;
|
|
164
168
|
}, function (props) {
|
|
165
169
|
return props.scale;
|
|
170
|
+
}, function (props) {
|
|
171
|
+
return props.centered ? '0' : '8px';
|
|
172
|
+
}, function (props) {
|
|
173
|
+
return props.centered ? '0' : '8px';
|
|
166
174
|
}, function (props) {
|
|
167
175
|
return props.grayScale ? 'grayscale(100%)' : 'none';
|
|
168
176
|
}, function (props) {
|
|
169
177
|
return props.opacity;
|
|
178
|
+
}, function (props) {
|
|
179
|
+
return props.borderRadius ? props.borderRadius : '0';
|
|
170
180
|
});
|
|
171
181
|
|
|
172
182
|
var frames = {
|
|
@@ -12959,6 +12969,11 @@ var CircularController = function CircularController(_ref) {
|
|
|
12959
12969
|
var spellCooldown = !payload ? 0 : (_spellCooldowns$paylo = spellCooldowns == null ? void 0 : spellCooldowns[payload.magicWords.replaceAll(' ', '_')]) != null ? _spellCooldowns$paylo : shortcutCooldown;
|
|
12960
12970
|
var cooldown = spellCooldown > shortcutCooldown ? spellCooldown : shortcutCooldown;
|
|
12961
12971
|
var isOnCooldown = cooldown > 0 && !!payload;
|
|
12972
|
+
var CONTAINER_STYLE = {
|
|
12973
|
+
width: '32px',
|
|
12974
|
+
height: '32px'
|
|
12975
|
+
};
|
|
12976
|
+
var IMAGE_SCALE = 1.5;
|
|
12962
12977
|
return React__default.createElement(StyledShortcut, {
|
|
12963
12978
|
key: i,
|
|
12964
12979
|
onTouchStart: onTouchStart,
|
|
@@ -12971,7 +12986,15 @@ var CircularController = function CircularController(_ref) {
|
|
|
12971
12986
|
className: buildClassName('mana', isOnCooldown)
|
|
12972
12987
|
}, payload && payload.manaCost), React__default.createElement("span", {
|
|
12973
12988
|
className: "magicWords"
|
|
12974
|
-
}, payload
|
|
12989
|
+
}, payload != null && payload.texturePath ? React__default.createElement(SpriteFromAtlas, {
|
|
12990
|
+
atlasIMG: payload.atlasIMG,
|
|
12991
|
+
atlasJSON: payload.atlasJSON,
|
|
12992
|
+
spriteKey: payload.texturePath,
|
|
12993
|
+
imgScale: IMAGE_SCALE,
|
|
12994
|
+
containerStyle: CONTAINER_STYLE,
|
|
12995
|
+
centered: true,
|
|
12996
|
+
borderRadius: "50%"
|
|
12997
|
+
}) : payload == null ? void 0 : payload.magicWords.split(' ').map(function (word) {
|
|
12975
12998
|
return word[0];
|
|
12976
12999
|
})));
|
|
12977
13000
|
};
|
|
@@ -13836,7 +13859,7 @@ var statisticsToDisplay = [{
|
|
|
13836
13859
|
higherIsWorse: true
|
|
13837
13860
|
}];
|
|
13838
13861
|
var ItemInfo = function ItemInfo(_ref) {
|
|
13839
|
-
var _item$stackQty;
|
|
13862
|
+
var _item$minRequirements, _item$minRequirements2, _item$minRequirements3, _item$minRequirements4, _item$minRequirements5, _item$stackQty;
|
|
13840
13863
|
var item = _ref.item,
|
|
13841
13864
|
itemToCompare = _ref.itemToCompare,
|
|
13842
13865
|
atlasIMG = _ref.atlasIMG,
|
|
@@ -13913,13 +13936,14 @@ var ItemInfo = function ItemInfo(_ref) {
|
|
|
13913
13936
|
}));
|
|
13914
13937
|
});
|
|
13915
13938
|
};
|
|
13939
|
+
var skillName = (_item$minRequirements = item.minRequirements) == null ? void 0 : (_item$minRequirements2 = _item$minRequirements.skill) == null ? void 0 : _item$minRequirements2.name;
|
|
13916
13940
|
return React__default.createElement(Container$b, {
|
|
13917
13941
|
item: item
|
|
13918
13942
|
}, React__default.createElement(Header, null, React__default.createElement("div", null, React__default.createElement(Title$1, null, item.name), item.rarity !== 'Common' && React__default.createElement(Rarity, {
|
|
13919
13943
|
item: item
|
|
13920
13944
|
}, item.rarity), React__default.createElement(Type, null, item.subType)), React__default.createElement(AllowedSlots, null, renderAvaibleSlots())), item.minRequirements && React__default.createElement(LevelRequirement, null, React__default.createElement("div", {
|
|
13921
13945
|
className: "title"
|
|
13922
|
-
}, "Requirements:"), React__default.createElement("div", null, "- Level: ", item.minRequirements.level), React__default.createElement("div", null, "-",
|
|
13946
|
+
}, "Requirements:"), React__default.createElement("div", null, "- Level: ", (_item$minRequirements3 = item.minRequirements) == null ? void 0 : _item$minRequirements3.level), skillName && React__default.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__default.createElement(Statistic, {
|
|
13923
13947
|
"$isSpecial": true
|
|
13924
13948
|
}, item.usableEffectDescription), item.equippedBuffDescription && React__default.createElement(Statistic, {
|
|
13925
13949
|
"$isSpecial": true
|
|
@@ -15443,19 +15467,19 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
|
|
|
15443
15467
|
atlasJSON = _ref.atlasJSON,
|
|
15444
15468
|
atlasIMG = _ref.atlasIMG;
|
|
15445
15469
|
var getContent = function getContent(index) {
|
|
15446
|
-
var _shortcuts$index
|
|
15470
|
+
var _shortcuts$index;
|
|
15447
15471
|
if (((_shortcuts$index = shortcuts[index]) == null ? void 0 : _shortcuts$index.type) === shared.ShortcutType.Item) {
|
|
15448
15472
|
var _shortcuts$index2;
|
|
15449
|
-
var
|
|
15450
|
-
if (!
|
|
15473
|
+
var payload = (_shortcuts$index2 = shortcuts[index]) == null ? void 0 : _shortcuts$index2.payload;
|
|
15474
|
+
if (!payload) return null;
|
|
15451
15475
|
return React__default.createElement(SpriteFromAtlas, {
|
|
15452
15476
|
atlasIMG: atlasIMG,
|
|
15453
15477
|
atlasJSON: atlasJSON,
|
|
15454
15478
|
spriteKey: shared.getItemTextureKeyPath({
|
|
15455
|
-
key:
|
|
15456
|
-
texturePath:
|
|
15457
|
-
stackQty:
|
|
15458
|
-
isStackable:
|
|
15479
|
+
key: payload.texturePath,
|
|
15480
|
+
texturePath: payload.texturePath,
|
|
15481
|
+
stackQty: payload.stackQty || 1,
|
|
15482
|
+
isStackable: payload.isStackable
|
|
15459
15483
|
}, atlasJSON),
|
|
15460
15484
|
width: 32,
|
|
15461
15485
|
height: 32,
|
|
@@ -15465,10 +15489,24 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
|
|
|
15465
15489
|
}
|
|
15466
15490
|
});
|
|
15467
15491
|
}
|
|
15468
|
-
var
|
|
15469
|
-
|
|
15470
|
-
|
|
15471
|
-
|
|
15492
|
+
var IMAGE_SIZE = 32;
|
|
15493
|
+
var IMAGE_SCALE = 1;
|
|
15494
|
+
var shortcut = shortcuts[index];
|
|
15495
|
+
if ((shortcut == null ? void 0 : shortcut.type) === shared.ShortcutType.Spell && shortcut.payload) {
|
|
15496
|
+
var _payload$texturePath;
|
|
15497
|
+
var _payload = shortcut.payload; // TypeScript type assertion
|
|
15498
|
+
return React__default.createElement(SpriteFromAtlas, {
|
|
15499
|
+
atlasIMG: _payload.atlasIMG,
|
|
15500
|
+
atlasJSON: _payload.atlasJSON,
|
|
15501
|
+
spriteKey: (_payload$texturePath = _payload.texturePath) != null ? _payload$texturePath : '',
|
|
15502
|
+
width: IMAGE_SIZE,
|
|
15503
|
+
height: IMAGE_SIZE,
|
|
15504
|
+
imgScale: IMAGE_SCALE,
|
|
15505
|
+
centered: true,
|
|
15506
|
+
borderRadius: "50%"
|
|
15507
|
+
});
|
|
15508
|
+
}
|
|
15509
|
+
return null;
|
|
15472
15510
|
};
|
|
15473
15511
|
return React__default.createElement(Container$i, null, React__default.createElement("p", null, "Shortcuts:"), React__default.createElement(List, {
|
|
15474
15512
|
id: "shortcuts_list"
|
|
@@ -16987,7 +17025,7 @@ var Shortcuts = function Shortcuts(_ref) {
|
|
|
16987
17025
|
return React__default.createElement(List$1, null, Array.from({
|
|
16988
17026
|
length: 12
|
|
16989
17027
|
}).map(function (_, i) {
|
|
16990
|
-
var _shortcuts$i, _shortcuts$i3, _spellCooldowns$paylo, _payload$manaCost;
|
|
17028
|
+
var _shortcuts$i, _shortcuts$i3, _spellCooldowns$paylo, _payload$manaCost, _payload$texturePath;
|
|
16991
17029
|
var buildClassName = function buildClassName(classBase, isOnCooldown) {
|
|
16992
17030
|
return classBase + " " + (isOnCooldown ? 'onCooldown' : '');
|
|
16993
17031
|
};
|
|
@@ -17036,6 +17074,8 @@ var Shortcuts = function Shortcuts(_ref) {
|
|
|
17036
17074
|
var spellCooldown = !payload ? 0 : (_spellCooldowns$paylo = spellCooldowns == null ? void 0 : spellCooldowns[payload.magicWords.replaceAll(' ', '_')]) != null ? _spellCooldowns$paylo : shortcutCooldown;
|
|
17037
17075
|
var cooldown = spellCooldown > shortcutCooldown ? spellCooldown : shortcutCooldown;
|
|
17038
17076
|
var isOnCooldown = cooldown > 0 && !!payload;
|
|
17077
|
+
var IMAGE_SCALE = 1.5;
|
|
17078
|
+
var IMAGE_SIZE = 32;
|
|
17039
17079
|
return React__default.createElement(StyledShortcut$1, {
|
|
17040
17080
|
key: i,
|
|
17041
17081
|
onPointerDown: handleShortcutCast.bind(null, i),
|
|
@@ -17045,13 +17085,18 @@ var Shortcuts = function Shortcuts(_ref) {
|
|
|
17045
17085
|
}
|
|
17046
17086
|
}, isOnCooldown && React__default.createElement("span", {
|
|
17047
17087
|
className: "cooldown"
|
|
17048
|
-
}, cooldown.toFixed(cooldown < 10 ? 1 : 0)), React__default.createElement("span", {
|
|
17088
|
+
}, cooldown.toFixed(cooldown < 10 ? 1 : 0)), React__default.createElement("span", null, (payload == null ? void 0 : payload.atlasIMG) && React__default.createElement(SpriteFromAtlas, {
|
|
17089
|
+
atlasIMG: payload.atlasIMG,
|
|
17090
|
+
atlasJSON: payload.atlasJSON,
|
|
17091
|
+
spriteKey: (_payload$texturePath = payload.texturePath) != null ? _payload$texturePath : '',
|
|
17092
|
+
width: IMAGE_SIZE,
|
|
17093
|
+
height: IMAGE_SIZE,
|
|
17094
|
+
imgScale: IMAGE_SCALE,
|
|
17095
|
+
centered: true,
|
|
17096
|
+
borderRadius: "50%"
|
|
17097
|
+
})), React__default.createElement("span", {
|
|
17049
17098
|
className: buildClassName('mana', isOnCooldown)
|
|
17050
17099
|
}, payload && payload.manaCost), React__default.createElement("span", {
|
|
17051
|
-
className: "magicWords"
|
|
17052
|
-
}, payload == null ? void 0 : payload.magicWords.split(' ').map(function (word) {
|
|
17053
|
-
return word[0];
|
|
17054
|
-
})), React__default.createElement("span", {
|
|
17055
17100
|
className: buildClassName('keyboard', isOnCooldown)
|
|
17056
17101
|
}, i + 1));
|
|
17057
17102
|
}));
|
|
@@ -17558,7 +17603,10 @@ var SpellInfoWrapper = function SpellInfoWrapper(_ref) {
|
|
|
17558
17603
|
};
|
|
17559
17604
|
|
|
17560
17605
|
var Spell = function Spell(_ref) {
|
|
17561
|
-
var
|
|
17606
|
+
var _spell$texturePath;
|
|
17607
|
+
var atlasIMG = _ref.atlasIMG,
|
|
17608
|
+
atlasJSON = _ref.atlasJSON,
|
|
17609
|
+
spellKey = _ref.spellKey,
|
|
17562
17610
|
charMana = _ref.charMana,
|
|
17563
17611
|
charMagicLevel = _ref.charMagicLevel,
|
|
17564
17612
|
onPointerUp = _ref.onPointerUp,
|
|
@@ -17571,6 +17619,11 @@ var Spell = function Spell(_ref) {
|
|
|
17571
17619
|
name = spell.name,
|
|
17572
17620
|
description = spell.description;
|
|
17573
17621
|
var disabled = isSettingShortcut ? charMagicLevel < minMagicLevelRequired : manaCost > charMana || charMagicLevel < minMagicLevelRequired;
|
|
17622
|
+
var CONTAINER_STYLE = {
|
|
17623
|
+
width: '32px',
|
|
17624
|
+
height: '32px'
|
|
17625
|
+
};
|
|
17626
|
+
var IMAGE_SCALE = 2;
|
|
17574
17627
|
return React__default.createElement(SpellInfoWrapper, {
|
|
17575
17628
|
spell: spell
|
|
17576
17629
|
}, React__default.createElement(Container$r, {
|
|
@@ -17579,8 +17632,13 @@ var Spell = function Spell(_ref) {
|
|
|
17579
17632
|
className: "spell"
|
|
17580
17633
|
}, disabled && React__default.createElement(Overlay, null, charMagicLevel < minMagicLevelRequired ? 'Low magic level' : manaCost > charMana && 'No mana'), React__default.createElement(SpellImage, null, activeCooldown && activeCooldown > 0 ? React__default.createElement("span", {
|
|
17581
17634
|
className: "cooldown"
|
|
17582
|
-
}, activeCooldown.toFixed(activeCooldown > 10 ? 0 : 1)) : null,
|
|
17583
|
-
|
|
17635
|
+
}, activeCooldown.toFixed(activeCooldown > 10 ? 0 : 1)) : null, React__default.createElement(SpriteFromAtlas, {
|
|
17636
|
+
atlasIMG: atlasIMG,
|
|
17637
|
+
atlasJSON: atlasJSON,
|
|
17638
|
+
spriteKey: (_spell$texturePath = spell.texturePath) != null ? _spell$texturePath : '',
|
|
17639
|
+
imgScale: IMAGE_SCALE,
|
|
17640
|
+
containerStyle: CONTAINER_STYLE,
|
|
17641
|
+
centered: true
|
|
17584
17642
|
})), React__default.createElement(Info, null, React__default.createElement(Title$a, null, React__default.createElement("span", null, name), React__default.createElement("span", {
|
|
17585
17643
|
className: "spell"
|
|
17586
17644
|
}, "(", magicWords, ")")), React__default.createElement(Description$3, null, description)), React__default.createElement(Divider, null), React__default.createElement(Cost, null, React__default.createElement("span", null, "Mana cost:"), React__default.createElement("span", {
|
|
@@ -17636,6 +17694,8 @@ var Spellbook = function Spellbook(_ref) {
|
|
|
17636
17694
|
removeShortcut = _ref.removeShortcut,
|
|
17637
17695
|
atlasIMG = _ref.atlasIMG,
|
|
17638
17696
|
atlasJSON = _ref.atlasJSON,
|
|
17697
|
+
iconAtlasIMG = _ref.iconAtlasIMG,
|
|
17698
|
+
iconAtlasJSON = _ref.iconAtlasJSON,
|
|
17639
17699
|
scale = _ref.scale,
|
|
17640
17700
|
spellCooldowns = _ref.spellCooldowns;
|
|
17641
17701
|
var _useState = React.useState(''),
|
|
@@ -17684,6 +17744,8 @@ var Spellbook = function Spellbook(_ref) {
|
|
|
17684
17744
|
return React__default.createElement(React.Fragment, {
|
|
17685
17745
|
key: spell.key
|
|
17686
17746
|
}, React__default.createElement(Spell, Object.assign({
|
|
17747
|
+
atlasIMG: iconAtlasIMG,
|
|
17748
|
+
atlasJSON: iconAtlasJSON,
|
|
17687
17749
|
charMana: mana,
|
|
17688
17750
|
charMagicLevel: magicLevel,
|
|
17689
17751
|
onPointerUp: settingShortcutIndex !== -1 ? setShortcut : onSpellClick,
|