Skip to content

Commit 405309f

Browse files
authored
Revert "添加与完善经验系统 (#17) (#18)"
This reverts commit 5f4fdbb.
1 parent 5f4fdbb commit 405309f

23 files changed

+102
-182
lines changed

Commands/ExpCommand.cs

Lines changed: 0 additions & 39 deletions
This file was deleted.

Commands/MessageCommand.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ namespace YongAnFrame.Commands
1111
/// 发送消息指令
1212
/// </summary>
1313
[CommandHandler(typeof(RemoteAdminCommandHandler))]
14-
public sealed class MessageCommand : ICommand
14+
public sealed class MessageCommand : CommandPlus
1515
{
16-
public string Command => "message";
16+
public override string Command => "message";
1717

18-
public string[] Aliases => ["mes", "msg"];
18+
public override string[] Aliases => ["mes", "msg"];
1919

20-
public string Description => "用于发送消息";
20+
public override string Description => "用于发送消息";
2121

22-
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
22+
public override bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
2323
{
2424
List<FramePlayer> choicePlayer = [];
2525
if (arguments.Count < 3)

Commands/PlayerCommand.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
using CommandSystem;
22
using Exiled.API.Features;
33
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
48
using YongAnFrame.Players;
59

610
namespace YongAnFrame.Commands
@@ -26,11 +30,14 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
2630
{
2731
FramePlayer fPlayer = FramePlayer.Get(player);
2832
fPlayer.HintManager.Clean();
29-
fPlayer.ExPlayer.ShowHint($"<size=20>{YongAnFramePlugin.Instance.Config.BypassDoNotTrackText.Split('\n')}</size>", 10000f);
33+
string[] text = new string[36];
34+
35+
fPlayer.ExPlayer.ShowHint($"<size=20>{string.Join("\n", text)}\n\n\n\n\n\n\n\n\n\n\n\n\n\n</size>", 10000f);
3036
}
37+
3138
return true;
3239
}
33-
40+
3441
}
3542
return false;
3643
}

