diff --git a/MiraAPI/Roles/RoleId.cs b/MiraAPI/Roles/RoleId.cs
index 189682b3..96d2db80 100644
--- a/MiraAPI/Roles/RoleId.cs
+++ b/MiraAPI/Roles/RoleId.cs
@@ -1,4 +1,5 @@
-using System;
+using AmongUs.GameOptions;
+using System;
namespace MiraAPI.Roles;
@@ -38,4 +39,59 @@ public static class RoleId
return roleId;
}
+
+ ///
+ /// Gets the ID of a role.
+ ///
+ /// The role.
+ /// The ID as a ushort.
+ /// Thrown when the role is not registered.
+ public static ushort Get(ICustomRole role)
+ {
+ return Get(role.GetType());
+ }
+
+ ///
+ /// Gets the ID of an .
+ ///
+ /// The type of the role.
+ /// The role ID as a .
+ /// Thrown when the role is not registered.
+ public static RoleTypes GetType() where T : ICustomRole
+ {
+ return (RoleTypes)Get();
+ }
+
+ ///
+ /// Gets the ID of a role.
+ ///
+ /// The type of the role.
+ /// The ID as a .
+ /// Thrown when the role is not registered.
+ public static RoleTypes GetType(Type type)
+ {
+ return (RoleTypes)Get(type);
+ }
+
+ ///
+ /// Gets the role.
+ ///
+ /// The type of the role.
+ /// The object.
+ /// Thrown when the role is not registered.
+ public static RoleBehaviour GetRole() where T : ICustomRole
+ {
+ return RoleManager.Instance.GetRole(GetType());
+ }
+
+ ///
+ /// Gets the role from its type.
+ ///
+ /// The type of the role.
+ /// The object.
+ /// Thrown when the role is not registered.
+ public static RoleBehaviour GetRole(Type type)
+ {
+ return RoleManager.Instance.GetRole(GetType(type));
+ }
}
diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs
index 6c8b74b5..9c1cb5fc 100644
--- a/MiraAPI/Utilities/Extensions.cs
+++ b/MiraAPI/Utilities/Extensions.cs
@@ -43,7 +43,7 @@ public static class Extensions
}
return new NetData(
- RoleId.Get(role.GetType()),
+ RoleId.Get(role),
BitConverter.GetBytes(count.Value).AddRangeToArray(BitConverter.GetBytes(chance.Value)));
}