Add more CloudScript functions, start of EnterMatchmaking
This commit is contained in:
@@ -21,7 +21,8 @@ public class ClientController : Controller
|
||||
{
|
||||
private const int AppIdDefault = 480;
|
||||
private const int AppIdCycleBeta = 1600361;
|
||||
|
||||
|
||||
private readonly ILogger<ClientController> _logger;
|
||||
private readonly PlayFabSettings _settings;
|
||||
private readonly AuthTokenService _authTokenService;
|
||||
private readonly DbUserService _userService;
|
||||
@@ -29,7 +30,8 @@ public class ClientController : Controller
|
||||
private readonly UserDataService _userDataService;
|
||||
private readonly TitleDataService _titleDataService;
|
||||
|
||||
public ClientController(IOptions<PlayFabSettings> settings,
|
||||
public ClientController(ILogger<ClientController> logger,
|
||||
IOptions<PlayFabSettings> settings,
|
||||
AuthTokenService authTokenService,
|
||||
DbUserService userService,
|
||||
DbEntityService entityService,
|
||||
@@ -37,6 +39,7 @@ public class ClientController : Controller
|
||||
TitleDataService titleDataService)
|
||||
{
|
||||
_settings = settings.Value;
|
||||
_logger = logger;
|
||||
_authTokenService = authTokenService;
|
||||
_userService = userService;
|
||||
_entityService = entityService;
|
||||
@@ -113,6 +116,11 @@ public class ClientController : Controller
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_logger.LogWarning("Invalid steam ticket specified, IsValid {IsValid}, HasValidSignature {Sig}, AppId {AppId}",
|
||||
ticket.IsValid,
|
||||
ticket.HasValidSignature,
|
||||
ticket.AppId);
|
||||
}
|
||||
|
||||
return BadRequest(new ClientResponse
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Prospect.Server.Api.Models.Client;
|
||||
using Prospect.Server.Api.Models.CloudScript;
|
||||
using Prospect.Server.Api.Models.CloudScript.Data;
|
||||
using Prospect.Server.Api.Services.Auth.Entity;
|
||||
using Prospect.Server.Api.Services.Auth.Extensions;
|
||||
using Prospect.Server.Api.Services.CloudScript;
|
||||
|
||||
namespace Prospect.Server.Api.Controllers;
|
||||
|
||||
@@ -15,289 +13,36 @@ namespace Prospect.Server.Api.Controllers;
|
||||
public class CloudScriptController : Controller
|
||||
{
|
||||
private readonly ILogger<CloudScriptController> _logger;
|
||||
private readonly CloudScriptService _cloudScriptService;
|
||||
|
||||
public CloudScriptController(ILogger<CloudScriptController> logger)
|
||||
public CloudScriptController(ILogger<CloudScriptController> logger, CloudScriptService cloudScriptService)
|
||||
{
|
||||
_logger = logger;
|
||||
_cloudScriptService = cloudScriptService;
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("ExecuteFunction")]
|
||||
[Produces(MediaTypeNames.Application.Json)]
|
||||
public IActionResult ExecuteFunction(FExecuteFunctionRequest request)
|
||||
public async Task<IActionResult> ExecuteFunction(FExecuteFunctionRequest request)
|
||||
{
|
||||
_logger.LogInformation("Executing function {Function}", request.FunctionName);
|
||||
_logger.LogDebug("Executing CloudScript function {Function}", request.FunctionName);
|
||||
|
||||
object result = null;
|
||||
|
||||
switch (request.FunctionName)
|
||||
{
|
||||
case "RequestMaintenanceModeState":
|
||||
result = new
|
||||
{
|
||||
enabled = false
|
||||
};
|
||||
break;
|
||||
case "GetCharacterVanity":
|
||||
result = new
|
||||
{
|
||||
userId = User.FindAuthUserId(),
|
||||
error = (object) null,
|
||||
returnVanity = new
|
||||
{
|
||||
userId = User.FindAuthUserId(),
|
||||
head_item = new
|
||||
{
|
||||
id = "Black02M_Head1",
|
||||
materialIndex = 0,
|
||||
},
|
||||
boots_item = new
|
||||
{
|
||||
id = "StarterOutfit01_Boots_M",
|
||||
materialIndex = 0,
|
||||
},
|
||||
chest_item = new
|
||||
{
|
||||
id = "StarterOutfit01_Chest_M",
|
||||
materialIndex = 0,
|
||||
},
|
||||
glove_item = new
|
||||
{
|
||||
id = "StarterOutfit01_Gloves_M",
|
||||
materialIndex = 0,
|
||||
},
|
||||
base_suit_item = new
|
||||
{
|
||||
id = "StarterOutfit01M_BaseSuit",
|
||||
materialIndex = 0,
|
||||
},
|
||||
melee_weapon_item = new
|
||||
{
|
||||
id = "Melee_Omega",
|
||||
materialIndex = 0,
|
||||
},
|
||||
body_type = 1,
|
||||
archetype_id = "TheProspector",
|
||||
slot_index = 0
|
||||
}
|
||||
};
|
||||
break;
|
||||
case "SetMatchAllowJoin":
|
||||
result = new
|
||||
{
|
||||
sessionId = (object)null,
|
||||
success = false
|
||||
};
|
||||
break;
|
||||
case "GetFriendList":
|
||||
// TODO: ?
|
||||
result = new
|
||||
{
|
||||
|
||||
};
|
||||
break;
|
||||
case "GetPlayerSets":
|
||||
result = new
|
||||
{
|
||||
success = true,
|
||||
entries = new []
|
||||
{
|
||||
new
|
||||
{
|
||||
setData = new
|
||||
{
|
||||
id = "",
|
||||
userId = User.FindAuthUserId(),
|
||||
kit = "",
|
||||
shield = "",
|
||||
helmet = "",
|
||||
weaponOne = "",
|
||||
weaponTwo = "",
|
||||
bag = "",
|
||||
bagItemsAsJsonStr = "",
|
||||
safeItemsAsJsonStr = ""
|
||||
},
|
||||
items = Array.Empty<object>()
|
||||
}
|
||||
}
|
||||
};
|
||||
break;
|
||||
case "RequestFactionProgression":
|
||||
result = new
|
||||
{
|
||||
factions = new []
|
||||
{
|
||||
new
|
||||
{
|
||||
factionId = "ICA",
|
||||
currentProgression = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
factionId = "Korolev",
|
||||
currentProgression = 0
|
||||
},
|
||||
new
|
||||
{
|
||||
factionId = "Osiris",
|
||||
currentProgression = 0
|
||||
},
|
||||
},
|
||||
userId = User.FindAuthUserId(),
|
||||
error = ""
|
||||
};
|
||||
break;
|
||||
case "GetPlayersInventoriesLimits":
|
||||
result = new
|
||||
{
|
||||
success = true,
|
||||
entries = new []
|
||||
{
|
||||
new {
|
||||
userId = User.FindAuthUserId(),
|
||||
inventoryStashLimit = 75,
|
||||
inventoryBagLimit = 300,
|
||||
inventorySafeLimit = 5
|
||||
}
|
||||
}
|
||||
};
|
||||
break;
|
||||
case "UpdateRetentionBonus":
|
||||
result = new
|
||||
{
|
||||
playerData = new
|
||||
{
|
||||
daysClaimed = 0,
|
||||
lastClaimTime = new
|
||||
{
|
||||
seconds = 1635033600
|
||||
}
|
||||
},
|
||||
userId = User.FindAuthUserId(),
|
||||
error = (object)null
|
||||
};
|
||||
break;
|
||||
case "GetCraftingInProgressData":
|
||||
result = new FYGetCraftingInProgressDataResult
|
||||
{
|
||||
UserId = User.FindAuthUserId(),
|
||||
Error = null,
|
||||
ItemCurrentlyBeingCrafted = new FYItemCurrentlyBeingCrafted
|
||||
{
|
||||
ItemId = null,
|
||||
ItemRarity = -1,
|
||||
PurchaseAmount = -1,
|
||||
UtcTimestampWhenCraftingStarted = new FYTimestamp
|
||||
{
|
||||
Seconds = 0
|
||||
}
|
||||
}
|
||||
};
|
||||
break;
|
||||
case "RequestPlayerContracts":
|
||||
result = new FYGetPlayerContractsResult
|
||||
{
|
||||
UserId = User.FindAuthUserId(),
|
||||
Error = null,
|
||||
ActiveContracts = new List<FYActiveContractPlayerData>(),
|
||||
FactionsContracts = new FYFactionsContractsData
|
||||
{
|
||||
Boards = new List<FYFactionContractsData>
|
||||
{
|
||||
new FYFactionContractsData
|
||||
{
|
||||
FactionId = "ICA",
|
||||
Contracts = new List<FYFactionContractData>
|
||||
{
|
||||
new FYFactionContractData
|
||||
{
|
||||
ContractId = "NEW-Easy-ICA-Gather-1",
|
||||
ContractIsLockedDueToLowFactionReputation = false
|
||||
},
|
||||
new FYFactionContractData
|
||||
{
|
||||
ContractId = "NEW-Medium-ICA-Uplink-1",
|
||||
ContractIsLockedDueToLowFactionReputation = false
|
||||
},
|
||||
new FYFactionContractData
|
||||
{
|
||||
ContractId = "NEW-Hard-ICA-Uplink-1",
|
||||
ContractIsLockedDueToLowFactionReputation = false
|
||||
}
|
||||
}
|
||||
},
|
||||
new FYFactionContractsData
|
||||
{
|
||||
FactionId = "Korolev",
|
||||
Contracts = new List<FYFactionContractData>
|
||||
{
|
||||
new FYFactionContractData
|
||||
{
|
||||
ContractId = "NEW-Easy-KOR-Mine-4",
|
||||
ContractIsLockedDueToLowFactionReputation = false
|
||||
},
|
||||
new FYFactionContractData
|
||||
{
|
||||
ContractId = "NEW-Medium-KOR-Mine-1",
|
||||
ContractIsLockedDueToLowFactionReputation = false
|
||||
},
|
||||
new FYFactionContractData
|
||||
{
|
||||
ContractId = "NEW-Hard-KOR-PvP-6",
|
||||
ContractIsLockedDueToLowFactionReputation = false
|
||||
}
|
||||
}
|
||||
},
|
||||
new FYFactionContractsData
|
||||
{
|
||||
FactionId = "Osiris",
|
||||
Contracts = new List<FYFactionContractData>
|
||||
{
|
||||
new FYFactionContractData
|
||||
{
|
||||
ContractId = "NEW-Easy-Osiris-Brightcaps-1",
|
||||
ContractIsLockedDueToLowFactionReputation = false
|
||||
},
|
||||
new FYFactionContractData
|
||||
{
|
||||
ContractId = "NEW-Medium-Osiris-Gather-1",
|
||||
ContractIsLockedDueToLowFactionReputation = false
|
||||
},
|
||||
new FYFactionContractData
|
||||
{
|
||||
ContractId = "NEW-Hard-Osiris-Gather-7",
|
||||
ContractIsLockedDueToLowFactionReputation = false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
LastBoardRefreshTimeUtc = new FYTimestamp
|
||||
{
|
||||
Seconds = (int)DateTimeOffset.UtcNow.ToUnixTimeSeconds()
|
||||
}
|
||||
},
|
||||
RefreshHours24UtcFromBackend = 12
|
||||
};
|
||||
break;
|
||||
default:
|
||||
_logger.LogWarning("Missing function {Function}", request.FunctionName);
|
||||
|
||||
result = new
|
||||
{
|
||||
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
return Ok(new ClientResponse<FExecuteFunctionResult>
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FExecuteFunctionResult
|
||||
var result = await _cloudScriptService.ExecuteAsync(request.FunctionName, request.FunctionParameter, request.GeneratePlayStreamEvent);
|
||||
if (result != null)
|
||||
{
|
||||
return Ok(new ClientResponse<FExecuteFunctionResult>
|
||||
{
|
||||
ExecutionTimeMilliseconds = 12,
|
||||
FunctionName = request.FunctionName,
|
||||
FunctionResult = result
|
||||
}
|
||||
});
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FExecuteFunctionResult
|
||||
{
|
||||
ExecutionTimeMilliseconds = 12,
|
||||
FunctionName = request.FunctionName,
|
||||
FunctionResult = result
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return StatusCode(500);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user