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

Commit

Permalink
fix: add release date and download count.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Aug 19, 2023
1 parent fb1e7b2 commit c5a5f36
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 44 deletions.
14 changes: 10 additions & 4 deletions RotationSolver.Basic/Rotations/CustomRotation_Invoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ public bool TryInvoke(out IAction newAction, out IAction gcdAction)
UpdateInfo();
UpdateActions(ClassJob.GetJobRole());

CountingOfNonRecommendedMembersUsing = 0;
CountingOfLastUsing = CountingOfCombatTimeUsing = 0;
newAction = Invoke(out gcdAction);
if (InCombat || AverageCountOfNonRecommendedMembersUsing == 0)
if (InCombat || CountOfTracking == 0)
{
AverageCountOfNonRecommendedMembersUsing =
(AverageCountOfNonRecommendedMembersUsing * CountOfTracking + CountingOfNonRecommendedMembersUsing)
AverageCountOfLastUsing =
(AverageCountOfLastUsing * CountOfTracking + CountingOfLastUsing)
/ ++CountOfTracking;
MaxCountOfLastUsing = Math.Max(MaxCountOfLastUsing, CountingOfLastUsing);

AverageCountOfCombatTimeUsing =
(AverageCountOfCombatTimeUsing * (CountOfTracking -1)+ CountingOfCombatTimeUsing)
/ CountOfTracking;
MaxCountOfCombatTimeUsing = Math.Max(MaxCountOfCombatTimeUsing, CountingOfCombatTimeUsing);
}

if (!IsValid) IsValid = true;
Expand Down
64 changes: 35 additions & 29 deletions RotationSolver.Basic/Rotations/CustomRotation_OtherInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,37 +265,50 @@ public abstract partial class CustomRotation
/// <summary>
///
/// </summary>
public double AverageCountOfNonRecommendedMembersUsing { get; internal set; } = 0;
internal long CountOfTracking { get; set; } = 0;
public double AverageCountOfLastUsing { get; internal set; } = 0;

internal static float CountingOfNonRecommendedMembersUsing { get; set; } = 0;
/// <summary>
///
/// </summary>
public int MaxCountOfLastUsing { get; internal set; } = 0;

private const float COMBAT_TIME_WEIGHT = 0.5f;
/// <summary>
///
/// </summary>
public double AverageCountOfCombatTimeUsing { get; internal set; } = 0;

/// <summary>
///
/// </summary>
public int MaxCountOfCombatTimeUsing { get; internal set; } = 0;
internal long CountOfTracking { get; set; } = 0;

internal static int CountingOfLastUsing { get; set; } = 0;
internal static int CountingOfCombatTimeUsing { get; set; } = 0;

private const string USE_LESS_WARNING = "Please use this as less as possible. If you use it too much, your rotation will be marked as not general.";

/// <summary>
/// The actions that were used by player successfully. The first one is the latest successfully used one.
/// <br>WARNING: Do Not make this method the main of your rotation.</br>
/// </summary>
[Obsolete(USE_LESS_WARNING)]
protected static ActionRec[] RecordActions
{
get
{
CountingOfNonRecommendedMembersUsing++;
CountingOfLastUsing++;
return DataCenter.RecordActions;
}
}

/// <summary>
/// How much time has passed since the last action was released.
/// <br>WARNING: Do Not make this method the main of your rotation.</br>
/// </summary>
[Obsolete(USE_LESS_WARNING)]
protected static TimeSpan TimeSinceLastAction
{
get
{
CountingOfNonRecommendedMembersUsing++;
CountingOfLastUsing++;
return DataCenter.TimeSinceLastAction;
}
}
Expand All @@ -307,10 +320,9 @@ protected static TimeSpan TimeSinceLastAction
/// <param name="isAdjust">Check for adjust id not raw id.</param>
/// <param name="actions">True if any of this is matched.</param>
/// <returns></returns>
[Obsolete(USE_LESS_WARNING)]
public static bool IsLastGCD(bool isAdjust, params IAction[] actions)
{
CountingOfNonRecommendedMembersUsing++;
CountingOfLastUsing++;
return IActionHelper.IsLastGCD(isAdjust, actions);
}

Expand All @@ -320,10 +332,9 @@ public static bool IsLastGCD(bool isAdjust, params IAction[] actions)
/// </summary>
/// <param name="ids">True if any of this is matched.</param>
/// <returns></returns>
[Obsolete(USE_LESS_WARNING)]
public static bool IsLastGCD(params ActionID[] ids)
{
CountingOfNonRecommendedMembersUsing++;
CountingOfLastUsing++;
return IActionHelper.IsLastGCD(ids);
}

