Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: changed the access of some properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 16, 2023
1 parent 2ff4381 commit 94fcbdd
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>net7.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Authors>ArchiTed</Authors>
<Version>2.2.9</Version>
<Version>2.2.12</Version>
<PlatformTarget>x64</PlatformTarget>
<Platforms>AnyCPU</Platforms>

Expand Down
10 changes: 5 additions & 5 deletions RotationSolver.Basic/Actions/BaseAction_ActionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ public partial class BaseAction
{
public float Range => ActionManager.GetActionRange(ID);

internal ActionID[] ComboIdsNot { private get; set; } = null;
internal ActionID[] ComboIdsNot { private get; init; } = null;

internal ActionID[] ComboIds { private get; set; } = null;
internal ActionID[] ComboIds { private get; init; } = null;

public StatusID[] StatusProvide { get; internal set; } = null;
public StatusID[] StatusProvide { get; init; } = null;

public virtual StatusID[] StatusNeed { get; internal set; } = null;
public virtual StatusID[] StatusNeed { get; init; } = null;

public Func<BattleChara, bool> ActionCheck { get; internal set; } = null;
public Func<BattleChara, bool> ActionCheck { get; init; } = null;

private bool WillCooldown
{
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public partial class BaseAction : IBaseAction
public bool IsGeneralGCD => _option.HasFlag(ActionOption.GeneralGCD);
public bool IsRealGCD => _option.HasFlag(ActionOption.RealGCD);

internal Func<uint> GetDotGcdCount { private get; set; }
public Func<uint> GetDotGcdCount { private get; init; }

/// <summary>
/// EnoughLevel for using.
Expand Down
10 changes: 5 additions & 5 deletions RotationSolver.Basic/Actions/BaseAction_Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace RotationSolver.Basic.Actions;

public partial class BaseAction
{
public byte AOECount { private get; set; } = 3;
public byte AOECount { private get; init; } = 3;

public bool IsTargetDying => Target?.IsDying() ?? false;

Expand All @@ -24,19 +24,19 @@ public partial class BaseAction

private Func<IEnumerable<BattleChara>, bool, BattleChara> _choiceTarget = null;

internal Func<IEnumerable<BattleChara>, bool, BattleChara> ChoiceTarget
public Func<IEnumerable<BattleChara>, bool, BattleChara> ChoiceTarget
{
private get
{
if (_choiceTarget != null) return _choiceTarget;
return IsFriendly ? TargetFilter.DefaultChooseFriend : TargetFilter.DefaultFindHostile;
}
set => _choiceTarget = value;
init => _choiceTarget = value;
}

internal Func<IEnumerable<BattleChara>, IEnumerable<BattleChara>> FilterForHostiles { private get; set; } = null;
public Func<IEnumerable<BattleChara>, IEnumerable<BattleChara>> FilterForHostiles { private get; init; } = null;

public StatusID[] TargetStatus { get; internal set; } = null;
public StatusID[] TargetStatus { get; init; } = null;

internal static bool TankDefenseSelf(BattleChara chara)
{
Expand Down
5 changes: 0 additions & 5 deletions RotationSolver.Basic/Actions/IBaseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,6 @@ public interface IBaseAction : IAction
/// </summary>
bool IsTargetDying { get; }

/// <summary>
/// If this is an aoe action, how many hostile target would want to attack on, when you use this action.
/// </summary>
byte AOECount { set; }

/// <summary>
/// Is this action's target type is target only one.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions RotationSolver.Basic/Helpers/IActionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ internal static bool IsLastAction(params ActionID[] ids)

public static bool IsTheSameTo(this IAction action, bool isAdjust, params IAction[] actions)
{
if (action == null) return false;
return IsActionID(isAdjust ? (ActionID)action.AdjustedID : (ActionID)action.ID, GetIDFromActions(isAdjust, actions));
}

Expand Down
14 changes: 14 additions & 0 deletions RotationSolver.Basic/Rotations/CustomRotation_BasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,20 @@ private protected CustomRotation()
{
IconID = IconSet.GetJobIcon(this);
Configs = CreateConfiguration();

try
{
for (byte i = 0; i < 3; i++)
{
Ability(i, GCD(i, true, true), out _, true, true);
}
IsValid = true;
}
catch (Exception ex)
{
PluginLog.Warning(ex, $"The rotation \"{GetType().FullName}\" is not valid, please tell to the author");
IsValid = false;
}
}

protected virtual IRotationConfigSet CreateConfiguration()
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_Invoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public bool TryInvoke(out IAction newAction, out IAction gcdAction)
}
catch(Exception ex)
{
if(_lastException != ex)
if(_lastException?.GetType() != ex.GetType())
{
PluginLog.Error(ex, "Failed to invoke the next action");
}
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ internal partial class Strings
public string ConfigWindow_Control_NeedToEnable { get; set; } = " (Need to enable)";
public string ConfigWindow_Control_ClickToUse { get; set; } = "Click to use it!";
public string ConfigWindow_Rotation_BetaRotation { get; set; } = "Beta Rotation!";
public string ConfigWindow_Rotation_InvalidRotation { get; set; } = "Invalid Rotation! Please contact to the author!";
public string ConfigWindow_Rotation_InvalidRotation { get; set; } = "Invalid Rotation! \nPlease update to the latest version or contact to the {0}!";
public string ConfigWindow_Rotation_ResetToDefault { get; set; } = "Click to reset the rotation configuration to default!";
#endregion

Expand Down
7 changes: 4 additions & 3 deletions RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation
ImGui.Text(e.Message);
e = e.InnerException;
}
ImGui.TextWrapped(ex.StackTrace);
ImGui.Text(ex.StackTrace);
}
}, "Popup" + rotation.GetHashCode().ToString());
},
Expand Down Expand Up @@ -459,9 +459,10 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation
ImGui.Text(rotation.GetType().Assembly.GetName().Name);
if(!rotation.IsValid)
{
HoveredString(LocalizationManager.RightLang.ConfigWindow_Rotation_InvalidRotation);
HoveredString(string.Format(LocalizationManager.RightLang.ConfigWindow_Rotation_InvalidRotation,
rotation.GetType().Assembly.GetInfo().Author));
}
if (!rotation.IsAllowed(out _))
else if (!rotation.IsAllowed(out _))
{
var showStr = string.Format(LocalizationManager.RightLang.ConfigWindow_Helper_HighEndWarning, rotation)
+ string.Join("", SocialUpdater.HighEndDuties.Select(x => x.PlaceName?.Value?.Name.ToString())
Expand Down
7 changes: 6 additions & 1 deletion RotationSolver/Updaters/RotationUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ private static void LoadRotationsFromLocal(string relayFolder)
var directories = Service.Config.OtherLibs
.Where(Directory.Exists)
//.Append(Path.GetDirectoryName(Assembly.GetAssembly(typeof(ICustomRotation)).Location))
.Append(relayFolder);
#if DEBUG
//.Append(relayFolder)
#else
.Append(relayFolder)
#endif
;

var assemblies = from dir in directories
where Directory.Exists(dir)
Expand Down

0 comments on commit 94fcbdd

Please sign in to comment.