Rewrite xp gain loop. Hopefully faster and fixes xp freeze bugs.

This commit is contained in:
Kwoth
2022-07-07 17:09:11 +00:00
parent 470bb9657f
commit 744018802f
5 changed files with 260 additions and 167 deletions

View File

@@ -3,7 +3,7 @@ using NadekoBot.Modules.Xp.Services;
namespace NadekoBot.Modules.Xp;
public class LevelStats
public readonly struct LevelStats
{
public long Level { get; }
public long LevelXp { get; }

View File

@@ -1,16 +1,13 @@
#nullable disable
using Cloneable;
namespace NadekoBot.Modules.Xp.Services;
public class UserCacheItem
[Cloneable]
public sealed partial class UserXpGainData : ICloneable<UserXpGainData>
{
public IGuildUser User { get; set; }
public IGuild Guild { get; set; }
public IMessageChannel Channel { get; set; }
public int XpAmount { get; set; }
public override int GetHashCode()
=> User.GetHashCode();
public override bool Equals(object obj)
=> obj is UserCacheItem uci && uci.User == User;
}