Installation and Setup

Installation

You can install level-algorithm via npm (Node Package Manager). Make sure you have Node.js installed on your machine before proceeding.

npm install level-algorithm

Usage

Once installed, you can use @mr_fozan/level in your Node.js applications as follows:

const LevelAlgorithm = require('level-algorithm');

// Example configuration
const levelAlgorithm = new LevelAlgorithm({
  baseExperience: 100,
  experienceMultiplier: 1.5
});

// Use levelAlgorithm methods
const currentExperience = 350;
const currentLevel = levelAlgorithm.calculateLevel({
  experience: currentExperience,
  baseExperience: levelAlgorithm.baseExperience,
  experienceMultiplier: levelAlgorithm.experienceMultiplier
});
console.log(`Current level: ${currentLevel}`);

Configuration

  • baseExperience: The base amount of experience points required for level 1.

  • experienceMultiplier: The multiplier applied to base experience points for each subsequent level.

Additional Notes

  • Ensure that you handle asynchronous operations appropriately if any of your calculations involve promises or async functions.

  • Refer to the documentation for detailed information on each method and their parameters.

Last updated