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

Commit

Permalink
fix: add youtube link.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Aug 16, 2023
1 parent fed66eb commit 6b38e27
Show file tree
Hide file tree
Showing 18 changed files with 81 additions and 236 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>3.2.3</Version>
<Version>3.2.3.1</Version>
<PlatformTarget>x64</PlatformTarget>
<Platforms>AnyCPU</Platforms>

Expand Down
21 changes: 0 additions & 21 deletions RotationSolver.Basic/Attributes/AssemblyLinkAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,4 @@ public class AssemblyLinkAttribute : Attribute
/// A link for the repo in your GitHub.
/// </summary>
public string Repository { get; set; }
/// <summary>
/// Constructer.
/// </summary>
/// <param name="supportLink"></param>
/// <param name="helpLink"></param>
/// <param name="changeLog"></param>
/// <param name="donate"><see cref="Donate"/></param>
[Obsolete("Never use it anymore, it'll be deleted in a month!", true)]
public AssemblyLinkAttribute(string supportLink = null, string helpLink = null,
string changeLog = null, string donate = null)
{
Donate = donate;
}

/// <summary>
///
/// </summary>
public AssemblyLinkAttribute()
{

}
}
18 changes: 0 additions & 18 deletions RotationSolver.Basic/Attributes/AuthorHashAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,4 @@ public class AuthorHashAttribute : Attribute
/// The hash of your character.
/// </summary>
public string Hash { get; set; }

/// <summary>
/// Constructer
/// </summary>
/// <param name="hash"><see cref="Hash"/></param>
[Obsolete("This method will be deleted in one month.", true)]
public AuthorHashAttribute(string hash)
{
Hash = hash;
}

/// <summary>
///
/// </summary>
public AuthorHashAttribute()
{

}
}
18 changes: 0 additions & 18 deletions RotationSolver.Basic/Attributes/SourceCodeAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,4 @@ public class SourceCodeAttribute : Attribute
/// The link to the source code.
/// </summary>
public string Path { get; set; }

/// <summary>
/// Constructer.
/// </summary>
/// <param name="path"></param>
[Obsolete("This method will be deleted in several months.", true)]
public SourceCodeAttribute(string path)
{
Path = path;
}

/// <summary>
///
/// </summary>
public SourceCodeAttribute()
{

}
}
13 changes: 13 additions & 0 deletions RotationSolver.Basic/Attributes/YoutubeLinkAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace RotationSolver.Basic.Attributes;

/// <summary>
/// To show your youtube video link
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class YoutubeLinkAttribute : Attribute
{
/// <summary>
/// The youtube link Id
/// </summary>
public string ID { get; set; }
}
5 changes: 0 additions & 5 deletions RotationSolver.Basic/Helpers/ReflectionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ where typeof(T).IsAssignableFrom(prop.PropertyType)
return props.Union(type.BaseType.GetStaticProperties<T>()).ToArray();
}

internal static MethodInfo[] GetStaticBoolMethodInfo(this Type type, Func<MethodInfo, bool> checks)
{
return type.GetAllMethodInfo().Where(m => checks(m) && m.ReturnType == typeof(bool) && m.IsStatic).ToArray();
}

