@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.
@@ -37142,6 +37142,20 @@ var SpellInfoWrapper = function SpellInfoWrapper(_ref) {
37142
37142
  }));
37143
37143
  };
37144
37144
 
37145
+ var SKILL_NAMES = {
37146
+ magicLevel: 'magic level',
37147
+ distanceFighting: 'distance fighting',
37148
+ swordFighting: 'sword fighting',
37149
+ axeFighting: 'axe fighting',
37150
+ clubFighting: 'club fighting',
37151
+ shielding: 'shielding',
37152
+ fishing: 'fishing',
37153
+ cooking: 'cooking',
37154
+ firstAid: 'first aid'
37155
+ };
37156
+ var getSkillName = function getSkillName(attribute) {
37157
+ return SKILL_NAMES[attribute] || attribute;
37158
+ };
37145
37159
  var Spell = function Spell(_ref) {
37146
37160
  var _spell$texturePath;
37147
37161
  var atlasIMG = _ref.atlasIMG,
@@ -37149,16 +37163,31 @@ var Spell = function Spell(_ref) {
37149
37163
  spellKey = _ref.spellKey,
37150
37164
  charMana = _ref.charMana,
37151
37165
  charMagicLevel = _ref.charMagicLevel,
37166
+ charSkillLevels = _ref.charSkillLevels,
37152
37167
  onPointerUp = _ref.onPointerUp,
37153
37168
  isSettingShortcut = _ref.isSettingShortcut,
37154
37169
  spell = _ref.spell,
37155
37170
  activeCooldown = _ref.activeCooldown;
37156
37171
  var manaCost = spell.manaCost,
37157
37172
  minMagicLevelRequired = spell.minMagicLevelRequired,
37173
+ minSkillLevelRequired = spell.minSkillLevelRequired,
37174
+ attribute = spell.attribute,
37158
37175
  magicWords = spell.magicWords,
37159
37176
  name = spell.name,
37160
37177
  description = spell.description;
37161
- var disabled = isSettingShortcut ? charMagicLevel < minMagicLevelRequired : manaCost > charMana || charMagicLevel < minMagicLevelRequired;
37178
+ var getRequiredLevel = function getRequiredLevel() {
37179
+ return minSkillLevelRequired != null ? minSkillLevelRequired : minMagicLevelRequired;
37180
+ };
37181
+ var getCharacterSkillLevel = function getCharacterSkillLevel() {
37182
+ if (attribute && charSkillLevels) {
37183
+ var _charSkillLevels$attr;
37184
+ return (_charSkillLevels$attr = charSkillLevels[attribute]) != null ? _charSkillLevels$attr : 0;
37185
+ }
37186
+ return charMagicLevel;
37187
+ };
37188
+ var requiredLevel = getRequiredLevel();
37189
+ var characterSkillLevel = getCharacterSkillLevel();
37190
+ var disabled = isSettingShortcut ? characterSkillLevel < requiredLevel : manaCost > charMana || characterSkillLevel < requiredLevel;
37162
37191
  var CONTAINER_STYLE = {
37163
37192
  width: '32px',
37164
37193
  height: '32px'
@@ -37170,7 +37199,7 @@ var Spell = function Spell(_ref) {
37170
37199
  onPointerUp: onPointerUp == null ? void 0 : onPointerUp.bind(null, spellKey),
37171
37200
  isSettingShortcut: isSettingShortcut && !disabled,
37172
37201
  className: "spell"
37173
- }, disabled && React.createElement(Overlay$3, null, charMagicLevel < minMagicLevelRequired ? 'Low magic level' : manaCost > charMana && 'No mana'), React.createElement(SpellImage, null, activeCooldown && activeCooldown > 0 ? React.createElement("span", {
37202
+ }, disabled && React.createElement(Overlay$3, null, characterSkillLevel < requiredLevel ? "Low " + getSkillName(attribute || 'magic level') + " level" : manaCost > charMana && 'No mana'), React.createElement(SpellImage, null, activeCooldown && activeCooldown > 0 ? React.createElement("span", {
37174
37203
  className: "cooldown"
37175
37204
  }, activeCooldown.toFixed(activeCooldown > 10 ? 0 : 1)) : null, React.createElement(SpriteFromAtlas, {
37176
37205
  atlasIMG: atlasIMG,
@@ -37228,6 +37257,7 @@ var Spellbook = function Spellbook(_ref) {
37228
37257
  spells = _ref.spells,
37229
37258
  magicLevel = _ref.magicLevel,
37230
37259
  mana = _ref.mana,
37260
+ charSkillLevels = _ref.charSkillLevels,
37231
37261
  onSpellClick = _ref.onSpellClick,
37232
37262
  setSpellShortcut = _ref.setSpellShortcut,
37233
37263
  shortcuts = _ref.shortcuts,
@@ -37288,6 +37318,7 @@ var Spellbook = function Spellbook(_ref) {
37288
37318
  atlasJSON: iconAtlasJSON,
37289
37319
  charMana: mana,
37290
37320
  charMagicLevel: magicLevel,
37321
+ charSkillLevels: charSkillLevels,
37291
37322
  onPointerUp: settingShortcutIndex !== -1 ? setShortcut : onSpellClick,
37292
37323
  spellKey: spell.key,
37293
37324
  isSettingShortcut: settingShortcutIndex !== -1,