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
7 changes: 0 additions & 7 deletions Runtime/Client/LootLockerEndPoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,6 @@ public class LootLockerEndPoints
public static EndPointClass addingFilesToAssetCandidates = new EndPointClass("v1/player/assets/candidates/{0}/file", LootLockerHTTPMethod.UPLOAD_FILE);
public static EndPointClass removingFilesFromAssetCandidates = new EndPointClass("v1/player/assets/candidates/{0}/file/{1}", LootLockerHTTPMethod.DELETE);

// Events
[Header("Events")]
public static EndPointClass gettingAllEvents = new EndPointClass("v1/missions", LootLockerHTTPMethod.GET);
public static EndPointClass gettingASingleEvent = new EndPointClass("v1/mission/{0}", LootLockerHTTPMethod.GET);
public static EndPointClass startingEvent = new EndPointClass("v1/mission/{0}/start", LootLockerHTTPMethod.POST);
public static EndPointClass finishingEvent = new EndPointClass("v1/mission/{0}/end", LootLockerHTTPMethod.POST);

// Missions
[Header("Missions")]
public static EndPointClass gettingAllMissions = new EndPointClass("v1/missions", LootLockerHTTPMethod.GET);
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Client/LootLockerEventSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public static void TriggerEvent<T>(T eventData) where T : LootLockerEventData

if (instance.logEvents)
{
LootLockerLogger.Log($"LootLocker Event: {eventType} at {eventData.timestamp}. Notified {subscribers.Count} subscribers", LootLockerLogger.LogLevel.Debug);
LootLockerLogger.Log($"Triggered Event: {eventType} at {eventData.timestamp}. Notified {subscribers.Count} subscribers", LootLockerLogger.LogLevel.Debug);
}
}

Expand Down
4 changes: 2 additions & 2 deletions Runtime/Client/LootLockerHTTPClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void ILootLockerService.Initialize()
IsInitialized = true;
_instance = this;
}
LootLockerLogger.Log("LootLockerHTTPClient initialized", LootLockerLogger.LogLevel.Verbose);
LootLockerLogger.Log("HTTPClient initialized", LootLockerLogger.LogLevel.Verbose);
}

/// <summary>
Expand Down Expand Up @@ -464,7 +464,7 @@ void Update()

if((HTTPExecutionQueue.Count - CurrentlyOngoingRequests.Count) > configuration.ChokeWarningThreshold)
{
LootLockerLogger.Log($"LootLocker HTTP Execution Queue is overloaded. Requests currently waiting for execution: '{(HTTPExecutionQueue.Count - CurrentlyOngoingRequests.Count)}'", LootLockerLogger.LogLevel.Warning);
LootLockerLogger.Log($"HTTP Execution Queue is overloaded. Requests currently waiting for execution: '{(HTTPExecutionQueue.Count - CurrentlyOngoingRequests.Count)}'", LootLockerLogger.LogLevel.Warning);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Runtime/Client/LootLockerLifecycleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private static void AutoInitialize()
{
if (_instance == null && Application.isPlaying)
{
LootLockerLogger.Log("Auto-initializing LootLocker LifecycleManager on application start", LootLockerLogger.LogLevel.Debug);
LootLockerLogger.Log("Auto-initializing LifecycleManager on application start", LootLockerLogger.LogLevel.Debug);
Instantiate();
}
}
Expand Down
88 changes: 88 additions & 0 deletions Runtime/Client/LootLockerSessionResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
using System;

namespace LootLocker.Requests
{

[Serializable]
public class LootLockerLevel_Thresholds
{
public int current { get; set; }
public bool current_is_prestige { get; set; }
public int? next { get; set; }
public bool next_is_prestige { get; set; }
}


[Serializable]
public class LootLockerSessionResponse : LootLockerResponse
{
/// <summary>
/// The player's name if it has been set by using SetPlayerName().
/// </summary>
public string player_name { get; set; }
/// <summary>
/// The session token that can now be used to use further LootLocker functionality. We store and use this for you.
/// </summary>
public string session_token { get; set; }
/// <summary>
/// The player id
/// </summary>
public int player_id { get; set; }
/// <summary>
/// Whether this player has been seen before (true) or is new (false)
/// </summary>
public bool seen_before { get; set; }
/// <summary>
/// The last time this player logged in
/// </summary>
public DateTime? last_seen { get; set; }
/// <summary>
/// The public UID for this player
/// </summary>
public string public_uid { get; set; }
/// <summary>
/// The player ULID for this player
/// </summary>
public string player_ulid { get; set; }
/// <summary>
/// The creation time of this player
/// </summary>
public DateTime player_created_at { get; set; }
/// <summary>
/// Whether this player has new information to check in grants
/// </summary>
public bool check_grant_notifications { get; set; }
/// <summary>
/// Whether this player has new information to check in deactivations
/// </summary>
public bool check_deactivation_notifications { get; set; }
/// <summary>
/// Whether this player has new information to check in dlcs
/// </summary>
public int[] check_dlcs { get; set; }
/// <summary>
/// The current xp of this player
/// </summary>
public int xp { get; set; }
/// <summary>
/// The current level of this player
/// </summary>
public int level { get; set; }
/// <summary>
/// The level_thresholds that the level and xp data relates to
/// </summary>
public LootLockerLevel_Thresholds level_thresholds { get; set; }
/// <summary>
/// The current balance in this account
/// </summary>
public int account_balance { get; set; }
/// <summary>
/// The id of the wallet for this account
/// </summary>
public string wallet_id { get; set; }
/// <summary>
/// Any errors that occurred during the request, for example if a player name was supplied in optionals but was invalid.
/// </summary>
public string[] errors { get; set; }
}
}
2 changes: 2 additions & 0 deletions Runtime/Client/LootLockerSessionResponse.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Runtime/Editor/Editor UI/LootLockerAdminExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ private bool IsStageOnlyGame()
if (game.created_at == default(System.DateTime) || game.created_at == null) return false;
var cutoff = new System.DateTime(2025, 3, 10);
return game.created_at >= cutoff;
} void SwapEnvironment()
}

