@rpg-engine/long-bow 0.3.52 → 0.3.54
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/CircularController/CircularController.d.ts +1 -2
- package/dist/components/Item/Inventory/ItemContainer.d.ts +1 -2
- package/dist/components/Shortcuts/Shortcuts.d.ts +1 -10
- package/dist/components/Shortcuts/ShortcutsSetter.d.ts +1 -1
- package/dist/components/Spellbook/Spellbook.d.ts +1 -2
- package/dist/components/Spellbook/constants.d.ts +1 -1
- package/dist/long-bow.cjs.development.js +89 -95
- 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 +87 -94
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/CircularController/CircularController.tsx +2 -1
- package/src/components/Item/Inventory/ItemContainer.tsx +1 -1
- package/src/components/Item/Inventory/ItemSlot.tsx +0 -1
- package/src/components/Shortcuts/Shortcuts.tsx +2 -11
- package/src/components/Shortcuts/ShortcutsSetter.tsx +7 -2
- package/src/components/Spellbook/Spellbook.tsx +1 -2
- package/src/components/Spellbook/constants.ts +1 -1
- package/src/stories/ItemContainer.stories.tsx +7 -2
- package/src/stories/Spellbook.stories.tsx +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { IItemContainer } from '@rpg-engine/shared';
|
|
1
|
+
import { IItemContainer, IShortcut } from '@rpg-engine/shared';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { IShortcut } from '../Shortcuts/Shortcuts';
|
|
4
3
|
export declare type CircularControllerProps = {
|
|
5
4
|
onActionClick: () => void;
|
|
6
5
|
onCancelClick: () => void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { IItem, IItemContainer, ItemContainerType } from '@rpg-engine/shared';
|
|
1
|
+
import { IItem, IItemContainer, IShortcut, ItemContainerType } from '@rpg-engine/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { IPosition } from '../../../types/eventTypes';
|
|
4
|
-
import { IShortcut } from '../../Shortcuts/Shortcuts';
|
|
5
4
|
export interface IItemContainerProps {
|
|
6
5
|
itemContainer: IItemContainer;
|
|
7
6
|
onClose?: () => void;
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IItemContainer, IShortcut } from '@rpg-engine/shared';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
export declare enum ShortcutType {
|
|
4
|
-
Spell = 0,
|
|
5
|
-
Item = 1,
|
|
6
|
-
None = 2
|
|
7
|
-
}
|
|
8
|
-
export interface IShortcut {
|
|
9
|
-
type: ShortcutType;
|
|
10
|
-
payload: IRawSpell | IItem | null;
|
|
11
|
-
}
|
|
12
3
|
export declare type ShortcutsProps = {
|
|
13
4
|
shortcuts: IShortcut[];
|
|
14
5
|
onShortcutCast: (index: number) => void;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { IRawSpell } from '@rpg-engine/shared';
|
|
1
|
+
import { IRawSpell, IShortcut } from '@rpg-engine/shared';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { IShortcut } from '../Shortcuts/Shortcuts';
|
|
4
3
|
export interface ISpellbookProps {
|
|
5
4
|
onClose?: () => void;
|
|
6
5
|
onInputFocus?: () => void;
|
|
@@ -33063,94 +33063,6 @@ var SingleShortcut = /*#__PURE__*/styled.button.withConfig({
|
|
|
33063
33063
|
componentId: "sc-vz5ev8-0"
|
|
33064
33064
|
})(["width:3rem;height:3rem;background-color:", ";border:2px solid ", ";border-radius:50%;text-transform:uppercase;font-size:0.7rem;font-weight:bold;display:flex;align-items:center;justify-content:center;position:relative;span{pointer-events:none;}.mana{position:absolute;top:-5px;right:0;font-size:0.65rem;color:", ";}.qty{position:absolute;top:-5px;right:0;font-size:0.65rem;}.magicWords{margin-top:4px;}.keyboard{position:absolute;bottom:-5px;left:0;font-size:0.65rem;color:", ";}&:hover,&:focus{background-color:", ";}&:active{background-color:", ";}&:disabled{opacity:0.5;}"], uiColors.lightGray, uiColors.darkGray, uiColors.blue, uiColors.yellow, uiColors.darkGray, uiColors.gray);
|
|
33065
33065
|
|
|
33066
|
-
(function (ShortcutType) {
|
|
33067
|
-
ShortcutType[ShortcutType["Spell"] = 0] = "Spell";
|
|
33068
|
-
ShortcutType[ShortcutType["Item"] = 1] = "Item";
|
|
33069
|
-
ShortcutType[ShortcutType["None"] = 2] = "None";
|
|
33070
|
-
})(exports.ShortcutType || (exports.ShortcutType = {}));
|
|
33071
|
-
var Shortcuts = function Shortcuts(_ref) {
|
|
33072
|
-
var shortcuts = _ref.shortcuts,
|
|
33073
|
-
onShortcutCast = _ref.onShortcutCast,
|
|
33074
|
-
mana = _ref.mana,
|
|
33075
|
-
_ref$isBlockedCasting = _ref.isBlockedCastingByKeyboard,
|
|
33076
|
-
isBlockedCastingByKeyboard = _ref$isBlockedCasting === void 0 ? false : _ref$isBlockedCasting,
|
|
33077
|
-
atlasJSON = _ref.atlasJSON,
|
|
33078
|
-
atlasIMG = _ref.atlasIMG,
|
|
33079
|
-
inventory = _ref.inventory;
|
|
33080
|
-
React.useEffect(function () {
|
|
33081
|
-
var handleKeyDown = function handleKeyDown(e) {
|
|
33082
|
-
if (isBlockedCastingByKeyboard) return;
|
|
33083
|
-
var shortcutIndex = Number(e.key) - 1;
|
|
33084
|
-
if (shortcutIndex >= 0 && shortcutIndex <= 5) {
|
|
33085
|
-
onShortcutCast(shortcutIndex);
|
|
33086
|
-
}
|
|
33087
|
-
};
|
|
33088
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
33089
|
-
return function () {
|
|
33090
|
-
window.removeEventListener('keydown', handleKeyDown);
|
|
33091
|
-
};
|
|
33092
|
-
}, [shortcuts, isBlockedCastingByKeyboard]);
|
|
33093
|
-
return React__default.createElement(List, null, Array.from({
|
|
33094
|
-
length: 6
|
|
33095
|
-
}).map(function (_, i) {
|
|
33096
|
-
var _shortcuts$i, _shortcuts$i3, _payload$manaCost;
|
|
33097
|
-
if (((_shortcuts$i = shortcuts[i]) == null ? void 0 : _shortcuts$i.type) === exports.ShortcutType.Item) {
|
|
33098
|
-
var _shortcuts$i2;
|
|
33099
|
-
var _payload = (_shortcuts$i2 = shortcuts[i]) == null ? void 0 : _shortcuts$i2.payload;
|
|
33100
|
-
var itemsFromEquipment = [];
|
|
33101
|
-
if (inventory) {
|
|
33102
|
-
Object.keys(inventory.slots).forEach(function (i) {
|
|
33103
|
-
var _inventory$slots$inde;
|
|
33104
|
-
var index = parseInt(i);
|
|
33105
|
-
if (((_inventory$slots$inde = inventory.slots[index]) == null ? void 0 : _inventory$slots$inde.key) === (_payload == null ? void 0 : _payload.key)) {
|
|
33106
|
-
itemsFromEquipment.push(inventory.slots[index]);
|
|
33107
|
-
}
|
|
33108
|
-
});
|
|
33109
|
-
}
|
|
33110
|
-
var totalQty = itemsFromEquipment.reduce(function (acc, item) {
|
|
33111
|
-
return acc + ((item == null ? void 0 : item.stackQty) || 1);
|
|
33112
|
-
}, 0);
|
|
33113
|
-
return React__default.createElement(SingleShortcut, {
|
|
33114
|
-
key: i,
|
|
33115
|
-
onClick: onShortcutCast.bind(null, i),
|
|
33116
|
-
disabled: false
|
|
33117
|
-
}, _payload && React__default.createElement(SpriteFromAtlas, {
|
|
33118
|
-
atlasIMG: atlasIMG,
|
|
33119
|
-
atlasJSON: atlasJSON,
|
|
33120
|
-
spriteKey: shared.getItemTextureKeyPath({
|
|
33121
|
-
key: _payload.texturePath,
|
|
33122
|
-
texturePath: _payload.texturePath,
|
|
33123
|
-
stackQty: _payload.stackQty || 1
|
|
33124
|
-
}, atlasJSON),
|
|
33125
|
-
width: 32,
|
|
33126
|
-
height: 32
|
|
33127
|
-
}), React__default.createElement("span", {
|
|
33128
|
-
className: "qty"
|
|
33129
|
-
}, totalQty), React__default.createElement("span", {
|
|
33130
|
-
className: "keyboard"
|
|
33131
|
-
}, i + 1));
|
|
33132
|
-
}
|
|
33133
|
-
var payload = (_shortcuts$i3 = shortcuts[i]) == null ? void 0 : _shortcuts$i3.payload;
|
|
33134
|
-
return React__default.createElement(SingleShortcut, {
|
|
33135
|
-
key: i,
|
|
33136
|
-
onClick: onShortcutCast.bind(null, i),
|
|
33137
|
-
disabled: mana < ((_payload$manaCost = payload == null ? void 0 : payload.manaCost) != null ? _payload$manaCost : 0)
|
|
33138
|
-
}, React__default.createElement("span", {
|
|
33139
|
-
className: "mana"
|
|
33140
|
-
}, payload && payload.manaCost), React__default.createElement("span", {
|
|
33141
|
-
className: "magicWords"
|
|
33142
|
-
}, payload == null ? void 0 : payload.magicWords.split(' ').map(function (word) {
|
|
33143
|
-
return word[0];
|
|
33144
|
-
})), React__default.createElement("span", {
|
|
33145
|
-
className: "keyboard"
|
|
33146
|
-
}, i + 1));
|
|
33147
|
-
}));
|
|
33148
|
-
};
|
|
33149
|
-
var List = /*#__PURE__*/styled.p.withConfig({
|
|
33150
|
-
displayName: "Shortcuts__List",
|
|
33151
|
-
componentId: "sc-kgtsi7-0"
|
|
33152
|
-
})(["width:100%;display:flex;align-items:center;justify-content:center;gap:0.5rem;box-sizing:border-box;margin:0 !important;"]);
|
|
33153
|
-
|
|
33154
33066
|
var CircularController = function CircularController(_ref) {
|
|
33155
33067
|
var onActionClick = _ref.onActionClick,
|
|
33156
33068
|
onCancelClick = _ref.onCancelClick,
|
|
@@ -33175,8 +33087,8 @@ var CircularController = function CircularController(_ref) {
|
|
|
33175
33087
|
var _shortcuts$i, _shortcuts$i2, _shortcuts$i4, _payload$manaCost;
|
|
33176
33088
|
var variant = '';
|
|
33177
33089
|
if (i === 0) variant = 'top';else if (i >= 3) variant = "bottom-" + (i - 3);
|
|
33178
|
-
var onShortcutClickBinded = ((_shortcuts$i = shortcuts[i]) == null ? void 0 : _shortcuts$i.type) !==
|
|
33179
|
-
if (((_shortcuts$i2 = shortcuts[i]) == null ? void 0 : _shortcuts$i2.type) ===
|
|
33090
|
+
var onShortcutClickBinded = ((_shortcuts$i = shortcuts[i]) == null ? void 0 : _shortcuts$i.type) !== shared.ShortcutType.None ? onShortcutClick.bind(null, i) : function () {};
|
|
33091
|
+
if (((_shortcuts$i2 = shortcuts[i]) == null ? void 0 : _shortcuts$i2.type) === shared.ShortcutType.Item) {
|
|
33180
33092
|
var _shortcuts$i3;
|
|
33181
33093
|
var _payload = (_shortcuts$i3 = shortcuts[i]) == null ? void 0 : _shortcuts$i3.payload;
|
|
33182
33094
|
var itemsFromEquipment = [];
|
|
@@ -33887,7 +33799,6 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
33887
33799
|
});
|
|
33888
33800
|
setIsFocused(false);
|
|
33889
33801
|
if (item) {
|
|
33890
|
-
console.log(item);
|
|
33891
33802
|
setContextActions(generateContextMenu(item, containerType));
|
|
33892
33803
|
}
|
|
33893
33804
|
}, [item]);
|
|
@@ -34449,7 +34360,7 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
|
|
|
34449
34360
|
atlasIMG = _ref.atlasIMG;
|
|
34450
34361
|
var getContent = function getContent(index) {
|
|
34451
34362
|
var _shortcuts$index, _shortcuts$index3;
|
|
34452
|
-
if (((_shortcuts$index = shortcuts[index]) == null ? void 0 : _shortcuts$index.type) ===
|
|
34363
|
+
if (((_shortcuts$index = shortcuts[index]) == null ? void 0 : _shortcuts$index.type) === shared.ShortcutType.Item) {
|
|
34453
34364
|
var _shortcuts$index2;
|
|
34454
34365
|
var _payload = (_shortcuts$index2 = shortcuts[index]) == null ? void 0 : _shortcuts$index2.payload;
|
|
34455
34366
|
if (!_payload) return null;
|
|
@@ -34474,7 +34385,7 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
|
|
|
34474
34385
|
return word[0];
|
|
34475
34386
|
}));
|
|
34476
34387
|
};
|
|
34477
|
-
return React__default.createElement(Container$b, null, React__default.createElement("p", null, "Shortcuts:"), React__default.createElement(List
|
|
34388
|
+
return React__default.createElement(Container$b, null, React__default.createElement("p", null, "Shortcuts:"), React__default.createElement(List, {
|
|
34478
34389
|
id: "shortcuts_list"
|
|
34479
34390
|
}, Array.from({
|
|
34480
34391
|
length: 6
|
|
@@ -34483,7 +34394,7 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
|
|
|
34483
34394
|
key: i,
|
|
34484
34395
|
onClick: function onClick() {
|
|
34485
34396
|
removeShortcut(i);
|
|
34486
|
-
if (!shortcuts[i] || shortcuts[i].type ===
|
|
34397
|
+
if (!shortcuts[i] || shortcuts[i].type === shared.ShortcutType.None) setSettingShortcutIndex(i);
|
|
34487
34398
|
},
|
|
34488
34399
|
disabled: settingShortcutIndex !== -1 && settingShortcutIndex !== i,
|
|
34489
34400
|
isBeingSet: settingShortcutIndex === i
|
|
@@ -34501,7 +34412,7 @@ var Shortcut = /*#__PURE__*/styled.button.withConfig({
|
|
|
34501
34412
|
var isBeingSet = _ref2.isBeingSet;
|
|
34502
34413
|
return isBeingSet ? uiColors.yellow : uiColors.darkGray;
|
|
34503
34414
|
}, uiColors.darkGray, uiColors.gray);
|
|
34504
|
-
var List
|
|
34415
|
+
var List = /*#__PURE__*/styled.div.withConfig({
|
|
34505
34416
|
displayName: "ShortcutsSetter__List",
|
|
34506
34417
|
componentId: "sc-xuouuf-2"
|
|
34507
34418
|
})(["width:100%;display:flex;align-items:center;gap:0.5rem;padding-bottom:0.5rem;padding-left:0.5rem;box-sizing:border-box;margin:0 !important;"]);
|
|
@@ -35342,6 +35253,89 @@ var RPGUIRoot = function RPGUIRoot(_ref) {
|
|
|
35342
35253
|
}, children);
|
|
35343
35254
|
};
|
|
35344
35255
|
|
|
35256
|
+
var Shortcuts = function Shortcuts(_ref) {
|
|
35257
|
+
var shortcuts = _ref.shortcuts,
|
|
35258
|
+
onShortcutCast = _ref.onShortcutCast,
|
|
35259
|
+
mana = _ref.mana,
|
|
35260
|
+
_ref$isBlockedCasting = _ref.isBlockedCastingByKeyboard,
|
|
35261
|
+
isBlockedCastingByKeyboard = _ref$isBlockedCasting === void 0 ? false : _ref$isBlockedCasting,
|
|
35262
|
+
atlasJSON = _ref.atlasJSON,
|
|
35263
|
+
atlasIMG = _ref.atlasIMG,
|
|
35264
|
+
inventory = _ref.inventory;
|
|
35265
|
+
React.useEffect(function () {
|
|
35266
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
35267
|
+
if (isBlockedCastingByKeyboard) return;
|
|
35268
|
+
var shortcutIndex = Number(e.key) - 1;
|
|
35269
|
+
if (shortcutIndex >= 0 && shortcutIndex <= 5) {
|
|
35270
|
+
onShortcutCast(shortcutIndex);
|
|
35271
|
+
}
|
|
35272
|
+
};
|
|
35273
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
35274
|
+
return function () {
|
|
35275
|
+
window.removeEventListener('keydown', handleKeyDown);
|
|
35276
|
+
};
|
|
35277
|
+
}, [shortcuts, isBlockedCastingByKeyboard]);
|
|
35278
|
+
return React__default.createElement(List$1, null, Array.from({
|
|
35279
|
+
length: 6
|
|
35280
|
+
}).map(function (_, i) {
|
|
35281
|
+
var _shortcuts$i, _shortcuts$i3, _payload$manaCost;
|
|
35282
|
+
if (((_shortcuts$i = shortcuts[i]) == null ? void 0 : _shortcuts$i.type) === shared.ShortcutType.Item) {
|
|
35283
|
+
var _shortcuts$i2;
|
|
35284
|
+
var _payload = (_shortcuts$i2 = shortcuts[i]) == null ? void 0 : _shortcuts$i2.payload;
|
|
35285
|
+
var itemsFromEquipment = [];
|
|
35286
|
+
if (inventory) {
|
|
35287
|
+
Object.keys(inventory.slots).forEach(function (i) {
|
|
35288
|
+
var _inventory$slots$inde;
|
|
35289
|
+
var index = parseInt(i);
|
|
35290
|
+
if (((_inventory$slots$inde = inventory.slots[index]) == null ? void 0 : _inventory$slots$inde.key) === (_payload == null ? void 0 : _payload.key)) {
|
|
35291
|
+
itemsFromEquipment.push(inventory.slots[index]);
|
|
35292
|
+
}
|
|
35293
|
+
});
|
|
35294
|
+
}
|
|
35295
|
+
var totalQty = itemsFromEquipment.reduce(function (acc, item) {
|
|
35296
|
+
return acc + ((item == null ? void 0 : item.stackQty) || 1);
|
|
35297
|
+
}, 0);
|
|
35298
|
+
return React__default.createElement(SingleShortcut, {
|
|
35299
|
+
key: i,
|
|
35300
|
+
onClick: onShortcutCast.bind(null, i),
|
|
35301
|
+
disabled: false
|
|
35302
|
+
}, _payload && React__default.createElement(SpriteFromAtlas, {
|
|
35303
|
+
atlasIMG: atlasIMG,
|
|
35304
|
+
atlasJSON: atlasJSON,
|
|
35305
|
+
spriteKey: shared.getItemTextureKeyPath({
|
|
35306
|
+
key: _payload.texturePath,
|
|
35307
|
+
texturePath: _payload.texturePath,
|
|
35308
|
+
stackQty: _payload.stackQty || 1
|
|
35309
|
+
}, atlasJSON),
|
|
35310
|
+
width: 32,
|
|
35311
|
+
height: 32
|
|
35312
|
+
}), React__default.createElement("span", {
|
|
35313
|
+
className: "qty"
|
|
35314
|
+
}, totalQty), React__default.createElement("span", {
|
|
35315
|
+
className: "keyboard"
|
|
35316
|
+
}, i + 1));
|
|
35317
|
+
}
|
|
35318
|
+
var payload = (_shortcuts$i3 = shortcuts[i]) == null ? void 0 : _shortcuts$i3.payload;
|
|
35319
|
+
return React__default.createElement(SingleShortcut, {
|
|
35320
|
+
key: i,
|
|
35321
|
+
onClick: onShortcutCast.bind(null, i),
|
|
35322
|
+
disabled: mana < ((_payload$manaCost = payload == null ? void 0 : payload.manaCost) != null ? _payload$manaCost : 0)
|
|
35323
|
+
}, React__default.createElement("span", {
|
|
35324
|
+
className: "mana"
|
|
35325
|
+
}, payload && payload.manaCost), React__default.createElement("span", {
|
|
35326
|
+
className: "magicWords"
|
|
35327
|
+
}, payload == null ? void 0 : payload.magicWords.split(' ').map(function (word) {
|
|
35328
|
+
return word[0];
|
|
35329
|
+
})), React__default.createElement("span", {
|
|
35330
|
+
className: "keyboard"
|
|
35331
|
+
}, i + 1));
|
|
35332
|
+
}));
|
|
35333
|
+
};
|
|
35334
|
+
var List$1 = /*#__PURE__*/styled.p.withConfig({
|
|
35335
|
+
displayName: "Shortcuts__List",
|
|
35336
|
+
componentId: "sc-kgtsi7-0"
|
|
35337
|
+
})(["width:100%;display:flex;align-items:center;justify-content:center;gap:0.5rem;box-sizing:border-box;margin:0 !important;"]);
|
|
35338
|
+
|
|
35345
35339
|
var SimpleProgressBar = function SimpleProgressBar(_ref) {
|
|
35346
35340
|
var value = _ref.value,
|
|
35347
35341
|
_ref$bgColor = _ref.bgColor,
|