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

Commit

Permalink
fix: show jobs instead of roles.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Aug 18, 2023
1 parent 386355a commit df08550
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
32 changes: 31 additions & 1 deletion RotationSolver.Basic/Data/JobRole.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Lumina.Excel.GeneratedSheets;
using ECommons.ExcelServices;
using Lumina.Excel.GeneratedSheets;

namespace RotationSolver.Basic.Data;

Expand Down Expand Up @@ -80,4 +81,33 @@ public static JobRole GetJobRole(this ClassJob job)
}
return role;
}

/// <summary>
/// Get Jobs from role.
/// </summary>
/// <param name="role"></param>
/// <returns></returns>
public static Job[] ToJobs(this JobRole role)
{
switch (role)
{
case JobRole.Tank:
return new Job[] { Job.WAR, Job.PLD, Job.DRK, Job.GNB };
case JobRole.Healer:
return new Job[] {Job.WHM, Job.SCH, Job.AST, Job.SGE };
case JobRole.Melee:
return new Job[] {Job.MNK, Job.DRG, Job.NIN, Job.SAM, Job.RPR };
case JobRole.RangedPhysical:
return new Job[] { Job.BRD, Job.MCH, Job.DNC };
case JobRole.RangedMagical:
return new Job[] { Job.BLM, Job.SMN, Job.RDM, Job.BLU };

case JobRole.Ranged:
var result = new List<Job>(JobRole.RangedPhysical.ToJobs());
result.AddRange(JobRole.RangedMagical.ToJobs());
return result.ToArray();
}

return Array.Empty<Job>();
}
}
9 changes: 4 additions & 5 deletions RotationSolver/UI/SearchableConfigs/Searchable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,10 @@ public unsafe void Draw(Job job)

ImGui.PopStyleColor();

var roleOrJob = string.Join("\n", JobRoles ?? Array.Empty<JobRole>());
var jobs = string.Join("\n", (Jobs ?? Array.Empty<Job>())
.Select(job => Svc.Data.GetExcelSheet<ClassJob>()?.GetRow((uint)job)?.Name ?? job.ToString()));
if (string.IsNullOrEmpty(roleOrJob)) roleOrJob = jobs;
else if (!string.IsNullOrEmpty(jobs)) roleOrJob +='\n' + jobs;
var jobs = JobRoles.SelectMany(JobRoleExtension.ToJobs).Union(Jobs ?? Array.Empty<Job>());
var roleOrJob = string.Join("\n",
jobs.Select(job => Svc.Data.GetExcelSheet<ClassJob>()?.GetRow((uint)job)?.Name ?? job.ToString()));

ImguiTooltips.HoveredTooltip(string.Format(LocalizationManager.RightLang.ConfigWindow_NotInJob, roleOrJob));
return;
}
Expand Down

0 comments on commit df08550

Please sign in to comment.