void SwapEnvironment()
{
if (isLoadingKeys)
{
Expand Down
11 changes: 6 additions & 5 deletions Runtime/Editor/LogViewer/LootLockerLogViewerUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,10 @@ private void SetupLogLevelDropdown()
public void Log(LootLockerLogger.LogLevel logLevel, string message)
{
// Skip regular HTTP log lines (let the enriched HTTP log handle it)
if (message.StartsWith("[LL HTTP]") || message.StartsWith("[LL HTTP RESPONSE]"))
if (message.Contains("[HTTP]") || message.Contains("[HTTP RESPONSE]"))
return;
var logEntry = new LogEntry { level = logLevel, message = message, Timestamp = DateTime.Now };
string labelFreeMessage = message.Replace(LootLockerLogger.GetLogLabel(), "").Trim();
var logEntry = new LogEntry { level = logLevel, message = labelFreeMessage, Timestamp = DateTime.Now };
logEntries.Add(logEntry);
allLogEntries.Add(logEntry);
if (logEntries.Count > MAX_LOG_ENTRIES)
Expand Down Expand Up @@ -199,15 +200,15 @@ private void ExportLogs()
var sb = new System.Text.StringBuilder();
if (http.Response?.success ?? false)
{
sb.AppendLine($"[LL HTTP] {http.Method} request to {http.Url} succeeded");
sb.AppendLine($"[HTTP] {http.Method} request to {http.Url} succeeded");
}
else if (!string.IsNullOrEmpty(http.Response?.errorData?.message) && http.Response?.errorData?.message.Length < 40)
{
sb.AppendLine($"[LL HTTP] {http.Method} request to {http.Url} failed with message {http.Response.errorData.message} ({http.StatusCode})");
sb.AppendLine($"[HTTP] {http.Method} request to {http.Url} failed with message {http.Response.errorData.message} ({http.StatusCode})");
}
else
{
sb.AppendLine($"[LL HTTP] {http.Method} request to {http.Url} failed (details in expanded log) ({http.StatusCode})");
sb.AppendLine($"[HTTP] {http.Method} request to {http.Url} failed (details in expanded log) ({http.StatusCode})");
}
sb.AppendLine($"Duration: {http.DurationSeconds:n4}s");
sb.AppendLine("Request Headers:");
Expand Down
24 changes: 19 additions & 5 deletions Runtime/Game/LootLockerLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ public class LootLockerLogger
{
public static LootLockerLogger _instance = null;

private static readonly string LL_LOG_LABEL = $"[{LootLockerConfig.PackageShortName}]";
private static string LogLabel = LL_LOG_LABEL;

private Dictionary<string, LootLockerLogListener> logListeners = new Dictionary<string, LootLockerLogListener>();
private class LogRecord
{
Expand All @@ -33,6 +36,16 @@ public enum LogLevel
, None
}

public static string GetLogLabel()
{
return LogLabel;
}

public static void SetLogLabel(string newLabel)
{
LogLabel = newLabel;
}

/// <summary>
/// Log message with the specified loglevel
/// </summary>
Expand All @@ -44,6 +57,7 @@ public static void Log(string message, LogLevel logLevel = LogLevel.Info)
{
return;
}
string prependedMessage = $"{LogLabel} {message}";

Action<string> logger;
switch (logLevel)
Expand Down Expand Up @@ -73,14 +87,14 @@ public static void Log(string message, LogLevel logLevel = LogLevel.Info)

if(logger != null)
{
logger(message);
logger(prependedMessage);
}

if(_instance == null)
{
_instance = new LootLockerLogger();
}
_instance.RecordAndBroadcastMessage(message, logLevel);
_instance.RecordAndBroadcastMessage(prependedMessage, logLevel);
}

private static bool ShouldLog(LogLevel logLevel)
Expand Down Expand Up @@ -228,15 +242,15 @@ public static void LogHttpRequestResponse(LootLockerHttpLogEntry entry)
var sb = new System.Text.StringBuilder();
if (entry.Response?.success ?? false)
{
sb.AppendLine($"[LL HTTP] {entry.Method} request to {entry.Url} succeeded");
sb.AppendLine($"[HTTP] {entry.Method} request to {entry.Url} succeeded");
}
else if (!string.IsNullOrEmpty(entry.Response?.errorData?.message) && entry.Response?.errorData?.message.Length < 40)
{
sb.AppendLine($"[LL HTTP] {entry.Method} request to {entry.Url} failed with message {entry.Response.errorData.message} ({entry.StatusCode})");
sb.AppendLine($"[HTTP] {entry.Method} request to {entry.Url} failed with message {entry.Response.errorData.message} ({entry.StatusCode})");
}
else
{
sb.AppendLine($"[LL HTTP] {entry.Method} request to {entry.Url} failed (details in expanded log) ({entry.StatusCode})");
sb.AppendLine($"[HTTP] {entry.Method} request to {entry.Url} failed (details in expanded log) ({entry.StatusCode})");
}
sb.AppendLine($"Duration: {entry.DurationSeconds:n4}s");
sb.AppendLine("Request Headers:");
Expand Down
9 changes: 5 additions & 4 deletions Runtime/Game/LootLockerSDKManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static bool CheckInitialized(bool skipSessionCheck = false, string forPla
// Double check that initialization succeeded
if (!LootLockerLifecycleManager.IsReady)
{
LootLockerLogger.Log("LootLocker services are still initializing. Please try again in a moment.", LootLockerLogger.LogLevel.Warning);
LootLockerLogger.Log("The SDK services are still initializing. Please try again in a moment.", LootLockerLogger.LogLevel.Warning);
return false;
}
}
Expand Down Expand Up @@ -158,11 +158,11 @@ public static void SetStateWriter(ILootLockerStateWriter stateWriter)
/// </summary>
public static void ResetSDK()
{
LootLockerLogger.Log("Resetting LootLocker SDK - all services and state will be cleared", LootLockerLogger.LogLevel.Info);
LootLockerLogger.Log("Resetting SDK - all services and state will be cleared", LootLockerLogger.LogLevel.Info);

LootLockerLifecycleManager.ResetInstance();

LootLockerLogger.Log("LootLocker SDK reset complete", LootLockerLogger.LogLevel.Info);
LootLockerLogger.Log("SDK reset complete", LootLockerLogger.LogLevel.Info);
}
#endregion

Expand Down Expand Up @@ -5526,7 +5526,6 @@ public static void GrantAssetToPlayerInventory(int assetID, int? assetVariationI
LootLockerAPIManager.GrantAssetToPlayerInventory(forPlayerWithUlid, data, onComplete);
}

#endregion
/// <summary>
/// List assets with default parameters (no filters, first page, default page size).
/// </summary>
Expand Down Expand Up @@ -5577,6 +5576,8 @@ public static void ListAssets(LootLockerListAssetsRequest Request, Action<LootLo
});
}

#endregion

#region AssetInstance
/// <summary>
/// Get all key/value pairs for all asset instances.
Expand Down
7 changes: 0 additions & 7 deletions Runtime/Game/Requests/AssetInstanceRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ public class LootLockerInstanceStoragePair
public LootLockerStorage storage { get; set; }
}

public class LootLockerStorage
{
public int id { get; set; }
public string key { get; set; }
public string value { get; set; }
}


public class LootLockerAssetDefaultResponse : LootLockerResponse
{
Expand Down
Loading
Loading