Skip to content

Commit

Permalink
Update FikaGlobals
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Nov 1, 2024
1 parent cf0a600 commit 89a6037
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Fika.Core/Coop/Utils/FikaGlobals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,24 @@ public static bool IsDedicatedProfile(this Profile profile)
return profile.Info.GroupId.ToLower() == "dedicated";
}

/// <summary>
/// Forces the <see cref="InfoClass.MainProfileNickname"/> to be set on a profile
/// </summary>
/// <param name="infoClass"></param>
/// <param name="nickname"></param>
public static void SetProfileNickname(this InfoClass infoClass, string nickname)
{
Traverse.Create(infoClass).Field<string>("MainProfileNickname").Value = nickname;
}

/// <summary>
/// Checks whether a profile belongs to a player or an AI
/// </summary>
/// <param name="profile"></param>
/// <returns>True if the profile belongs to a player, false if it belongs to an AI</returns>
public static bool IsPlayerProfile(this Profile profile)
{
return profile.QuestsData != null || !string.IsNullOrEmpty(profile.PetId);
}
}
}

0 comments on commit 89a6037

Please sign in to comment.