@rpg-engine/long-bow 0.3.34 → 0.3.36
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/QuickSpells.d.ts +9 -0
- package/dist/components/Spellbook/Spell.d.ts +11 -0
- package/dist/components/Spellbook/Spellbook.d.ts +15 -0
- package/dist/components/Spellbook/SpellbookShortcuts.d.ts +10 -0
- package/dist/components/Spellbook/constants.d.ts +3 -0
- package/dist/components/Spellbook/mockSpells.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/long-bow.cjs.development.js +265 -5
- 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 +266 -8
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/QuickSpells.stories.d.ts +5 -0
- package/dist/stories/Spellbook.stories.d.ts +5 -0
- package/package.json +2 -2
- package/src/components/Item/Inventory/ItemSlot.tsx +27 -1
- package/src/components/Spellbook/QuickSpells.tsx +116 -0
- package/src/components/Spellbook/Spell.tsx +201 -0
- package/src/components/Spellbook/Spellbook.tsx +144 -0
- package/src/components/Spellbook/SpellbookShortcuts.tsx +77 -0
- package/src/components/Spellbook/constants.ts +12 -0
- package/src/components/Spellbook/mockSpells.ts +60 -0
- package/src/index.tsx +2 -0
- package/src/mocks/itemContainer.mocks.ts +4 -4
- package/src/stories/QuickSpells.stories.tsx +38 -0
- package/src/stories/Spellbook.stories.tsx +107 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IRawSpell } from '@rpg-engine/shared';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare type QuickSpellsProps = {
|
|
4
|
+
quickSpells: IRawSpell[];
|
|
5
|
+
onSpellCast: (spellKey: string) => void;
|
|
6
|
+
mana: number;
|
|
7
|
+
isBlockedCastingByKeyboard?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const QuickSpells: React.FC<QuickSpellsProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IRawSpell } from '@rpg-engine/shared';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface Props extends IRawSpell {
|
|
4
|
+
charMana: number;
|
|
5
|
+
charMagicLevel: number;
|
|
6
|
+
onClick?: (spellKey: string) => void;
|
|
7
|
+
isSettingShortcut?: boolean;
|
|
8
|
+
spellKey: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const Spell: React.FC<Props>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IRawSpell } from '@rpg-engine/shared';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface ISpellbookProps {
|
|
4
|
+
onClose?: () => void;
|
|
5
|
+
onInputFocus?: () => void;
|
|
6
|
+
onInputBlur?: () => void;
|
|
7
|
+
spells: IRawSpell[];
|
|
8
|
+
magicLevel: number;
|
|
9
|
+
mana: number;
|
|
10
|
+
onSpellClick: (spellKey: string) => void;
|
|
11
|
+
setSpellShortcut: (key: string, index: number) => void;
|
|
12
|
+
spellShortcuts: IRawSpell[];
|
|
13
|
+
removeSpellShortcut: (index: number) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const Spellbook: React.FC<ISpellbookProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IRawSpell } from '@rpg-engine/shared';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
setSettingShortcutIndex: (index: number) => void;
|
|
5
|
+
settingShortcutIndex: number;
|
|
6
|
+
shortcuts: IRawSpell[];
|
|
7
|
+
removeShortcut: (index: number) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const SpellbookShortcuts: React.FC<Props>;
|
|
10
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export * from './components/RPGUIRoot';
|
|
|
29
29
|
export * from './components/shared/SpriteFromAtlas';
|
|
30
30
|
export * from './components/SkillProgressBar';
|
|
31
31
|
export * from './components/SkillsContainer';
|
|
32
|
+
export * from './components/Spellbook/QuickSpells';
|
|
33
|
+
export * from './components/Spellbook/Spellbook';
|
|
32
34
|
export * from './components/TextArea';
|
|
33
35
|
export * from './components/TimeWidget/TimeWidget';
|
|
34
36
|
export * from './components/TradingMenu/TradingMenu';
|
|
@@ -33784,6 +33784,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
33784
33784
|
}
|
|
33785
33785
|
};
|
|
33786
33786
|
return React__default.createElement(Container$a, {
|
|
33787
|
+
item: item,
|
|
33787
33788
|
className: "rpgui-icon empty-slot",
|
|
33788
33789
|
onMouseUp: function onMouseUp() {
|
|
33789
33790
|
var data = item ? item : null;
|
|
@@ -33891,10 +33892,33 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
33891
33892
|
}
|
|
33892
33893
|
}));
|
|
33893
33894
|
});
|
|
33895
|
+
var rarityColor = function rarityColor(item) {
|
|
33896
|
+
switch (item == null ? void 0 : item.rarity) {
|
|
33897
|
+
case shared.ItemRarities.Uncommon:
|
|
33898
|
+
return 'rgba(13, 193, 13, 0.6)';
|
|
33899
|
+
case shared.ItemRarities.Rare:
|
|
33900
|
+
return 'rgba(8, 104, 187, 0.6)';
|
|
33901
|
+
case shared.ItemRarities.Epic:
|
|
33902
|
+
return 'rgba(191, 0, 255, 0.6)';
|
|
33903
|
+
case shared.ItemRarities.Legendary:
|
|
33904
|
+
return 'rgba(255, 191, 0,0.6)';
|
|
33905
|
+
default:
|
|
33906
|
+
return 'unset';
|
|
33907
|
+
}
|
|
33908
|
+
};
|
|
33894
33909
|
var Container$a = /*#__PURE__*/styled.div.withConfig({
|
|
33895
33910
|
displayName: "ItemSlot__Container",
|
|
33896
33911
|
componentId: "sc-l2j5ef-0"
|
|
33897
|
-
})(["margin:0.1rem;.sprite-from-atlas-img{position:relative;top:1.5rem;left:1.5rem;}position:relative;"])
|
|
33912
|
+
})(["margin:0.1rem;.sprite-from-atlas-img{position:relative;top:1.5rem;left:1.5rem;border-color:", ";box-shadow:", " inset,", ";}position:relative;"], function (_ref2) {
|
|
33913
|
+
var item = _ref2.item;
|
|
33914
|
+
return rarityColor(item);
|
|
33915
|
+
}, function (_ref3) {
|
|
33916
|
+
var item = _ref3.item;
|
|
33917
|
+
return "0 0 5px 2px " + rarityColor(item);
|
|
33918
|
+
}, function (_ref4) {
|
|
33919
|
+
var item = _ref4.item;
|
|
33920
|
+
return "0 0 4px 3px " + rarityColor(item);
|
|
33921
|
+
});
|
|
33898
33922
|
var ItemContainer = /*#__PURE__*/styled.div.withConfig({
|
|
33899
33923
|
displayName: "ItemSlot__ItemContainer",
|
|
33900
33924
|
componentId: "sc-l2j5ef-1"
|
|
@@ -35427,6 +35451,240 @@ var CloseButton$3 = /*#__PURE__*/styled.div.withConfig({
|
|
|
35427
35451
|
componentId: "sc-1g0c67q-2"
|
|
35428
35452
|
})(["position:absolute;top:2px;right:2px;color:white;z-index:22;font-size:1.1rem;"]);
|
|
35429
35453
|
|
|
35454
|
+
var QuickSpells = function QuickSpells(_ref) {
|
|
35455
|
+
var quickSpells = _ref.quickSpells,
|
|
35456
|
+
onSpellCast = _ref.onSpellCast,
|
|
35457
|
+
mana = _ref.mana,
|
|
35458
|
+
_ref$isBlockedCasting = _ref.isBlockedCastingByKeyboard,
|
|
35459
|
+
isBlockedCastingByKeyboard = _ref$isBlockedCasting === void 0 ? false : _ref$isBlockedCasting;
|
|
35460
|
+
React.useEffect(function () {
|
|
35461
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
35462
|
+
if (isBlockedCastingByKeyboard) return;
|
|
35463
|
+
var shortcutIndex = Number(e.key) - 1;
|
|
35464
|
+
if (shortcutIndex >= 0 && shortcutIndex <= 3) {
|
|
35465
|
+
var shortcut = quickSpells[shortcutIndex];
|
|
35466
|
+
if (shortcut != null && shortcut.key && mana >= (shortcut == null ? void 0 : shortcut.manaCost)) {
|
|
35467
|
+
onSpellCast(shortcut.key);
|
|
35468
|
+
}
|
|
35469
|
+
}
|
|
35470
|
+
};
|
|
35471
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
35472
|
+
return function () {
|
|
35473
|
+
window.removeEventListener('keydown', handleKeyDown);
|
|
35474
|
+
};
|
|
35475
|
+
}, [quickSpells, isBlockedCastingByKeyboard]);
|
|
35476
|
+
return React__default.createElement(List, null, Array.from({
|
|
35477
|
+
length: 4
|
|
35478
|
+
}).map(function (_, i) {
|
|
35479
|
+
var _quickSpells$i, _quickSpells$i2, _quickSpells$i3, _quickSpells$i4, _quickSpells$i5;
|
|
35480
|
+
return React__default.createElement(SpellShortcut, {
|
|
35481
|
+
key: i,
|
|
35482
|
+
onClick: onSpellCast.bind(null, (_quickSpells$i = quickSpells[i]) == null ? void 0 : _quickSpells$i.key),
|
|
35483
|
+
disabled: mana < ((_quickSpells$i2 = quickSpells[i]) == null ? void 0 : _quickSpells$i2.manaCost)
|
|
35484
|
+
}, React__default.createElement("span", {
|
|
35485
|
+
className: "mana"
|
|
35486
|
+
}, ((_quickSpells$i3 = quickSpells[i]) == null ? void 0 : _quickSpells$i3.key) && ((_quickSpells$i4 = quickSpells[i]) == null ? void 0 : _quickSpells$i4.manaCost)), React__default.createElement("span", {
|
|
35487
|
+
className: "magicWords"
|
|
35488
|
+
}, (_quickSpells$i5 = quickSpells[i]) == null ? void 0 : _quickSpells$i5.magicWords.split(' ').map(function (word) {
|
|
35489
|
+
return word[0];
|
|
35490
|
+
})), React__default.createElement("span", {
|
|
35491
|
+
className: "keyboard"
|
|
35492
|
+
}, i + 1));
|
|
35493
|
+
}));
|
|
35494
|
+
};
|
|
35495
|
+
var SpellShortcut = /*#__PURE__*/styled.button.withConfig({
|
|
35496
|
+
displayName: "QuickSpells__SpellShortcut",
|
|
35497
|
+
componentId: "sc-41yq7s-0"
|
|
35498
|
+
})(["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;.mana{position:absolute;top:-5px;right:0;font-size:0.65rem;color:", ";}.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);
|
|
35499
|
+
var List = /*#__PURE__*/styled.p.withConfig({
|
|
35500
|
+
displayName: "QuickSpells__List",
|
|
35501
|
+
componentId: "sc-41yq7s-1"
|
|
35502
|
+
})(["width:100%;display:flex;align-items:center;justify-content:center;gap:0.5rem;box-sizing:border-box;margin:0 !important;"]);
|
|
35503
|
+
|
|
35504
|
+
var Spell = function Spell(_ref) {
|
|
35505
|
+
var spellKey = _ref.spellKey,
|
|
35506
|
+
name = _ref.name,
|
|
35507
|
+
description = _ref.description,
|
|
35508
|
+
magicWords = _ref.magicWords,
|
|
35509
|
+
manaCost = _ref.manaCost,
|
|
35510
|
+
charMana = _ref.charMana,
|
|
35511
|
+
charMagicLevel = _ref.charMagicLevel,
|
|
35512
|
+
onClick = _ref.onClick,
|
|
35513
|
+
isSettingShortcut = _ref.isSettingShortcut,
|
|
35514
|
+
minMagicLevelRequired = _ref.minMagicLevelRequired;
|
|
35515
|
+
var disabled = isSettingShortcut ? charMagicLevel < minMagicLevelRequired : manaCost > charMana || charMagicLevel < minMagicLevelRequired;
|
|
35516
|
+
return React__default.createElement(Container$i, {
|
|
35517
|
+
disabled: disabled,
|
|
35518
|
+
onClick: onClick == null ? void 0 : onClick.bind(null, spellKey),
|
|
35519
|
+
isSettingShortcut: isSettingShortcut && !disabled,
|
|
35520
|
+
className: "spell"
|
|
35521
|
+
}, disabled && React__default.createElement(Overlay, null, charMagicLevel < minMagicLevelRequired ? 'Low magic level' : manaCost > charMana && 'No mana'), React__default.createElement(SpellImage, null, magicWords.split(' ').map(function (word) {
|
|
35522
|
+
return word[0];
|
|
35523
|
+
})), React__default.createElement(Info, null, React__default.createElement(Title$5, null, React__default.createElement("span", null, name), React__default.createElement("span", {
|
|
35524
|
+
className: "spell"
|
|
35525
|
+
}, "(", magicWords, ")")), React__default.createElement(Description, null, description)), React__default.createElement(Divider, null), React__default.createElement(Cost, null, React__default.createElement("span", null, "Mana cost:"), React__default.createElement("span", {
|
|
35526
|
+
className: "mana"
|
|
35527
|
+
}, manaCost)));
|
|
35528
|
+
};
|
|
35529
|
+
var Container$i = /*#__PURE__*/styled.button.withConfig({
|
|
35530
|
+
displayName: "Spell__Container",
|
|
35531
|
+
componentId: "sc-j96fa2-0"
|
|
35532
|
+
})(["display:block;background:none;border:2px solid transparent;border-radius:1rem;width:100%;display:flex;height:5rem;gap:1rem;align-items:center;padding:0 1rem;text-align:left;position:relative;animation:", ";@keyframes border-color-change{0%{border-color:", ";}50%{border-color:transparent;}100%{border-color:", ";}}&:hover,&:focus{background-color:", ";}&:active{background:none;}"], function (_ref2) {
|
|
35533
|
+
var isSettingShortcut = _ref2.isSettingShortcut;
|
|
35534
|
+
return isSettingShortcut ? 'border-color-change 1s infinite' : 'none';
|
|
35535
|
+
}, uiColors.yellow, uiColors.yellow, uiColors.darkGray);
|
|
35536
|
+
var SpellImage = /*#__PURE__*/styled.div.withConfig({
|
|
35537
|
+
displayName: "Spell__SpellImage",
|
|
35538
|
+
componentId: "sc-j96fa2-1"
|
|
35539
|
+
})(["width:4rem;height:4rem;font-size:", ";font-weight:bold;background-color:", ";color:", ";display:flex;justify-content:center;align-items:center;text-transform:uppercase;"], uiFonts.size.xLarge, uiColors.darkGray, uiColors.lightGray);
|
|
35540
|
+
var Info = /*#__PURE__*/styled.span.withConfig({
|
|
35541
|
+
displayName: "Spell__Info",
|
|
35542
|
+
componentId: "sc-j96fa2-2"
|
|
35543
|
+
})(["width:0;flex:1;"]);
|
|
35544
|
+
var Title$5 = /*#__PURE__*/styled.p.withConfig({
|
|
35545
|
+
displayName: "Spell__Title",
|
|
35546
|
+
componentId: "sc-j96fa2-3"
|
|
35547
|
+
})(["display:flex;flex-wrap:wrap;align-items:center;margin-bottom:5px;margin:0;span{font-size:", " !important;font-weight:bold !important;color:", " !important;margin-right:0.5rem;}.spell{font-size:", " !important;font-weight:normal !important;color:", " !important;}"], uiFonts.size.medium, uiColors.yellow, uiFonts.size.small, uiColors.lightGray);
|
|
35548
|
+
var Description = /*#__PURE__*/styled.div.withConfig({
|
|
35549
|
+
displayName: "Spell__Description",
|
|
35550
|
+
componentId: "sc-j96fa2-4"
|
|
35551
|
+
})(["font-size:", " !important;line-height:1.1 !important;"], uiFonts.size.small);
|
|
35552
|
+
var Divider = /*#__PURE__*/styled.div.withConfig({
|
|
35553
|
+
displayName: "Spell__Divider",
|
|
35554
|
+
componentId: "sc-j96fa2-5"
|
|
35555
|
+
})(["width:1px;height:100%;margin:0 1rem;background-color:", ";"], uiColors.lightGray);
|
|
35556
|
+
var Cost = /*#__PURE__*/styled.p.withConfig({
|
|
35557
|
+
displayName: "Spell__Cost",
|
|
35558
|
+
componentId: "sc-j96fa2-6"
|
|
35559
|
+
})(["display:flex;align-items:center;flex-direction:column;gap:0.5rem;div{z-index:1;}.mana{position:relative;font-size:", ";font-weight:bold;z-index:1;&::after{position:absolute;content:'';top:0;left:0;background-color:", ";width:100%;height:100%;border-radius:50%;transform:scale(1.8);filter:blur(10px);z-index:-1;}}"], uiFonts.size.medium, uiColors.blue);
|
|
35560
|
+
var Overlay = /*#__PURE__*/styled.p.withConfig({
|
|
35561
|
+
displayName: "Spell__Overlay",
|
|
35562
|
+
componentId: "sc-j96fa2-7"
|
|
35563
|
+
})(["margin:0 !important;position:absolute;top:0;left:0;width:100%;height:100%;border-radius:1rem;display:flex;justify-content:center;align-items:center;color:", ";font-size:", " !important;font-weight:bold;z-index:10;background-color:rgba(0 0 0 / 0.2);"], uiColors.yellow, uiFonts.size.large);
|
|
35564
|
+
|
|
35565
|
+
var SpellbookShortcuts = function SpellbookShortcuts(_ref) {
|
|
35566
|
+
var setSettingShortcutIndex = _ref.setSettingShortcutIndex,
|
|
35567
|
+
settingShortcutIndex = _ref.settingShortcutIndex,
|
|
35568
|
+
shortcuts = _ref.shortcuts,
|
|
35569
|
+
removeShortcut = _ref.removeShortcut;
|
|
35570
|
+
return React__default.createElement(List$1, {
|
|
35571
|
+
id: "shortcuts_list"
|
|
35572
|
+
}, "Spells shortcuts:", Array.from({
|
|
35573
|
+
length: 4
|
|
35574
|
+
}).map(function (_, i) {
|
|
35575
|
+
var _shortcuts$i2;
|
|
35576
|
+
return React__default.createElement(SpellShortcut$1, {
|
|
35577
|
+
key: i,
|
|
35578
|
+
onClick: function onClick() {
|
|
35579
|
+
var _shortcuts$i;
|
|
35580
|
+
removeShortcut(i);
|
|
35581
|
+
if (!((_shortcuts$i = shortcuts[i]) != null && _shortcuts$i.key)) setSettingShortcutIndex(i);
|
|
35582
|
+
},
|
|
35583
|
+
disabled: settingShortcutIndex !== -1 && settingShortcutIndex !== i,
|
|
35584
|
+
isBeingSet: settingShortcutIndex === i
|
|
35585
|
+
}, React__default.createElement("span", null, (_shortcuts$i2 = shortcuts[i]) == null ? void 0 : _shortcuts$i2.magicWords.split(' ').map(function (word) {
|
|
35586
|
+
return word[0];
|
|
35587
|
+
})));
|
|
35588
|
+
}));
|
|
35589
|
+
};
|
|
35590
|
+
var SpellShortcut$1 = /*#__PURE__*/styled.button.withConfig({
|
|
35591
|
+
displayName: "SpellbookShortcuts__SpellShortcut",
|
|
35592
|
+
componentId: "sc-fr4a0d-0"
|
|
35593
|
+
})(["width:2.6rem;height:2.6rem;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;span{margin-top:4px;}&:hover,&:focus{background-color:", ";}&:active{background-color:", ";}&:disabled{opacity:0.5;}"], uiColors.lightGray, function (_ref2) {
|
|
35594
|
+
var isBeingSet = _ref2.isBeingSet;
|
|
35595
|
+
return isBeingSet ? uiColors.yellow : uiColors.darkGray;
|
|
35596
|
+
}, uiColors.darkGray, uiColors.gray);
|
|
35597
|
+
var List$1 = /*#__PURE__*/styled.p.withConfig({
|
|
35598
|
+
displayName: "SpellbookShortcuts__List",
|
|
35599
|
+
componentId: "sc-fr4a0d-1"
|
|
35600
|
+
})(["width:100%;display:flex;align-items:center;justify-content:flex-end;gap:0.5rem;padding:0.5rem;box-sizing:border-box;margin:0 !important;"]);
|
|
35601
|
+
|
|
35602
|
+
var Spellbook = function Spellbook(_ref) {
|
|
35603
|
+
var onClose = _ref.onClose,
|
|
35604
|
+
onInputFocus = _ref.onInputFocus,
|
|
35605
|
+
onInputBlur = _ref.onInputBlur,
|
|
35606
|
+
spells = _ref.spells,
|
|
35607
|
+
magicLevel = _ref.magicLevel,
|
|
35608
|
+
mana = _ref.mana,
|
|
35609
|
+
onSpellClick = _ref.onSpellClick,
|
|
35610
|
+
setSpellShortcut = _ref.setSpellShortcut,
|
|
35611
|
+
spellShortcuts = _ref.spellShortcuts,
|
|
35612
|
+
removeSpellShortcut = _ref.removeSpellShortcut;
|
|
35613
|
+
var _useState = React.useState(''),
|
|
35614
|
+
search = _useState[0],
|
|
35615
|
+
setSearch = _useState[1];
|
|
35616
|
+
var _useState2 = React.useState(-1),
|
|
35617
|
+
settingShortcutIndex = _useState2[0],
|
|
35618
|
+
setSettingShortcutIndex = _useState2[1];
|
|
35619
|
+
React.useEffect(function () {
|
|
35620
|
+
var handleEscapeClose = function handleEscapeClose(e) {
|
|
35621
|
+
if (e.key === 'Escape') {
|
|
35622
|
+
onClose == null ? void 0 : onClose();
|
|
35623
|
+
}
|
|
35624
|
+
};
|
|
35625
|
+
document.addEventListener('keydown', handleEscapeClose);
|
|
35626
|
+
return function () {
|
|
35627
|
+
document.removeEventListener('keydown', handleEscapeClose);
|
|
35628
|
+
};
|
|
35629
|
+
}, [onClose]);
|
|
35630
|
+
var spellsToDisplay = React.useMemo(function () {
|
|
35631
|
+
return spells.sort(function (a, b) {
|
|
35632
|
+
if (a.minMagicLevelRequired > b.minMagicLevelRequired) return 1;
|
|
35633
|
+
if (a.minMagicLevelRequired < b.minMagicLevelRequired) return -1;
|
|
35634
|
+
return 0;
|
|
35635
|
+
}).filter(function (spell) {
|
|
35636
|
+
return spell.name.toLocaleLowerCase().includes(search.toLocaleLowerCase()) || spell.magicWords.toLocaleLowerCase().includes(search.toLocaleLowerCase());
|
|
35637
|
+
});
|
|
35638
|
+
}, [search, spells]);
|
|
35639
|
+
var setShortcut = function setShortcut(spellKey) {
|
|
35640
|
+
setSpellShortcut == null ? void 0 : setSpellShortcut(spellKey, settingShortcutIndex);
|
|
35641
|
+
setSettingShortcutIndex(-1);
|
|
35642
|
+
};
|
|
35643
|
+
return React__default.createElement(DraggableContainer, {
|
|
35644
|
+
type: exports.RPGUIContainerTypes.Framed,
|
|
35645
|
+
onCloseButton: onClose,
|
|
35646
|
+
width: "inherit",
|
|
35647
|
+
height: "inherit",
|
|
35648
|
+
cancelDrag: "#spellbook-search, #shortcuts_list, .spell"
|
|
35649
|
+
}, React__default.createElement(Container$j, null, React__default.createElement(Title$6, null, "Learned Spells"), React__default.createElement(SpellbookShortcuts, {
|
|
35650
|
+
setSettingShortcutIndex: setSettingShortcutIndex,
|
|
35651
|
+
settingShortcutIndex: settingShortcutIndex,
|
|
35652
|
+
shortcuts: spellShortcuts,
|
|
35653
|
+
removeShortcut: removeSpellShortcut
|
|
35654
|
+
}), React__default.createElement(Input, {
|
|
35655
|
+
placeholder: "Search for spell",
|
|
35656
|
+
value: search,
|
|
35657
|
+
onChange: function onChange(e) {
|
|
35658
|
+
return setSearch(e.target.value);
|
|
35659
|
+
},
|
|
35660
|
+
onFocus: onInputFocus,
|
|
35661
|
+
onBlur: onInputBlur,
|
|
35662
|
+
id: "spellbook-search"
|
|
35663
|
+
}), React__default.createElement(SpellList, null, spellsToDisplay.map(function (spell) {
|
|
35664
|
+
return React__default.createElement(React.Fragment, {
|
|
35665
|
+
key: spell.key
|
|
35666
|
+
}, React__default.createElement(Spell, Object.assign({
|
|
35667
|
+
charMana: mana,
|
|
35668
|
+
charMagicLevel: magicLevel,
|
|
35669
|
+
onClick: settingShortcutIndex !== -1 ? setShortcut : onSpellClick,
|
|
35670
|
+
spellKey: spell.key,
|
|
35671
|
+
isSettingShortcut: settingShortcutIndex !== -1
|
|
35672
|
+
}, spell)));
|
|
35673
|
+
}))));
|
|
35674
|
+
};
|
|
35675
|
+
var Title$6 = /*#__PURE__*/styled.h1.withConfig({
|
|
35676
|
+
displayName: "Spellbook__Title",
|
|
35677
|
+
componentId: "sc-r02nfq-0"
|
|
35678
|
+
})(["font-size:", " !important;margin-bottom:0 !important;"], uiFonts.size.large);
|
|
35679
|
+
var Container$j = /*#__PURE__*/styled.div.withConfig({
|
|
35680
|
+
displayName: "Spellbook__Container",
|
|
35681
|
+
componentId: "sc-r02nfq-1"
|
|
35682
|
+
})(["width:100%;height:100%;color:white;display:flex;flex-direction:column;"]);
|
|
35683
|
+
var SpellList = /*#__PURE__*/styled.div.withConfig({
|
|
35684
|
+
displayName: "Spellbook__SpellList",
|
|
35685
|
+
componentId: "sc-r02nfq-2"
|
|
35686
|
+
})(["width:100%;min-height:0;flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:1.5rem;margin-top:1rem;"]);
|
|
35687
|
+
|
|
35430
35688
|
var TextArea = function TextArea(_ref) {
|
|
35431
35689
|
var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
35432
35690
|
return React__default.createElement("textarea", Object.assign({}, props));
|
|
@@ -35627,7 +35885,7 @@ var TradingMenu = function TradingMenu(_ref) {
|
|
|
35627
35885
|
style: {
|
|
35628
35886
|
width: '100%'
|
|
35629
35887
|
}
|
|
35630
|
-
}, React__default.createElement(Title$
|
|
35888
|
+
}, React__default.createElement(Title$7, null, Capitalize(type), " Menu"), React__default.createElement("hr", {
|
|
35631
35889
|
className: "golden"
|
|
35632
35890
|
})), React__default.createElement(TradingComponentScrollWrapper, null, traderItems.map(function (tradeItem, index) {
|
|
35633
35891
|
var _qtyMap$get;
|
|
@@ -35653,7 +35911,7 @@ var TradingMenu = function TradingMenu(_ref) {
|
|
|
35653
35911
|
}
|
|
35654
35912
|
}, "Cancel"))));
|
|
35655
35913
|
};
|
|
35656
|
-
var Title$
|
|
35914
|
+
var Title$7 = /*#__PURE__*/styled.h1.withConfig({
|
|
35657
35915
|
displayName: "TradingMenu__Title",
|
|
35658
35916
|
componentId: "sc-1wjsz1l-0"
|
|
35659
35917
|
})(["z-index:22;font-size:0.6rem;color:yellow !important;"]);
|
|
@@ -35687,11 +35945,11 @@ var Truncate = function Truncate(_ref) {
|
|
|
35687
35945
|
var _ref$maxLines = _ref.maxLines,
|
|
35688
35946
|
maxLines = _ref$maxLines === void 0 ? 1 : _ref$maxLines,
|
|
35689
35947
|
children = _ref.children;
|
|
35690
|
-
return React__default.createElement(Container$
|
|
35948
|
+
return React__default.createElement(Container$k, {
|
|
35691
35949
|
maxLines: maxLines
|
|
35692
35950
|
}, children);
|
|
35693
35951
|
};
|
|
35694
|
-
var Container$
|
|
35952
|
+
var Container$k = /*#__PURE__*/styled.div.withConfig({
|
|
35695
35953
|
displayName: "Truncate__Container",
|
|
35696
35954
|
componentId: "sc-6x00qb-0"
|
|
35697
35955
|
})(["display:-webkit-box;max-width:100%;max-height:100%;-webkit-line-clamp:", ";-webkit-box-orient:vertical;overflow:hidden;"], function (props) {
|
|
@@ -35724,11 +35982,13 @@ exports.PropertySelect = PropertySelect;
|
|
|
35724
35982
|
exports.QuestInfo = QuestInfo;
|
|
35725
35983
|
exports.QuestList = QuestList;
|
|
35726
35984
|
exports.QuestionDialog = QuestionDialog;
|
|
35985
|
+
exports.QuickSpells = QuickSpells;
|
|
35727
35986
|
exports.RPGUIContainer = RPGUIContainer;
|
|
35728
35987
|
exports.RPGUIRoot = RPGUIRoot;
|
|
35729
35988
|
exports.RangeSlider = RangeSlider;
|
|
35730
35989
|
exports.SkillProgressBar = SkillProgressBar;
|
|
35731
35990
|
exports.SkillsContainer = SkillsContainer;
|
|
35991
|
+
exports.Spellbook = Spellbook;
|
|
35732
35992
|
exports.SpriteFromAtlas = SpriteFromAtlas;
|
|
35733
35993
|
exports.TextArea = TextArea;
|
|
35734
35994
|
exports.TimeWidget = TimeWidget;
|