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 rotation choic
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Mar 20, 2023
1 parent 54789c9 commit eeded1c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
9 changes: 7 additions & 2 deletions RotationSolver/RotationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal static class RotationHelper
};

public static bool IsDefault(this ICustomRotation rotation)
=> DefaultAssembly == rotation.GetType().Assembly.GetName().Name;
=> DefaultAssembly == GetId(rotation);

public static bool IsAllowed(this ICustomRotation rotation, out string name)
{
Expand All @@ -26,7 +26,12 @@ public static bool IsAllowed(this ICustomRotation rotation, out string name)
return false;
}
name = rotation.GetType().Assembly.GetName().Name;
return _allowedAssembly.Contains(name);
return _allowedAssembly.Contains(GetId(rotation));
}

internal static string GetId(this ICustomRotation rotation)
{
return Convert.ToBase64String(rotation.GetType().Assembly.GetName().GetPublicKeyToken());
}

public static Vector4 GetColor(this ICustomRotation rotation)
Expand Down
15 changes: 12 additions & 3 deletions RotationSolver/UI/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using RotationSolver.Basic;
using RotationSolver.Basic.Data;
using RotationSolver.Basic.Helpers;
using RotationSolver.Commands;
using RotationSolver.UI;
using RotationSolver.Updaters;
using System.Numerics;

Expand All @@ -25,6 +23,17 @@ private void DrawDebugTab()

if (ImGui.BeginTabBar("Debug Items"))
{

#if DEBUG
if(RotationUpdater.Plugins != null)
{
foreach (var p in RotationUpdater.Plugins)
{
var s = p;
ImGui.InputText($"##{p}", ref s, 512);
}
}
#endif
DrawParamTabItem("Status", DrawStatus);
DrawParamTabItem("Party", DrawParty);
DrawParamTabItem("Target Data", DrawTargetData);
Expand Down Expand Up @@ -52,7 +61,7 @@ private unsafe void DrawStatus()

foreach (var status in Service.Player.StatusList)
{
var source = Service.ObjectTable.SearchById(status.SourceId)?.Name ?? "None";
var source = status.SourceId == Service.Player.ObjectId ? "You" : Service.ObjectTable.SearchById(status.SourceId) == null ? "None" : "Others";
ImGui.Text($"{status.GameData.Name}: {status.StatusId} From: {source}");
}
}
Expand Down
22 changes: 11 additions & 11 deletions RotationSolver/Updaters/RotationUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public record CustomRotationGroup(ClassJobID jobId, ClassJobID[] classJobIds, IC

static readonly string[] _locs = new string[] { "RotationSolver.dll", "RotationSolver.Basic.dll" };

#if DEBUG
internal static string[] Plugins;
#endif
public static void GetAllCustomRotations()
{
var directories = Service.Config.OtherLibs
Expand All @@ -32,10 +35,7 @@ from l in Directory.GetFiles(dir, "*.dll")
where !_locs.Any(l.Contains)
select RotationLoadContext.LoadFrom(l);
#if DEBUG
foreach (var ass in assemblies)
{
Service.ChatGui.Print(ass.FullName);
}
Plugins = assemblies.Select(a => a.GetName().Name + " : " + Convert.ToBase64String(a.GetName().GetPublicKeyToken())).ToArray();
#endif
AuthorHashes = (from a in assemblies
select a.GetCustomAttribute<AuthorHashAttribute>() into author
Expand Down Expand Up @@ -123,23 +123,23 @@ public static IEnumerable<IGrouping<string, IAction>> AllGroupedActions

public static IBaseAction[] RightRotationBaseActions { get; private set; } = new IBaseAction[0];

static ClassJobID _job;
static string _rotationName;
//static ClassJobID _job;
//static string _rotationName;
public static void UpdateRotation()
{
var nowJob = (ClassJobID)Service.Player.ClassJob.Id;
Service.Config.RotationChoices.TryGetValue((uint)nowJob, out var newName);

if (_job == nowJob && _rotationName == newName) return;
//if (_job == nowJob && _rotationName == newName) return;

_job = nowJob;
_rotationName = newName;
//_job = nowJob;
//_rotationName = newName;

foreach (var group in _customRotations)
{
if (!group.classJobIds.Contains(_job)) continue;
if (!group.classJobIds.Contains(nowJob)) continue;

RightNowRotation = GetChooseRotation(group, _rotationName);
RightNowRotation = GetChooseRotation(group, newName);
RightRotationBaseActions = RightNowRotation.AllBaseActions;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Updaters/SocialUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ internal static string EncryptString(PlayerCharacter player)
+ " - " + player.Name.ToString() + "U6Wy.zCG");

var tmpHash = MD5.Create().ComputeHash(inputByteArray);
var retB = Convert.ToBase64String(tmpHash.ToArray());
var retB = Convert.ToBase64String(tmpHash);
return retB;
}
}

0 comments on commit eeded1c

Please sign in to comment.