Skip to content

Commit

Permalink
doc (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
YongAn404 authored Oct 24, 2024
1 parent 5f4fdbb commit b63aac3
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Commands/ExpCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace BAPlugin.Command
[CommandHandler(typeof(RemoteAdminCommandHandler))]
public class ExpCommand : ICommand
{
public string Command => "experience";
public string Command => "pexperience";

public string[] Aliases => ["pexp"];

Expand Down
62 changes: 55 additions & 7 deletions Players/CustomPlayer.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,69 @@
namespace YongAnFrame.Players
using YongAnFrame.Roles;

namespace YongAnFrame.Players
{
public abstract class CustomPlayer(FramePlayer player)
{
/// <summary>
/// 拥有该实例的框架玩家
/// </summary>
public FramePlayer FramePlayer { get; private set; } = player;
/// <summary>
/// 是否有效
/// </summary>
public bool IsInvalid => FramePlayer == null;
public float ExpMultiplier { get { return FramePlayer.ExpMultiplier; } set { FramePlayer.ExpMultiplier = value; } }
public ulong Exp { get { return FramePlayer.Exp; } set { FramePlayer.Exp = value; } }
public ulong Level { get { return FramePlayer.Level; } set { FramePlayer.Level = value; } }
/// <summary>
/// 实例拥有的自定义角色
/// </summary>
public CustomRolePlus CustomRolePlus => FramePlayer.CustomRolePlus;
/// <summary>
/// 提示系统管理器
/// </summary>
public HintManager HintManager => FramePlayer.HintManager;
public PlayerTitle UsingTitles { get { return FramePlayer.UsingTitles; } set { FramePlayer.UsingTitles = value; } }
public PlayerTitle UsingRankTitles { get { return FramePlayer.UsingRankTitles; } set { FramePlayer.UsingRankTitles = value; } }
/// <summary>
/// 正在使用的主要自定义算法
/// </summary>
public ICustomAlgorithm CustomAlgorithm { get => FramePlayer.CustomAlgorithm; set=> FramePlayer.CustomAlgorithm = value; }
/// <summary>
/// 玩家等级
/// </summary>
public ulong Level { get => FramePlayer.Level; set => FramePlayer.Level = value; }
/// <summary>
/// 玩家经验
/// </summary>
public ulong Exp { get => FramePlayer.Exp; set => FramePlayer.Exp = value; }
/// <summary>
/// 玩家经验倍率
/// </summary>
public float ExpMultiplier { get => FramePlayer.ExpMultiplier; set => FramePlayer.ExpMultiplier = value; }
/// <summary>
/// 玩家批准绕过DNT
/// </summary>
public bool IsBDNT { get => FramePlayer.IsBDNT; set => FramePlayer.IsBDNT = value; }
/// <summary>
/// 正在使用的名称称号
/// </summary>
public PlayerTitle UsingTitles { get => FramePlayer.UsingTitles; set => FramePlayer.UsingTitles = value; }

/// <summary>
/// 正在使用的排名称号
/// </summary>
public PlayerTitle UsingRankTitles { get => FramePlayer.UsingRankTitles; set => FramePlayer.UsingRankTitles = value; }

/// <summary>
/// 添加经验
/// </summary>
/// <param name="exp">数值</param>
/// <param name="name">原因</param>
public void AddExp(ulong exp, string name = "未知原因")
{
FramePlayer.AddExp(exp, name);
}

/// <summary>
/// 调用后该实例会立刻无效<br/>
/// 调用后该实例会立刻无效<br/>
/// 调用后该实例会立刻无效
/// </summary>
public virtual void Invalid()
{
FramePlayer = null;
Expand Down
5 changes: 5 additions & 0 deletions Players/FramePlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ internal FramePlayer(Player player)
Events.Handlers.FramePlayer.OnFramePlayerCreated(new FramePlayerCreatedEventArgs(this));
}

/// <summary>
/// 添加经验
/// </summary>
/// <param name="exp">数值</param>
/// <param name="name">原因</param>
public void AddExp(ulong exp, string name = "未知原因")
{
float globalExpMultiplier = YongAnFramePlugin.Instance.Config.GlobalExpMultiplier;
Expand Down
5 changes: 5 additions & 0 deletions Players/ICustomAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{
public interface ICustomAlgorithm
{
/// <summary>
/// 获取升级所需要的经验
/// </summary>
/// <param name="level"></param>
/// <returns></returns>
public ulong GetNeedUpLevel(ulong level);
}
}
2 changes: 1 addition & 1 deletion Roles/Properties/SkillProperties.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace YongAnFrame.Roles.Properties
{
public struct SkillProperties(string name, string statement, string description, float activeMaxTime, float burialMaxTime, ItemType useItem = ItemType.Coin)
public readonly struct SkillProperties(string name, string statement, string description, float activeMaxTime, float burialMaxTime, ItemType useItem = ItemType.Coin)
{
/// <summary>
/// 技能名称
Expand Down
13 changes: 5 additions & 8 deletions YongAnTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,12 @@ public static FramePlayer ToFPlayer(this Player p)

public static RefreshTeamType ToRefreshTeamType(this SpawnableTeamType stp)
{
switch (stp)
return stp switch
{
case SpawnableTeamType.ChaosInsurgency:
return RefreshTeamType.CI;
case SpawnableTeamType.NineTailedFox:
return RefreshTeamType.MTF;
default:
return RefreshTeamType.Start;
}
SpawnableTeamType.ChaosInsurgency => RefreshTeamType.CI,
SpawnableTeamType.NineTailedFox => RefreshTeamType.MTF,
_ => RefreshTeamType.Start,
};
}
}
}

0 comments on commit b63aac3

Please sign in to comment.