Commands/SkillCommand.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ namespace YongAnFrame.Commands
88
/// 未完成请勿乱用
99
/// </summary>
1010
[CommandHandler(typeof(ClientCommandHandler))]
11-
public sealed class SkillsCommand : ICommand
11+
public sealed class SkillsCommand : CommandPlus
1212
{
13-
public string Command => "skills";
13+
public override string Command => "skills";
1414

15-
public string[] Aliases => ["sk"];
15+
public override string[] Aliases => ["sk"];
1616

17-
public string Description => "skills";
17+
public override string Description => "skills";
1818

19-
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
19+
public override bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
2020
{
2121
response = "NO";
2222

Components/CapacityList.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
using System.Collections.Generic;
1+
using Exiled.API.Features;
2+
using System;
3+
using System.Collections;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
28

39
namespace YongAnFrame.Components
410
{
@@ -10,9 +16,9 @@ public class CapacityList<T>(int capacity)
1016

1117
public int Count => list.Count;
1218

13-
public T this[int index]
14-
{
15-
get
19+
public T this[int index]
20+
{
21+
get
1622
{
1723
if (Count > index)
1824
{

Events/EventArgs/FramePlayer/FramePlayerInvalidingEventArgs.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@ namespace YongAnFrame.Events.EventArgs.FramePlayer
55
/// <summary>
66
/// FramePlayer被无效时的事件数据
77
/// </summary>
8-
public sealed class FramePlayerInvalidatingEventArgs(Players.FramePlayer fPlayer) : IExiledEvent
8+
public sealed class FramePlayerInvalidatingEventArgs : IExiledEvent
99
{
10-
public Players.FramePlayer FPlayer { get; } = fPlayer;
10+
public Players.FramePlayer FPlayer { get; }
11+
12+
public FramePlayerInvalidatingEventArgs(Players.FramePlayer fPlayer)
13+
{
14+
FPlayer = fPlayer;
15+
}
1116
}
1217
}

Events/Handlers/FramePlayer.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,11 @@ public sealed class FramePlayer
1313
/// FramePlayer被无效时的事件
1414
/// </summary>
1515
public static Event<FramePlayerInvalidatingEventArgs> FramePlayerInvalidating { get; set; } = new Event<FramePlayerInvalidatingEventArgs>();
16-
/// <summary>
17-
/// FramePlayer提示刷新前的事件
18-
/// </summary>
19-
public static Event FramePlayerHintUpdate { get; set; } = new Event();
2016

2117
public static void OnFramePlayerCreated(FramePlayerCreatedEventArgs args)
2218
{
2319
FramePlayerCreated.InvokeSafely(args);
2420
}
25-
public static void OnFramerHintUpdate()
26-
{
27-
FramePlayerHintUpdate.InvokeSafely();
28-
}
2921
public static void OnFramePlayerInvalidating(FramePlayerInvalidatingEventArgs args)
3022
{
3123
FramePlayerInvalidating.InvokeSafely(args);

Players/CustomPlayer.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,11 @@ public abstract class CustomPlayer(FramePlayer player)
44
{
55
public FramePlayer FramePlayer { get; private set; } = player;
66
public bool IsInvalid => FramePlayer == null;
7-
public float ExpMultiplier { get { return FramePlayer.ExpMultiplier; } set { FramePlayer.ExpMultiplier = value; } }
8-
public ulong Exp { get { return FramePlayer.Exp; } set { FramePlayer.Exp = value; } }
97
public ulong Level { get { return FramePlayer.Level; } set { FramePlayer.Level = value; } }
108
public HintManager HintManager => FramePlayer.HintManager;
119
public PlayerTitle UsingTitles { get { return FramePlayer.UsingTitles; } set { FramePlayer.UsingTitles = value; } }
1210
public PlayerTitle UsingRankTitles { get { return FramePlayer.UsingRankTitles; } set { FramePlayer.UsingRankTitles = value; } }
1311

14-
public void AddExp(ulong exp, string name = "未知原因")
15-
{
16-
FramePlayer.AddExp(exp, name);
17-
}
18-
1912
public virtual void Invalid()
2013
{
2114
FramePlayer = null;

Players/FramePlayer.cs

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
using Exiled.Events.EventArgs.Player;
44
using Exiled.Events.Features;
55
using MEC;
6-
using System;
76
using System.Collections.Generic;
7+
using System.Linq;
88
using YongAnFrame.Events.EventArgs.FramePlayer;
99
using YongAnFrame.Roles;
10-
using static YongAnFrame.Players.HintManager;
1110

1211
namespace YongAnFrame.Players
1312
{
14-
public sealed class FramePlayer : ICustomAlgorithm
13+
public sealed class FramePlayer
1514
{
1615
private PlayerTitle usingTitles = null;
1716
private PlayerTitle usingRankTitles = null;
@@ -32,8 +31,7 @@ public sealed class FramePlayer : ICustomAlgorithm
3231
/// <summary>
3332
/// 实例拥有的自定义角色
3433
/// </summary>
35-
public CustomRolePlus CustomRolePlus
36-
{
34+
public CustomRolePlus CustomRolePlus {
3735
get
3836
{
3937
if (ExPlayer.GetCustomRoles().Count != 0)
@@ -47,25 +45,11 @@ public CustomRolePlus CustomRolePlus
4745
/// 提示系统管理器
4846
/// </summary>
4947
public HintManager HintManager { get; private set; }
50-
51-
/// <summary>
52-
/// 正在使用的主要自定义算法
53-
/// </summary>
54-
public ICustomAlgorithm CustomAlgorithm { get; set; }
55-
5648
/// <summary>
5749
/// 玩家等级
5850
/// </summary>
5951
public ulong Level { get; set; }
6052
/// <summary>
61-
/// 玩家经验
62-
/// </summary>
63-
public ulong Exp { get; set; }
64-
/// <summary>
65-
/// 玩家经验倍率
66-
/// </summary>
67-
public float ExpMultiplier { get; set; }
68-
/// <summary>
6953
/// 玩家批准绕过DNT
7054
/// </summary>
7155
public bool IsBDNT { get; set; }
@@ -120,36 +104,9 @@ internal FramePlayer(Player player)
120104
ExPlayer = player;
121105
HintManager = new HintManager(this);
122106
dictionary.Add(ExPlayer.Id, this);
123-
CustomAlgorithm = this;
124107
Events.Handlers.FramePlayer.OnFramePlayerCreated(new FramePlayerCreatedEventArgs(this));
125108
}
126109

127-
public void AddExp(ulong exp, string name = "未知原因")
128-
{
129-
float globalExpMultiplier = YongAnFramePlugin.Instance.Config.GlobalExpMultiplier;
130-
float expMultiplier = ExpMultiplier * globalExpMultiplier;
131-
ulong addExp = (ulong)(exp * expMultiplier);
132-
133-
Exp += addExp;
134-
HintManager.MessageTexts.Add(new Text($"{name},获得{exp}+{addExp - exp}经验({expMultiplier}倍经验)", 5));
135-
136-
ulong needExp = CustomAlgorithm.GetNeedUpLevel(Level);
137-
ulong oldLevel = Level;
138-
while (Exp >= needExp)
139-
{
140-
Log.Debug($"{Exp}/{needExp}");
141-
Level++;
142-
Exp -= needExp;
143-
needExp = CustomAlgorithm.GetNeedUpLevel(Level);
144-
}
145-
if (oldLevel < Level)
146-
{
147-
UpdateShowInfoList();
148-
HintManager.MessageTexts.Add(new Text($"恭喜你从{oldLevel}级到达{Level}级,距离下一级需要{Exp}/{needExp}经验", 8));
149-
}
150-
}
151-
152-
153110
#region ShowRank
154111

155112
private readonly CoroutineHandle[] coroutines = new CoroutineHandle[2];
@@ -279,11 +236,6 @@ private IEnumerator<float> DynamicTitlesShow()
279236
}
280237
#endregion
281238

282-
public ulong GetNeedUpLevel(ulong level)
283-
{
284-
return (ulong)(100 + Math.Floor(level / 10f) * 100);
285-
}
286-
287239
/// <summary>
288240
/// 获取框架玩家
289241
/// </summary>

Players/HintManager.cs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
using MEC;
1+
using Exiled.API.Features;
2+
using MEC;
23
using System.Collections.Generic;
4+
using System.Reflection;
35
using YongAnFrame.Components;
46

57
namespace YongAnFrame.Players
@@ -29,24 +31,23 @@ public IEnumerator<float> Update()
2931
{
3032
while (true)
3133
{
32-
Events.Handlers.FramePlayer.OnFramerHintUpdate();
3334
string[] text = new string[36];
3435

3536
int used = 0;
36-
text[used] = $"YongAnFrame 1.0.0-Beta1";
37+
text[used] = $"YongAnFrame 1.0.0-alpha7";
3738

3839
if (fPlayer.ExPlayer.DoNotTrack && !fPlayer.IsBDNT)
3940
{
4041
text[used] = "[注意]已开启DoNotTrack(DNT),游戏数据不会被保存,想保存数据请控制台输入pl BDNT查看详情";
4142
}
42-
43+
4344
used = 1;
4445
text[used] = "<align=left>";
4546

4647
for (int i = 0; i < ChatTexts.Capacity; i++)
4748
{
4849
Text chatText = ChatTexts[i];
49-
if (chatText != null)
50+
if(chatText != null)
5051
{
5152
text[used] += chatText;
5253
chatText.Duration--;
@@ -108,10 +109,16 @@ public void Clean()
108109
Timing.KillCoroutines(coroutine);
109110
}
110111

111-
public class Text(string text, float duration, int size = 0)
112+
public class Text
112113
{
113-
public string Content { get; private set; } = text;
114-
public float Duration { get; internal set; } = duration;
114+
public string Content { get; private set; }
115+
public float Duration { get; internal set; }
116+
117+
public Text(string text, float duration, int size = 0)
118+
{
119+
Content = text;
120+
Duration = duration;
121+
}
115122

116123
public override string ToString()
117124
{

0 commit comments

Comments
 (0)