use fragment material and avatar star up also prevent capt. exp overflow

this took wayyyyyyyyyy longer than it shoud be
This commit is contained in:
rafi1212122
2023-06-05 11:05:27 +07:00
parent 130f83544c
commit 934e7475d7
10 changed files with 355 additions and 1 deletions

View File

@@ -90,6 +90,20 @@ namespace Common.Database
return levelData;
}
public void StarUp()
{
AvatarDataExcel? avatarData = AvatarData.GetInstance().FromId((int)AvatarId);
if (avatarData is not null)
{
AvatarStarType.StarInfo nextStarInfo = AvatarStarType.GetInstance().GetNextStar(avatarData.AvatarType, avatarData.AvatarStarUpType, new((int)Star, (int)SubStar));
SubStar = (uint)nextStarInfo.SubStar;
Star = (uint)nextStarInfo.Star;
Fragment -= (uint)nextStarInfo.Cost;
}
}
public void AddFragment(uint num) { Fragment += num; }
public void LevelUpSkill(uint subSkillId, bool isLevelUpAll = false)
{
AvatarSubSkillDataExcel? subSkillData = AvatarSubSkillData.GetInstance().FromId((int)subSkillId);

View File

@@ -1,6 +1,7 @@
using MongoDB.Bson;
using Common.Resources.Proto;
using MongoDB.Driver;
using Common.Utils.ExcelReader;
namespace Common.Database
{
@@ -79,10 +80,20 @@ namespace Common.Database
{
User.collection.ReplaceOne(Builders<UserScheme>.Filter.Eq(user => user.Id, Id), this);
}
public uint GetCreationTime()
{
return (uint)((DateTimeOffset)Id.CreationTime).ToUnixTimeSeconds();
}
public void AddExp(int exp)
{
Exp += exp;
if (Exp > PlayerLevelData.GetInstance().GetMaxPossibleExp())
{
Exp = PlayerLevelData.GetInstance().GetMaxPossibleExp();
}
}
}
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.