mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 17:58:26 -04:00
- Added Cloneable deep clone source generator nuget package
- Configs are no cloned using generated clone, not by serializing/deserializing - Arrays/Lists (collections in geneeral) are still not cloned properly - Removed GetRawData from config as it is no longer needed, new clone is very fast - Added ICloneable<T> which all configs implement - Cleaned up config classes/code
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
using NadekoBot.Common.Yml;
|
||||
using Cloneable;
|
||||
using NadekoBot.Common;
|
||||
using NadekoBot.Common.Yml;
|
||||
|
||||
namespace NadekoBot.Modules.Xp
|
||||
{
|
||||
public sealed class XpConfig
|
||||
[Cloneable]
|
||||
public sealed partial class XpConfig : ICloneable<XpConfig>
|
||||
{
|
||||
[Comment(@"DO NOT CHANGE")]
|
||||
public int Version { get; set; } = 2;
|
||||
|
@@ -623,15 +623,16 @@ namespace NadekoBot.Modules.Xp.Services
|
||||
if (!ShouldTrackXp(user, arg.Channel.Id))
|
||||
return;
|
||||
|
||||
var xpConf = _xpConfig.Data;
|
||||
var xp = 0;
|
||||
if (arg.Attachments.Any(a => a.Height >= 128 && a.Width >= 128))
|
||||
{
|
||||
xp = _xpConfig.GetRawData().XpFromImage;
|
||||
xp = xpConf.XpFromImage;
|
||||
}
|
||||
|
||||
if (arg.Content.Contains(' ') || arg.Content.Length >= 5)
|
||||
{
|
||||
xp = Math.Max(xp, _xpConfig.GetRawData().XpPerMessage);
|
||||
xp = Math.Max(xp, xpConf.XpPerMessage);
|
||||
}
|
||||
|
||||
if (xp <= 0)
|
||||
|
Reference in New Issue
Block a user