implement playerservice

This commit is contained in:
CWX
2025-01-20 16:57:01 +00:00
parent e390905caf
commit 59f6d08ff9
+21 -3
View File
@@ -1,13 +1,31 @@
using SptCommon.Annotations;
using Core.Models.Eft.Common;
using Core.Models.Utils;
using Core.Utils;
namespace Core.Services;
[Injectable(InjectionType.Singleton)]
public class PlayerService
public class PlayerService(
DatabaseService _databaseService
)
{
public int CalculateLevel(PmcData pmcData)
public int? CalculateLevel(PmcData pmcData)
{
throw new NotImplementedException();
var accExp = 0;
for (int i = 0; i < _databaseService.GetGlobals().Configuration.Exp.Level.ExperienceTable.Length; i++)
{
accExp += _databaseService.GetGlobals().Configuration.Exp.Level.ExperienceTable[i].Experience ?? 0;
if (pmcData.Info.Experience < accExp)
{
break;
}
pmcData.Info.Level = i + 1;
}
return pmcData.Info.Level;
}
}