Skip to content
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
11 changes: 11 additions & 0 deletions cheats/MovementAndInputHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,17 @@ private static string SanitizeSpoofFriendCode(string input)
return string.IsNullOrWhiteSpace(input) ? "" : input.Trim();
}

[HideFromIl2Cpp]
internal static bool CanSendSpoofFriendCode(string input)
{
string value = SanitizeSpoofFriendCode(input);
if (string.IsNullOrEmpty(value)) return false;

int hash = value.LastIndexOf('#');
string username = hash > 0 ? value.Substring(0, hash) : value;
return username.Length <= 10;
}

private static string SanitizeHexColor(string input, string fallback)
{
string value = (input ?? string.Empty).Trim();
Expand Down
13 changes: 12 additions & 1 deletion features/FriendCodeSpoofPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public static bool Prefix(

string value = (ElysiumModMenuGUI.spoofFriendCodeInput ?? string.Empty).Trim();
if (string.IsNullOrEmpty(value)) return true;
if (!ElysiumModMenuGUI.CanSendSpoofFriendCode(value))
{
ElysiumModMenuGUI.ShowNotification("<color=#FF4444>[SPOOF FC]</color> Server limit: 10 characters.");
return false;
}

int hash = value.LastIndexOf('#');
if (hash <= 0)
Expand Down Expand Up @@ -154,6 +159,11 @@ public static bool Prefix(EditAccountUsername __instance)

string value = (ElysiumModMenuGUI.spoofFriendCodeInput ?? string.Empty).Trim();
if (string.IsNullOrEmpty(value)) return true;
if (!ElysiumModMenuGUI.CanSendSpoofFriendCode(value))
{
ElysiumModMenuGUI.ShowNotification("<color=#FF4444>[SPOOF FC]</color> Server limit: 10 characters.");
return false;
}

try
{
Expand All @@ -170,8 +180,9 @@ public static bool Prefix(EditAccountUsername __instance)
mgr.SetFriendCode(value, callback);
return false;
}
catch
catch (Exception ex)
{
Plugin.Instance?.Log?.LogWarning((object)$"[SPOOF FC] Submit failed: {ex.Message}");
return true;
}
}
Expand Down
3 changes: 2 additions & 1 deletion features/PlayerHistoryStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,8 @@ private static void RebuildPlayerHistoryViewCache()
Identity = $"Lv: {e.Level} | FC: {e.FriendCode} | PUID: {e.Puid}",
Times = $"Joined: {e.FirstSeenUtc:HH:mm:ss} | Left: {(e.LeftUtc.HasValue ? e.LeftUtc.Value.ToString("HH:mm:ss") : "online")}",
Platform = $"Platform: {FormatPlatformHistory(e)}",
Rpc = $"RPC: {FormatRpcHistory(e)}"
Rpc = $"RPC: {FormatRpcHistory(e)}",
Puid = e.Puid
});
}

Expand Down
3 changes: 2 additions & 1 deletion menu/MenuInputAndTabs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ private sealed class PlayerHistoryViewRow
public string Times;
public string Platform;
public string Rpc;
public string Puid;
}

private static readonly Dictionary<string, PlayerHistoryEntry> playerHistoryEntryLookup = new Dictionary<string, PlayerHistoryEntry>();
Expand All @@ -498,7 +499,7 @@ private sealed class PlayerHistoryViewRow

private static bool playerHistoryViewDirty = true;

private const float PlayerHistoryRowHeight = 92f;
private const float PlayerHistoryRowHeight = 108f;

private static bool playerHistoryLoaded = false;

Expand Down
Loading