42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using System;
|
|
|
|
namespace GorillaCaptions.Managers;
|
|
|
|
public static class Extensions
|
|
{
|
|
public static string GetPlatform(this VRRig rig)
|
|
{
|
|
string platformProperty = (string)rig.creator.GetPlayerRef().CustomProperties["platform"];
|
|
|
|
if (!string.IsNullOrEmpty(platformProperty))
|
|
return platformProperty;
|
|
|
|
if (HasOwnedCosmetic(rig, "S. FIRST LOGIN"))
|
|
return "STEAM";
|
|
|
|
if (HasOwnedCosmetic(rig, "FIRST LOGIN") ||
|
|
rig.creator != null && rig.creator.GetPlayerRef().CustomProperties.Count > 3 ||
|
|
rig.currentRankedSubTierPC > 0)
|
|
return "PC";
|
|
|
|
return "Quest";
|
|
}
|
|
|
|
private static bool HasOwnedCosmetic(VRRig rig, string cosmeticName)
|
|
{
|
|
if (rig._playerOwnedCosmetics == null)
|
|
return false;
|
|
|
|
foreach (string ownedCosmetic in rig._playerOwnedCosmetics)
|
|
{
|
|
if (string.IsNullOrEmpty(ownedCosmetic))
|
|
continue;
|
|
|
|
if (ownedCosmetic.IndexOf(cosmeticName, StringComparison.Ordinal) >= 0)
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|