Adding support in mods
Updated 3 weeks agoReferencing the .dll
Currently no nuget package exists and I cba to set one up, so manually download the mod and reference it in yours. You must write the code yourself to check if the mod is installed on the user, but the mod guid should be: com.atomic.leveling
Using the API
To get the local players stats, do:
LevelingAPI.LevelLevelingAPI.ExperienceLevelingAPI.OneUseItems
If you need to get another players in the lobbies level that has the mod installed do:
LevelingAPI.GetPlayerLevel(player)-- player is a Photon.Realtime.Player (PhotonPlayer)
The level is the only tracked stat across clients, this is because experience is easy to get and we use RPCs to transfer data, however if requested we may optimise the networking and add experience tracking.
To award XP to the local player do:
LevelingAPI.AddExperience(amount, applyAscentMultiplier)-- Ascents give multipliers, some xp gaining system may not want this so we made it an optional field. It is true by default if not present.
Are you adding support for an item? If its using an item, it should be added automatically, but even if you need to add extra xp gaining abilities and only want to give this xp once ever then this is what you are looking for:
LevelingAPI.AddOneUseItem(itemName)-- itemName is the item.UIData.itemName that will be checked for one time use.LevelingAPI.SetOneUseItem(itemName)-- Will set an item as used and wont gain xp from the UseItemPatches
This can also be used differently with your own custom code. By using LevelingAPI.OneUseItems you can track if your item has been used (This is a Dictionary<string, bool>) - string being itemName and bool being if its been used. So maybe the first time its used it will give more xp than all the other times.