internal static IEnumerable<MethodInfo> GetAllMethodInfo(this Type type)
{
if (type == null) return Array.Empty<MethodInfo>();
Expand Down
14 changes: 2 additions & 12 deletions RotationSolver.Basic/Rotations/CustomRotation_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,19 +288,9 @@ internal RoleAction(ActionID actionID, JobRole[] roles, ActionOption option = Ac
PropertyInfo[] _allBytes;
public PropertyInfo[] AllBytes => _allBytes ??= GetType().GetStaticProperties<byte>();

MethodInfo[] _allTimes;
public MethodInfo[] AllTimes => _allTimes ??= GetType().GetStaticBoolMethodInfo(m =>
{
var types = m.GetParameters();
return types.Length == 1 && types[0].ParameterType == typeof(float);
});
PropertyInfo[] _allFloats;
public PropertyInfo[] AllFloats => _allFloats ??= GetType().GetStaticProperties<float>();

MethodInfo[] _allGCDs;
public MethodInfo[] AllGCDs => _allGCDs ??= GetType().GetStaticBoolMethodInfo(m =>
{
var types = m.GetParameters();
return types.Length == 2 && types[0].ParameterType == typeof(uint) && types[1].ParameterType == typeof(uint);
});
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member

private IEnumerable<IBaseAction> GetBaseActions(Type type)
Expand Down
11 changes: 0 additions & 11 deletions RotationSolver.Basic/Rotations/CustomRotation_OtherInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -383,17 +383,6 @@ public static bool IsLastAction(params ActionID[] ids)
protected static float GCDTime(uint gcdCount = 0, float offset = 0)
=> DataCenter.GCDTime(gcdCount, offset);

/// <summary>
/// All last actions.
/// </summary>
public MethodInfo[] AllLast => GetType().GetStaticBoolMethodInfo(m =>
{
var types = m.GetParameters();
return types.Length == 2
&& types[0].ParameterType == typeof(bool)
&& types[1].ParameterType == typeof(IAction[]);
});

#region Service
/// <summary>
/// The countDond ahead.
Expand Down
11 changes: 1 addition & 10 deletions RotationSolver.Basic/Rotations/ICustomRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,8 @@ public interface ICustomRotation : ITexture
/// <summary>
/// All time methods.
/// </summary>
MethodInfo[] AllTimes { get; }
PropertyInfo[] AllFloats { get; }

/// <summary>
/// All last actions.
/// </summary>
MethodInfo[] AllLast { get; }

/// <summary>
/// All gcds.
/// </summary>
MethodInfo[] AllGCDs { get; }

internal IAction ActionHealAreaGCD { get; }
internal IAction ActionHealAreaAbility { get; }
Expand Down
3 changes: 1 addition & 2 deletions RotationSolver/ActionSequencer/ActionCondition.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Dalamud.Interface.Colors;
using RotationSolver.Localization;
using RotationSolver.Localization;
using RotationSolver.UI;

namespace RotationSolver.ActionSequencer;
Expand Down
132 changes: 49 additions & 83 deletions RotationSolver/ActionSequencer/RotationCondition.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Dalamud.Interface.Colors;
using ECommons.GameHelpers;
using ECommons.GameHelpers;
using RotationSolver.Localization;
using RotationSolver.UI;

Expand All @@ -22,7 +21,7 @@ internal class RotationCondition : ICondition

public int Param1;
public int Param2;
public float Time;
public float Param3;

private void UpdateInfo(ICustomRotation rotation)
{
Expand Down Expand Up @@ -62,34 +61,21 @@ public bool IsTrue(ICustomRotation rotation)
}
return false;

case ComboConditionType.Time:
try
{
if (_method?.Invoke(rotation, new object[] { Time }) is bool bo)
{
return Condition > 0 ? bo : !bo;
}
return false;
}
catch
{
return false;
}


case ComboConditionType.TimeGCD:
try
case ComboConditionType.Float:
if (_prop == null) return false;
if (_prop.GetValue(rotation) is float fl)
{
if (_method?.Invoke(rotation, new object[] { (uint)Param1, (uint)Param2 }) is bool boo)
switch (Condition)
{
return Condition > 0 ? boo : !boo;
case 0:
return fl > Param3;
case 1:
return fl < Param3;
case 2:
return fl == Param3;
}
return false;
}
catch
{
return false;
}
return false;

case ComboConditionType.Last:
try
Expand Down Expand Up @@ -157,74 +143,55 @@ public void Draw(ICustomRotation rotation)
ImGui.DragInt($"##Value{GetHashCode()}", ref Param1);

break;
case ComboConditionType.Time:
case ComboConditionType.Float:
ImGui.SameLine();
ImGuiHelper.SearchItemsReflection($"##Time{GetHashCode()}", _method?.GetMemberName(), ref searchTxt, rotation.AllTimes, i =>
ImGuiHelper.SearchItemsReflection($"##FloatChoice{GetHashCode()}", _prop?.GetMemberName(), ref searchTxt, rotation.AllFloats, i =>
{
_method = i;
MethodName = i.Name;
_prop = i;
PropertyName = i.Name;
});

ImGui.SameLine();
ImGui.SetNextItemWidth(50);
ImGui.Combo($"##Comparation{GetHashCode()}", ref Condition, new string[] { ">", "<=" }, 2);

ImGui.SameLine();
ImGui.SetNextItemWidth(50);
ImGui.DragFloat($"s##s{GetHashCode()}", ref Time);
break;

case ComboConditionType.TimeGCD:
ImGui.SameLine();
ImGuiHelper.SearchItemsReflection($"##Time{GetHashCode()}", _method?.GetMemberName(), ref searchTxt, rotation.AllGCDs, i =>
{
_method = i;
MethodName = i.Name;
});
ImGui.Combo($"##Comparation{GetHashCode()}", ref Condition, new string[] { ">", "<", "=" }, 3);

ImGui.SameLine();
ImGui.SetNextItemWidth(50);
ImGui.Combo($"##Comparation{GetHashCode()}", ref Condition, new string[] { ">", "<=" }, 2);

ImGui.SameLine();
ImGui.SetNextItemWidth(50);
ImGui.DragInt($"GCD##GCD{GetHashCode()}", ref Param1);
ImGui.DragFloat($"##Value{GetHashCode()}", ref Param3);

ImGui.SameLine();
ImGui.SetNextItemWidth(50);
var ability = Param2;
ImGui.DragInt($"Ability##Ability{GetHashCode()}", ref Param2);
break;

case ComboConditionType.Last:
ImGui.SameLine();
ImGuiHelper.SearchItemsReflection($"##Time{GetHashCode()}", _method?.GetMemberName(), ref searchTxt, rotation.AllLast, i =>
{
_method = i;
MethodName = i.Name;
});

ImGui.SameLine();
ImGui.SetNextItemWidth(80);
ImGui.Combo($"##IsNot{GetHashCode()}", ref Condition, new string[]
{
LocalizationManager.RightLang.ActionSequencer_Is,
LocalizationManager.RightLang.ActionSequencer_Isnot,
}, 2);

ImGui.SameLine();
var name = _action?.Name ?? string.Empty;
ImGuiHelper.SearchCombo($"##ActionChoice{GetHashCode()}", name, ref searchTxt, rotation.AllBaseActions, i =>
{
_action = (BaseAction)i;
ID = (ActionID)_action.ID;
});

ImGui.SameLine();
ImGui.SetNextItemWidth(50);
ImGui.Combo($"##Adjust{GetHashCode()}", ref Param1, new string[] { "Original", "Adjusted" }, 2);

break;
//case ComboConditionType.Last:
// ImGui.SameLine();
// ImGuiHelper.SearchItemsReflection($"##Time{GetHashCode()}", _method?.GetMemberName(), ref searchTxt, rotation.AllLast, i =>
// {
// _method = i;
// MethodName = i.Name;
// });

// ImGui.SameLine();
// ImGui.SetNextItemWidth(80);
// ImGui.Combo($"##IsNot{GetHashCode()}", ref Condition, new string[]
// {
// LocalizationManager.RightLang.ActionSequencer_Is,
// LocalizationManager.RightLang.ActionSequencer_Isnot,
// }, 2);

// ImGui.SameLine();
// var name = _action?.Name ?? string.Empty;
// ImGuiHelper.SearchCombo($"##ActionChoice{GetHashCode()}", name, ref searchTxt, rotation.AllBaseActions, i =>
// {
// _action = (BaseAction)i;
// ID = (ActionID)_action.ID;
// });

// ImGui.SameLine();
// ImGui.SetNextItemWidth(50);
// ImGui.Combo($"##Adjust{GetHashCode()}", ref Param1, new string[] { "Original", "Adjusted" }, 2);

// break;
}
}
}
Expand All @@ -233,7 +200,6 @@ public enum ComboConditionType : byte
{
Bool,
Byte,
Time,
TimeGCD,
Float,
Last,
}
1 change: 0 additions & 1 deletion RotationSolver/Helpers/RotationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public static AssemblyInfo GetInfo(this Assembly assembly)
var name = assembly.GetName().Name;
var location = assembly.Location;
var company = assembly.GetCustomAttribute<AssemblyCompanyAttribute>()?.Company;

