Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Casters with purple icon for better visibility #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions PartyIcons/Entities/GenericRole.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using static FFXIVClientStructs.FFXIV.Component.Excel.IExcelRowWrapper.Delegates;

namespace PartyIcons.Entities;

public enum GenericRole : uint
Expand All @@ -7,10 +9,6 @@ public enum GenericRole : uint
Ranged = 2,
Healer = 3,
Crafter = 4,
Gatherer = 5
}

public static class JobRoleExtensions
{
public static GenericRole RoleFromByte(byte roleId) => (GenericRole) (roleId - 1);
Gatherer = 5,
Caster = 6,
}
3 changes: 2 additions & 1 deletion PartyIcons/Entities/Job.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,15 @@ public static GenericRole GetRole(this Job job)
case Job.BRD:
case Job.MCH:
case Job.DNC:
return GenericRole.Ranged;
case Job.THM:
case Job.BLM:
case Job.ACN:
case Job.SMN:
case Job.RDM:
case Job.BLU:
case Job.PCT:
return GenericRole.Ranged;
return GenericRole.Caster;

case Job.CRP:
case Job.BSM:
Expand Down
8 changes: 5 additions & 3 deletions PartyIcons/Runtime/RoleTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ public void CalculateUnassignedPartyRoles()
if (kv.Key.Equals(playerDescription))
{
var applicableRoles =
GetApplicableRolesForGenericRole(
JobRoleExtensions.RoleFromByte(member.ClassJob.GameData.Role));
GetApplicableRolesForGenericRole(((Job)member.ClassJob.Id).GetRole());

if (applicableRoles.Contains(kv.Value))
{
Expand Down Expand Up @@ -199,7 +198,7 @@ public void CalculateUnassignedPartyRoles()
}

var roleToAssign =
FindUnassignedRoleForGenericRole(JobRoleExtensions.RoleFromByte(member.ClassJob.GameData.Role));
FindUnassignedRoleForGenericRole(((Job)member.ClassJob.Id).GetRole());

if (roleToAssign != default)
{
Expand Down Expand Up @@ -285,6 +284,9 @@ private IEnumerable<RoleId> GetApplicableRolesForGenericRole(GenericRole role)
case GenericRole.Ranged:
return new[] { RoleId.R1, RoleId.R2, RoleId.M1, RoleId.M2 };

case GenericRole.Caster:
return new[] { RoleId.R1, RoleId.R2, RoleId.M1, RoleId.M2 };

case GenericRole.Healer:
return new[] { RoleId.H1, RoleId.H2 };

Expand Down
7 changes: 6 additions & 1 deletion PartyIcons/Stylesheet/PlayerStylesheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ private static ushort GetGenericRoleColor(GenericRole role)
GenericRole.Tank => 37,
GenericRole.Melee => 524,
GenericRole.Ranged => 32,
GenericRole.Caster => 49,
GenericRole.Healer => 42,
_ => FallbackColor
};
Expand All @@ -39,7 +40,8 @@ public static ushort GetRoleColor(RoleId roleId)
{
RoleId.MT or RoleId.OT => GetGenericRoleColor(GenericRole.Tank),
RoleId.M1 or RoleId.M2 => GetGenericRoleColor(GenericRole.Melee),
RoleId.R1 or RoleId.R2 => GetGenericRoleColor(GenericRole.Ranged),
RoleId.R1 => GetGenericRoleColor(GenericRole.Ranged),
RoleId.R2 => GetGenericRoleColor(GenericRole.Caster),
RoleId.H1 or RoleId.H2 => GetGenericRoleColor(GenericRole.Healer),
_ => FallbackColor
};
Expand All @@ -57,6 +59,7 @@ public static IconGroupId GetGenericRoleIconGroupId(IconSetId iconSetId, Generic
GenericRole.Tank => IconGroupId.GradientBlue,
GenericRole.Melee => IconGroupId.GradientRed,
GenericRole.Ranged => IconGroupId.GradientOrange,
GenericRole.Caster => IconGroupId.GradientPurple,
GenericRole.Healer => IconGroupId.GradientGreen,
_ => IconGroupId.GradientGrey
},
Expand Down Expand Up @@ -88,6 +91,7 @@ public SeString GetGenericRolePlate(GenericRole genericRole, bool colored = true
GenericRole.Tank => SeStringUtils.Text(BoxedCharacterString("T"), GetGenericRoleColor(genericRole)),
GenericRole.Melee => SeStringUtils.Text(BoxedCharacterString(_configuration.EasternNamingConvention ? "D" : "M"), GetGenericRoleColor(genericRole)),
GenericRole.Ranged => SeStringUtils.Text(BoxedCharacterString(_configuration.EasternNamingConvention ? "D" : "R"), GetGenericRoleColor(genericRole)),
GenericRole.Caster => SeStringUtils.Text(BoxedCharacterString(_configuration.EasternNamingConvention ? "D" : "R"), GetGenericRoleColor(genericRole)),
GenericRole.Healer => SeStringUtils.Text(BoxedCharacterString("H"), GetGenericRoleColor(genericRole)),
GenericRole.Crafter => SeStringUtils.Text(BoxedCharacterString("C"), GetGenericRoleColor(genericRole)),
GenericRole.Gatherer => SeStringUtils.Text(BoxedCharacterString("G"), GetGenericRoleColor(genericRole)),
Expand All @@ -98,6 +102,7 @@ public SeString GetGenericRolePlate(GenericRole genericRole, bool colored = true
GenericRole.Tank => SeStringUtils.Text(BoxedCharacterString("T")),
GenericRole.Melee => SeStringUtils.Text(BoxedCharacterString(_configuration.EasternNamingConvention ? "D" : "M")),
GenericRole.Ranged => SeStringUtils.Text(BoxedCharacterString(_configuration.EasternNamingConvention ? "D" : "R")),
GenericRole.Caster => SeStringUtils.Text(BoxedCharacterString(_configuration.EasternNamingConvention ? "D" : "R")),
GenericRole.Healer => SeStringUtils.Text(BoxedCharacterString("H")),
GenericRole.Crafter => SeStringUtils.Text(BoxedCharacterString("C")),
GenericRole.Gatherer => SeStringUtils.Text(BoxedCharacterString("G")),
Expand Down