Expand All @@ -334,10 +345,9 @@ public static bool IsLastGCD(params ActionID[] ids)
/// <param name="isAdjust">Check for adjust id not raw id.</param>
/// <param name="actions">True if any of this is matched.</param>
/// <returns></returns>
[Obsolete(USE_LESS_WARNING)]
public static bool IsLastAbility(bool isAdjust, params IAction[] actions)
{
CountingOfNonRecommendedMembersUsing++;
CountingOfLastUsing++;
return IActionHelper.IsLastAbility(isAdjust, actions);
}

Expand All @@ -347,10 +357,9 @@ public static bool IsLastAbility(bool isAdjust, params IAction[] actions)
/// </summary>
/// <param name="ids">True if any of this is matched.</param>
/// <returns></returns>
[Obsolete(USE_LESS_WARNING)]
public static bool IsLastAbility(params ActionID[] ids)
{
CountingOfNonRecommendedMembersUsing++;
CountingOfLastUsing++;
return IActionHelper.IsLastAbility(ids);
}

Expand All @@ -361,10 +370,9 @@ public static bool IsLastAbility(params ActionID[] ids)
/// <param name="isAdjust">Check for adjust id not raw id.</param>
/// <param name="actions">True if any of this is matched.</param>
/// <returns></returns>
[Obsolete(USE_LESS_WARNING)]
public static bool IsLastAction(bool isAdjust, params IAction[] actions)
{
CountingOfNonRecommendedMembersUsing++;
CountingOfLastUsing++;
return IActionHelper.IsLastAction(isAdjust, actions);
}

Expand All @@ -374,10 +382,9 @@ public static bool IsLastAction(bool isAdjust, params IAction[] actions)
/// </summary>
/// <param name="ids">True if any of this is matched.</param>
/// <returns></returns>
[Obsolete(USE_LESS_WARNING)]
public static bool IsLastAction(params ActionID[] ids)
{
CountingOfNonRecommendedMembersUsing++;
CountingOfLastUsing++;
return IActionHelper.IsLastAction(ids);
}

Expand All @@ -386,10 +393,9 @@ public static bool IsLastAction(params ActionID[] ids)
/// </summary>
/// <param name="GCD"></param>
/// <returns></returns>
[Obsolete(USE_LESS_WARNING)]
protected static bool CombatElapsedLessGCD(int GCD)
{
CountingOfNonRecommendedMembersUsing += COMBAT_TIME_WEIGHT;
CountingOfCombatTimeUsing ++;
return CombatElapsedLess(GCD * DataCenter.WeaponTotal);
}

Expand All @@ -399,22 +405,21 @@ protected static bool CombatElapsedLessGCD(int GCD)
/// </summary>
/// <param name="time">time in second.</param>
/// <returns></returns>
[Obsolete(USE_LESS_WARNING)]
protected static bool CombatElapsedLess(float time)
{
CountingOfNonRecommendedMembersUsing += COMBAT_TIME_WEIGHT;
CountingOfCombatTimeUsing++;
return CombatTime <= time;
}

/// <summary>
/// The combat time.
/// <br>WARNING: Do Not make this method the main of your rotation.</br>
/// </summary>
[Obsolete(USE_LESS_WARNING)]
public static float CombatTime
{
get
{
CountingOfNonRecommendedMembersUsing += COMBAT_TIME_WEIGHT;
CountingOfCombatTimeUsing++;
return InCombat ? DataCenter.CombatTimeRaw + DataCenter.WeaponRemain : 0;
}
}
Expand All @@ -434,7 +439,8 @@ public static float CombatTime
protected static bool StopMovingElapsedLess(float time) => StopMovingTime <= time;

/// <summary>
/// The time of stoping moving.
/// The time of stopping moving.
/// <br>WARNING: Do Not make this method the main of your rotation.</br>
/// </summary>
public static float StopMovingTime => IsMoving ? 0 : DataCenter.StopMovingRaw + DataCenter.WeaponRemain;

Expand All @@ -449,7 +455,7 @@ protected static float GCDTime(uint gcdCount = 0, float offset = 0)

#region Service
/// <summary>
/// The countDond ahead.
/// The count down ahead.
/// </summary>
public static float CountDownAhead => Service.Config.GetValue(Configuration.PluginConfigFloat.CountDownAhead);