var assemblyInfo = new AssemblyInfo(name, company, location, string.Empty, company, name, DateTime.Now);

_assemblyInfos[assembly] = assemblyInfo;
Expand Down
3 changes: 1 addition & 2 deletions RotationSolver/Localization/EnumTranslations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ internal static class EnumTranslations
{
ComboConditionType.Bool => LocalizationManager.RightLang.ComboConditionType_Bool,
ComboConditionType.Byte => LocalizationManager.RightLang.ComboConditionType_Byte,
ComboConditionType.Time => LocalizationManager.RightLang.ComboConditionType_Time,
ComboConditionType.TimeGCD => LocalizationManager.RightLang.ComboConditionType_GCD,
ComboConditionType.Float => LocalizationManager.RightLang.ComboConditionType_Float,
ComboConditionType.Last => LocalizationManager.RightLang.ComboConditionType_Last,
_ => string.Empty,
};
Expand Down
3 changes: 1 addition & 2 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,7 @@ internal partial class Strings
#region ComboConditionType
public string ComboConditionType_Bool { get; set; } = "Boolean";
public string ComboConditionType_Byte { get; set; } = "Byte";
public string ComboConditionType_Time { get; set; } = "Time";
public string ComboConditionType_GCD { get; set; } = "GCD";
public string ComboConditionType_Float { get; set; } = "Float";
public string ComboConditionType_Last { get; set; } = "Last";
#endregion

Expand Down
Loading

0 comments on commit 6b38e27

Please sign in to comment.