🚀 How to Play
Level Up

Level Up Mechanism

Now let’s dive into the code for the level up mechanism. The selected code is part of the _levelUp function in the PlayerStorageLib contract. This function is used to level up a player, increasing their stats based on the _stat parameter. The code checks if the player has enough XP to level up, and if so, increases the specified stat by 1. It also restores the player's health to its maximum value and deducts the XP required from the player. Finally, it increases the player's level. This function is called by the PlayerFacet contract, which is responsible for managing player data. The PlayerStorageLib contract stores player data in a diamond storage slot, and the _levelUp function is used to update the player data when a level up occurs. Basically, you can get to your current level * 10 and pick which point you want to increase.

Introducing a Skill Tree

We are going to introduce a skill tree. Once players hit a certain level, they will unlock this feature, which will help them craft and farm (once the farming simulator and crafting is live).