Expand Down
19 changes: 17 additions & 2 deletions RotationSolver.Basic/Rotations/ICustomRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,24 @@ namespace RotationSolver.Basic.Rotations;
public interface ICustomRotation : ITexture
{
/// <summary>
/// The count of not recommend members using.
/// The average count of not recommend members using.
/// </summary>
double AverageCountOfNonRecommendedMembersUsing { get; }
double AverageCountOfLastUsing { get; }

/// <summary>
/// The max count of not recommend members using.
/// </summary>
int MaxCountOfLastUsing { get; }

/// <summary>
/// The average count of not recommend members using.
/// </summary>
double AverageCountOfCombatTimeUsing { get; }

/// <summary>
/// The max count of not recommend members using.
/// </summary>
int MaxCountOfCombatTimeUsing { get; }

/// <summary>
/// Whether show the status in the formal page.
Expand Down
10 changes: 9 additions & 1 deletion RotationSolver/Helpers/UIHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ public static void ShowWarning(this string message, int times = 3, DalamudLinkPa
new TextPayload("Rotation Solver"),
UIForegroundPayload.UIForegroundOff,
RawPayload.LinkTerminator,
new TextPayload(": " + message))
new TextPayload(": " + message),

RotationSolverPlugin.HideWarningLinkPayload,
new TextPayload("(Hide Warning)"),
RawPayload.LinkTerminator)

: new SeString(
new IconPayload(BitmapFontIcon.DPS),
Expand All @@ -29,6 +33,10 @@ public static void ShowWarning(this string message, int times = 3, DalamudLinkPa
RawPayload.LinkTerminator,
link,
new TextPayload(": " + message),
RawPayload.LinkTerminator,

RotationSolverPlugin.HideWarningLinkPayload,
new TextPayload("(Hide Warning)"),
RawPayload.LinkTerminator);

Svc.Chat.PrintChat(new Dalamud.Game.Text.XivChatEntry()
Expand Down
9 changes: 8 additions & 1 deletion RotationSolver/RotationSolverPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public sealed class RotationSolverPlugin : IDalamudPlugin, IDisposable
public string Name => "Rotation Solver";

public static DalamudLinkPayload OpenLinkPayload { get; private set; }
public static DalamudLinkPayload HideWarningLinkPayload { get; private set; }
public RotationSolverPlugin(DalamudPluginInterface pluginInterface)
{
ECommonsMain.Init(pluginInterface, this, Module.DalamudReflector, Module.ObjectFunctions);
Expand Down Expand Up @@ -89,7 +90,13 @@ public RotationSolverPlugin(DalamudPluginInterface pluginInterface)
{
if (id == 0) OpenConfigWindow();
});

HideWarningLinkPayload = pluginInterface.AddChatLinkHandler(1, (id, str) =>
{
if (id == 1)
{
Service.Config.SetValue(PluginConfigBool.HideWarning, true);
}
});
Task.Run(async () =>
{
await DownloadHelper.DownloadAsync();
Expand Down
10 changes: 9 additions & 1 deletion RotationSolver/UI/ControlWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,14 @@ static void DrawCommandAction(IAction gcd, IAction ability, SpecialCommandType c

if(IconSet.GetTexture(gcd, out var texture))
{
var y = ImGui.GetCursorPosY();

DrawIAction(texture.ImGuiHandle, baseId + nameof(gcd), gcdW, command, help);
if (IconSet.GetTexture(ability, out texture))
{
ImGui.SameLine();

ImGui.SetCursorPosY(y);
DrawIAction(texture.ImGuiHandle, baseId + nameof(ability), abilityW, command, help);
}
}
Expand Down Expand Up @@ -412,13 +416,17 @@ static unsafe void DrawNextAction(float gcd, float ability, float width)

NextActionWindow.DrawGcdCooldown(width, true);

var y= ImGui.GetCursorPosY();

DrawIAction(ActionUpdater.NextGCDAction, gcd, 1);

var next = ActionUpdater.NextGCDAction != ActionUpdater.NextAction ? ActionUpdater.NextAction : null;

ImGui.SameLine();

DrawIAction(next, ability, -1);
ImGui.SetCursorPosY(y);

DrawIAction(next, ability, 1);
ImGui.EndGroup();
}
}
Loading

0 comments on commit c5a5f36

Please sign in to comment.