Skip to content

Commit d4ee99c

Browse files
Mikkel Sørensenkirre-bylund
authored andcommitted
Implement ListPlayerCharacters to return all characters on the player.
1 parent 2c7ec26 commit d4ee99c

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

Runtime/Client/LootLockerEndPoints.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public class LootLockerEndPoints
9090
public static EndPointClass getEquipableContextbyCharacter = new EndPointClass("v1/player/character/{0}/contexts", LootLockerHTTPMethod.GET);
9191
public static EndPointClass createCharacter = new EndPointClass("v1/player/character", LootLockerHTTPMethod.POST);
9292
public static EndPointClass listCharacterTypes = new EndPointClass("v1/player/character/types", LootLockerHTTPMethod.GET);
93+
public static EndPointClass listPlayerCharacters = new EndPointClass("v1/player/character/list", LootLockerHTTPMethod.GET);
9394

9495
// Character Progressions
9596
[Header("Character Progressions")]

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2206,6 +2206,16 @@ public static void ListCharacterTypes(Action<LootLockerListCharacterTypesRespons
22062206
LootLockerAPIManager.ListCharacterTypes(onComplete);
22072207
}
22082208

2209+
public static void ListPlayerCharacters(Action<LootLockerPlayerCharacterListResponse> onComplete)
2210+
{
2211+
if (!CheckInitialized())
2212+
{
2213+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerPlayerCharacterListResponse>());
2214+
return;
2215+
}
2216+
LootLockerAPIManager.ListPlayerCharacters(onComplete);
2217+
}
2218+
22092219
/// <summary>
22102220
/// Get all character loadouts for your game.
22112221
/// </summary>

Runtime/Game/Requests/CharacterRequest.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ public class LootLockerCharacterAsset
123123
{
124124
public string Asset { get; set; }
125125
}
126+
127+
public class LootLockerPlayerCharacterListResponse : LootLockerResponse
128+
{
129+
public LootLockerCharacter[] characters { get; set; }
130+
}
126131
}
127132

128133
namespace LootLocker
@@ -154,6 +159,15 @@ public static void ListCharacterTypes(Action<LootLockerListCharacterTypesRespons
154159
LootLockerServerRequest.CallAPI(getVariable, endPoint.httpMethod, null, (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
155160
}
156161

162+
public static void ListPlayerCharacters(Action<LootLockerPlayerCharacterListResponse> onComplete)
163+
{
164+
EndPointClass endPoint = LootLockerEndPoints.listPlayerCharacters;
165+
166+
string getVariable = endPoint.endPoint;
167+
168+
LootLockerServerRequest.CallAPI(getVariable, endPoint.httpMethod, null, (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
169+
}
170+
157171
public static void GetCharacterLoadout(Action<LootLockerCharacterLoadoutResponse> onComplete)
158172
{
159173
EndPointClass endPoint = LootLockerEndPoints.characterLoadouts;

0 commit comments

Comments
 (0)