@rpg-engine/long-bow 0.8.92 → 0.8.93
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 +1 -0
- package/dist/components/Spellbook/Spellbook.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +33 -2
- 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 +33 -2
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Spellbook/Spell.tsx +38 -4
- package/src/components/Spellbook/Spellbook.tsx +3 -0
|
@@ -7,6 +7,7 @@ export interface ISpellbookProps {
|
|
|
7
7
|
spells: ISpell[];
|
|
8
8
|
magicLevel: number;
|
|
9
9
|
mana: number;
|
|
10
|
+
charSkillLevels?: Record<string, number>;
|
|
10
11
|
onSpellClick: (spellKey: string) => void;
|
|
11
12
|
setSpellShortcut: (key: string, index: number) => void;
|
|
12
13
|
shortcuts: IShortcut[];
|
|
@@ -37145,6 +37145,20 @@ var SpellInfoWrapper = function SpellInfoWrapper(_ref) {
|
|
|
37145
37145
|
}));
|
|
37146
37146
|
};
|
|
37147
37147
|
|
|
37148
|
+
var SKILL_NAMES = {
|
|
37149
|
+
magicLevel: 'magic level',
|
|
37150
|
+
distanceFighting: 'distance fighting',
|
|
37151
|
+
swordFighting: 'sword fighting',
|
|
37152
|
+
axeFighting: 'axe fighting',
|
|
37153
|
+
clubFighting: 'club fighting',
|
|
37154
|
+
shielding: 'shielding',
|
|
37155
|
+
fishing: 'fishing',
|
|
37156
|
+
cooking: 'cooking',
|
|
37157
|
+
firstAid: 'first aid'
|
|
37158
|
+
};
|
|
37159
|
+
var getSkillName = function getSkillName(attribute) {
|
|
37160
|
+
return SKILL_NAMES[attribute] || attribute;
|
|
37161
|
+
};
|
|
37148
37162
|
var Spell = function Spell(_ref) {
|
|
37149
37163
|
var _spell$texturePath;
|
|
37150
37164
|
var atlasIMG = _ref.atlasIMG,
|
|
@@ -37152,16 +37166,31 @@ var Spell = function Spell(_ref) {
|
|
|
37152
37166
|
spellKey = _ref.spellKey,
|
|
37153
37167
|
charMana = _ref.charMana,
|
|
37154
37168
|
charMagicLevel = _ref.charMagicLevel,
|
|
37169
|
+
charSkillLevels = _ref.charSkillLevels,
|
|
37155
37170
|
onPointerUp = _ref.onPointerUp,
|
|
37156
37171
|
isSettingShortcut = _ref.isSettingShortcut,
|
|
37157
37172
|
spell = _ref.spell,
|
|
37158
37173
|
activeCooldown = _ref.activeCooldown;
|
|
37159
37174
|
var manaCost = spell.manaCost,
|
|
37160
37175
|
minMagicLevelRequired = spell.minMagicLevelRequired,
|
|
37176
|
+
minSkillLevelRequired = spell.minSkillLevelRequired,
|
|
37177
|
+
attribute = spell.attribute,
|
|
37161
37178
|
magicWords = spell.magicWords,
|
|
37162
37179
|
name = spell.name,
|
|
37163
37180
|
description = spell.description;
|
|
37164
|
-
var
|
|
37181
|
+
var getRequiredLevel = function getRequiredLevel() {
|
|
37182
|
+
return minSkillLevelRequired != null ? minSkillLevelRequired : minMagicLevelRequired;
|
|
37183
|
+
};
|
|
37184
|
+
var getCharacterSkillLevel = function getCharacterSkillLevel() {
|
|
37185
|
+
if (attribute && charSkillLevels) {
|
|
37186
|
+
var _charSkillLevels$attr;
|
|
37187
|
+
return (_charSkillLevels$attr = charSkillLevels[attribute]) != null ? _charSkillLevels$attr : 0;
|
|
37188
|
+
}
|
|
37189
|
+
return charMagicLevel;
|
|
37190
|
+
};
|
|
37191
|
+
var requiredLevel = getRequiredLevel();
|
|
37192
|
+
var characterSkillLevel = getCharacterSkillLevel();
|
|
37193
|
+
var disabled = isSettingShortcut ? characterSkillLevel < requiredLevel : manaCost > charMana || characterSkillLevel < requiredLevel;
|
|
37165
37194
|
var CONTAINER_STYLE = {
|
|
37166
37195
|
width: '32px',
|
|
37167
37196
|
height: '32px'
|
|
@@ -37173,7 +37202,7 @@ var Spell = function Spell(_ref) {
|
|
|
37173
37202
|
onPointerUp: onPointerUp == null ? void 0 : onPointerUp.bind(null, spellKey),
|
|
37174
37203
|
isSettingShortcut: isSettingShortcut && !disabled,
|
|
37175
37204
|
className: "spell"
|
|
37176
|
-
}, disabled && React__default.createElement(Overlay$3, null,
|
|
37205
|
+
}, disabled && React__default.createElement(Overlay$3, null, characterSkillLevel < requiredLevel ? "Low " + getSkillName(attribute || 'magic level') + " level" : manaCost > charMana && 'No mana'), React__default.createElement(SpellImage, null, activeCooldown && activeCooldown > 0 ? React__default.createElement("span", {
|
|
37177
37206
|
className: "cooldown"
|
|
37178
37207
|
}, activeCooldown.toFixed(activeCooldown > 10 ? 0 : 1)) : null, React__default.createElement(SpriteFromAtlas, {
|
|
37179
37208
|
atlasIMG: atlasIMG,
|
|
@@ -37231,6 +37260,7 @@ var Spellbook = function Spellbook(_ref) {
|
|
|
37231
37260
|
spells = _ref.spells,
|
|
37232
37261
|
magicLevel = _ref.magicLevel,
|
|
37233
37262
|
mana = _ref.mana,
|
|
37263
|
+
charSkillLevels = _ref.charSkillLevels,
|
|
37234
37264
|
onSpellClick = _ref.onSpellClick,
|
|
37235
37265
|
setSpellShortcut = _ref.setSpellShortcut,
|
|
37236
37266
|
shortcuts = _ref.shortcuts,
|
|
@@ -37291,6 +37321,7 @@ var Spellbook = function Spellbook(_ref) {
|
|
|
37291
37321
|
atlasJSON: iconAtlasJSON,
|
|
37292
37322
|
charMana: mana,
|
|
37293
37323
|
charMagicLevel: magicLevel,
|
|
37324
|
+
charSkillLevels: charSkillLevels,
|
|
37294
37325
|
onPointerUp: settingShortcutIndex !== -1 ? setShortcut : onSpellClick,
|
|
37295
37326
|
spellKey: spell.key,
|
|
37296
37327
|
isSettingShortcut: settingShortcutIndex !== -1,
|