Compare commits
2
Commits
master
..
31aa20abd8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31aa20abd8 | ||
|
|
2630a9f2af |
@@ -0,0 +1,33 @@
|
||||
name: Build & Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, preprod]
|
||||
workflow_dispatch: {}
|
||||
|
||||
env:
|
||||
IMAGE: git.nfteam.ovh/neckfire/the-cycle
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build & push image
|
||||
run: |
|
||||
set -e
|
||||
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.nfteam.ovh -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
||||
SHA="${GITHUB_SHA::12}"
|
||||
BRANCH="${GITHUB_REF_NAME}"
|
||||
if [ "$BRANCH" = "main" ]; then TAGS="-t ${IMAGE}:latest -t ${IMAGE}:${SHA}"; else TAGS="-t ${IMAGE}:${BRANCH} -t ${IMAGE}:${BRANCH}-${SHA}"; fi
|
||||
docker build $TAGS -f Dockerfile .
|
||||
docker push --all-tags "${IMAGE}"
|
||||
- name: Notify ntfy
|
||||
if: always()
|
||||
run: |
|
||||
if [ "${{ job.status }}" = "success" ]; then EMOJI="white_check_mark"; PRIO="default"; else EMOJI="rotating_light"; PRIO="high"; fi
|
||||
curl -s -H "Authorization: Bearer ${{ secrets.NTFY_TOKEN }}" -H "Title: ${GITHUB_REPOSITORY} — ${{ job.status }}" \
|
||||
-H "Priority: ${PRIO}" -H "Tags: ${EMOJI}" -H "Click: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions" \
|
||||
-d "${GITHUB_WORKFLOW} (${GITHUB_REF_NAME} #${GITHUB_RUN_NUMBER}) : ${{ job.status }}" \
|
||||
"${{ secrets.NTFY_URL }}/${{ secrets.NTFY_TOPIC }}" || true
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
# The Cycle: Frontier — serveur API (émulateur Prospect), build depuis les sources.
|
||||
# Multi-stage : SDK .NET 8 pour publier le projet API → runtime aspnet 8.
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
WORKDIR /src
|
||||
COPY src/ ./src/
|
||||
# Configuration "Season 2 Release" = build qui correspond au client S2 déployé
|
||||
# (le code sélectionne la saison via des #if SEASON_2_RELEASE / SEASON_3_RELEASE).
|
||||
RUN dotnet publish src/Prospect.Server.Api/Prospect.Server.Api.csproj \
|
||||
-c "Season 2 Release" -o /app
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0
|
||||
WORKDIR /app
|
||||
COPY --from=build /app ./
|
||||
EXPOSE 8443 8000
|
||||
ENTRYPOINT ["dotnet", "Prospect.Server.Api.dll"]
|
||||
@@ -141,7 +141,7 @@ to successfully communicate with the local server. Do the following:
|
||||
|
||||
1. Select **Place all certificates in the following store** > **Browse...**. Choose **Trusted Root Certification Authorities** and click **OK**. Click **Next**.
|
||||
|
||||
1. Click **Finish**. A **Security Warning** popup may appear, make sure it specifies `127.0.0.1` certification authority and click **Yes**.
|
||||
1. Click **Finish**. A **Security Warning** popup may appear, make sure it specifies `2EA46.playfabapi.com` certification authority and click **Yes**.
|
||||
|
||||
### 4. Extract `LoaderPack` to the game
|
||||
|
||||
@@ -174,7 +174,7 @@ If you've installed the certificate for the **Current User**:
|
||||
|
||||
1. Expand **Trusted Root Certification Authorities** and select **Certificates**.
|
||||
|
||||
1. Find `127.0.0.1`, right-click it > **Delete**.
|
||||
1. Find `2EA46.playfabapi.com`, right-click it > **Delete**.
|
||||
|
||||
If you've installed the certificate for the **Local Machine**, repeat the same steps but instead open `certlm.msc`.
|
||||
|
||||
|
||||
@@ -4,4 +4,6 @@ public class PlayFabSettings
|
||||
{
|
||||
public string PublisherId { get; set; }
|
||||
public string TitleId { get; set; }
|
||||
public string SignalRURL { get; set; }
|
||||
public string SignalRAccessToken { get; set; }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Prospect.Server.Api.Config;
|
||||
|
||||
public class SignalRSettings
|
||||
{
|
||||
public string SignalRURL { get; set; }
|
||||
public string SignalRAccessToken { get; set; }
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace Prospect.Server.Api.Config;
|
||||
|
||||
public class VivoxConfig
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string Issuer { get; set; }
|
||||
public string Domain { get; set; }
|
||||
public string Server { get; set; }
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
using System.Net.Mime;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Prospect.Server.Api.Hubs;
|
||||
|
||||
namespace Prospect.Server.Api.Controllers;
|
||||
|
||||
public class NotifyRequest
|
||||
{
|
||||
[JsonPropertyName("type")]
|
||||
public string MessageType { get; set; }
|
||||
|
||||
[JsonPropertyName("data")]
|
||||
public object MessageData { get; set; }
|
||||
}
|
||||
|
||||
public class ServerReadyMessageData
|
||||
{
|
||||
[JsonPropertyName("success")]
|
||||
public bool Success { get; set; }
|
||||
[JsonPropertyName("sessionId")]
|
||||
public string SessionID { get; set; }
|
||||
[JsonPropertyName("squadId")]
|
||||
public string SquadID { get; set; }
|
||||
}
|
||||
|
||||
|
||||
[Route("Notifications")]
|
||||
[ApiController]
|
||||
public class NotificationsController : Controller
|
||||
{
|
||||
private readonly IHubContext<CycleHub> _hubContext;
|
||||
private readonly ILogger<NotificationsController> _logger;
|
||||
|
||||
public NotificationsController(ILogger<NotificationsController> logger, IHubContext<CycleHub> hubContext)
|
||||
{
|
||||
_logger = logger;
|
||||
_hubContext = hubContext;
|
||||
}
|
||||
|
||||
[HttpPost("TestNotify")]
|
||||
[Produces(MediaTypeNames.Application.Json)]
|
||||
public async Task<IActionResult> TestNotify(NotifyRequest request)
|
||||
{
|
||||
// TODO: To test Notifications_DT
|
||||
_logger.LogDebug("Received test notification event {MessageType}", request.MessageType);
|
||||
await _hubContext.Clients.All.SendAsync(request.MessageType, request.MessageData);
|
||||
|
||||
return StatusCode(200);
|
||||
}
|
||||
|
||||
[HttpPost("ServerReady")]
|
||||
[Produces(MediaTypeNames.Application.Json)]
|
||||
public async Task<IActionResult> ServerReady(ServerReadyMessageData request)
|
||||
{
|
||||
_logger.LogDebug("Received test notification event OnSquadMatchmakingSuccess");
|
||||
await _hubContext.Clients.All.SendAsync("OnSquadMatchmakingSuccess", request);
|
||||
|
||||
return StatusCode(200);
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,8 @@ public class TitleDataContractInfo {
|
||||
public TitleDataContractInfoUnlockData UnlockData { get; set; }
|
||||
[JsonPropertyName("IsMainContract")]
|
||||
public bool IsMainContract { get; set; }
|
||||
[JsonPropertyName("Difficulty")]
|
||||
public EYContractDifficulty Difficulty { get; set; }
|
||||
[JsonPropertyName("ContractDifficulty")]
|
||||
public EYContractDifficulty ContractDifficulty { get; set; }
|
||||
}
|
||||
|
||||
public class TitleDataContractInfoReward {
|
||||
|
||||
@@ -1,22 +1,6 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class TitleDataDailyCrateInfo {
|
||||
[JsonPropertyName("Name")]
|
||||
public string Name { get; set; }
|
||||
[JsonPropertyName("Level")]
|
||||
public int Level { get; set; }
|
||||
[JsonPropertyName("RewardGrants")]
|
||||
public TitleDataDailyCrateInfoRewardGrants[] RewardGrants { get; set; }
|
||||
}
|
||||
|
||||
public class TitleDataDailyCrateInfoRewardGrants {
|
||||
[JsonPropertyName("Pool")]
|
||||
public TitleDataDailyCrateInfoPoolItem[] Pool { get; set; }
|
||||
[JsonPropertyName("Amount")]
|
||||
public int Amount { get; set; }
|
||||
}
|
||||
|
||||
public class TitleDataDailyCrateInfoPoolItem {
|
||||
[JsonPropertyName("Name")]
|
||||
public string Name { get; set; }
|
||||
[JsonPropertyName("Weight")]
|
||||
|
||||
@@ -9,6 +9,8 @@ public class TitleDataMissionInfo {
|
||||
public UDataTable OnboardingRewards { get; set; }
|
||||
}
|
||||
|
||||
// {\"TalkToBadumReward\":{\"MissionRewardId\":\"TalkToBadumReward\",\"RewardEntries\":[{\"RewardType\":7,\"RewardRowHandle\":{\"DataTable\":\"DataTable\\u0027/Game/DataTables/PRO_Weapons.PRO_Weapons\\u0027\",\"RowName\":\"WP_E_SMG_Bullet_01\"},\"RewardAmount\":2},{\"RewardType\":7,\"RewardRowHandle\":{\"DataTable\":\"DataTable\\u0027/Game/DataTables/PRO_Weapons.PRO_Weapons\\u0027\",\"RowName\":\"WP_E_AR_Energy_01\"},\"RewardAmount\":1},{\"RewardType\":7,\"RewardRowHandle\":{\"DataTable\":\"DataTable\\u0027/Game/DataTables/PRO_Weapons.PRO_Weapons\\u0027\",\"RowName\":\"WP_E_Pistol_Bullet_01\"},\"RewardAmount\":5},{\"RewardType\":7,\"RewardRowHandle\":{\"DataTable\":\"DataTable\\u0027/Game/DataTables/PRO_Weapons.PRO_Weapons\\u0027\",\"RowName\":\"WP_E_SGun_Bullet_01\"},\"RewardAmount\":2},{\"RewardType\":6,\"RewardRowHandle\":{\"DataTable\":\"DataTable\\u0027/Game/DataTables/AmmoTypes_DT.AmmoTypes_DT\\u0027\",\"RowName\":\"Light\"},\"RewardAmount\":6},{\"RewardType\":6,\"RewardRowHandle\":{\"DataTable\":\"DataTable\\u0027/Game/DataTables/AmmoTypes_DT.AmmoTypes_DT\\u0027\",\"RowName\":\"Medium\"},\"RewardAmount\":4},{\"RewardType\":6,\"RewardRowHandle\":{\"DataTable\":\"DataTable\\u0027/Game/DataTables/AmmoTypes_DT.AmmoTypes_DT\\u0027\",\"RowName\":\"Shotgun\"},\"RewardAmount\":2},{\"RewardType\":8,\"RewardRowHandle\":{\"DataTable\":\"DataTable\\u0027/Game/DataTables/PRO_Abilities.PRO_Abilities\\u0027\",\"RowName\":\"ShockGrenade_02\"},\"RewardAmount\":2},{\"RewardType\":8,\"RewardRowHandle\":{\"DataTable\":\"DataTable\\u0027/Game/DataTables/PRO_Abilities.PRO_Abilities\\u0027\",\"RowName\":\"Consumable_Health_01\"},\"RewardAmount\":5},{\"RewardType\":0,\"RewardRowHandle\":{\"DataTable\":\"DataTable\\u0027/Game/DataTables/PRO_PlayerShield.PRO_PlayerShield\\u0027\",\"RowName\":\"Shield_01\"},\"RewardAmount\":5},{\"RewardType\":10,\"RewardRowHandle\":{\"DataTable\":\"DataTable\\u0027/Game/DataTables/PRO_Bags.PRO_Bags\\u0027\",\"RowName\":\"Bag_01\"},\"RewardAmount\":5},{\"RewardType\":7,\"RewardRowHandle\":{\"DataTable\":\"DataTable\\u0027/Game/DataTables/PRO_Weapons.PRO_Weapons\\u0027\",\"RowName\":\"TOOL_MineralScanner_01\"},\"RewardAmount\":2}]},\"FirstMatchReward\":{\"MissionRewardId\":\"FirstMatchReward\",\"RewardEntries\":[{\"RewardType\":2,\"RewardRowHandle\":{\"DataTable\":\"DataTable\\u0027/Game/DataTables/Materials_DT.Materials_DT\\u0027\",\"RowName\":\"Insulation\"},\"RewardAmount\":4},{\"RewardType\":1,\"RewardRowHandle\":{\"DataTable\":\"DataTable\\u0027/Game/DataTables/Currencies_DT.Currencies_DT\\u0027\",\"RowName\":\"SoftCurrency\"},\"RewardAmount\":1500},{\"RewardType\":2,\"RewardRowHandle\":{\"DataTable\":\"DataTable\\u0027/Game/DataTables/Materials_DT.Materials_DT\\u0027\",\"RowName\":\"GenericCreatureDrop\"},\"RewardAmount\":3},{\"RewardType\":2,\"RewardRowHandle\":{\"DataTable\":\"DataTable\\u0027/Game/DataTables/Materials_DT.Materials_DT\\u0027\",\"RowName\":\"ICAScrip\"},\"RewardAmount\":1}]}}",
|
||||
|
||||
public class TitleDataMissionRewardInfo {
|
||||
[JsonPropertyName("MissionRewardId")]
|
||||
public string MissionRewardId { get; set; }
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ClaimActiveContract : ICloudScriptFunction<FYClaimCompletedActiveCo
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly UserDataService _userDataService;
|
||||
private readonly TitleDataService _titleDataService;
|
||||
private readonly EYContractDifficulty[] difficulties = [EYContractDifficulty.Easy, EYContractDifficulty.Medium, EYContractDifficulty.Hard];
|
||||
private readonly string[] difficulties = ["Easy", "Medium", "Hard"];
|
||||
private readonly Random rnd = new Random();
|
||||
|
||||
public ClaimActiveContract(IHttpContextAccessor httpContextAccessor, UserDataService userDataService, TitleDataService titleDataService)
|
||||
@@ -219,19 +219,20 @@ public class ClaimActiveContract : ICloudScriptFunction<FYClaimCompletedActiveCo
|
||||
if (contract.IsMainContract) {
|
||||
contractsCompleted.ContractsIDs.Add(contract.Name);
|
||||
} else {
|
||||
var contractDifficulty = contract.Difficulty;
|
||||
var parts = contract.Name.Split('-');
|
||||
var difficulty = parts[1];
|
||||
|
||||
var levelsData = JsonSerializer.Deserialize<Dictionary<string, int[]>>(titleData["LevelData"]);
|
||||
var levels = levelsData[contract.Faction];
|
||||
var jobs = JsonSerializer.Deserialize<Dictionary<string, Dictionary<EYContractDifficulty, string[]>>>(titleData["Jobs"]);
|
||||
var jobs = JsonSerializer.Deserialize<Dictionary<string, Dictionary<string, string[]>>>(titleData["Jobs"]);
|
||||
var level = levels.Length - Array.FindIndex(levels, (int xp) => {
|
||||
return factionProgression >= xp;
|
||||
});
|
||||
|
||||
var factionBoard = jobBoardsData.Boards.Find(c => c.FactionId == contract.Faction);
|
||||
var idx = Array.FindIndex(difficulties, d => d == contractDifficulty);
|
||||
var idx = Array.FindIndex(difficulties, d => d == difficulty);
|
||||
var factionJobs = jobs[contract.Faction];
|
||||
var jobsAvailable = Array.FindAll(factionJobs[contractDifficulty], (string jobId) => {
|
||||
var jobsAvailable = Array.FindAll(factionJobs[difficulty], (string jobId) => {
|
||||
return level >= contracts[jobId].UnlockData.Level;
|
||||
});
|
||||
// If player completes a job, it means he has at least one unlocked anyway.
|
||||
|
||||
+27
-28
@@ -43,9 +43,9 @@ public class ClaimGeneratorIncomeClient : ICloudScriptFunction<FYClaimGeneratorI
|
||||
|
||||
static readonly Random random = new();
|
||||
|
||||
private TitleDataDailyCrateInfoPoolItem[] PickItems(TitleDataDailyCrateInfoPoolItem[] items, int numPicks)
|
||||
private TitleDataDailyCrateInfo[] PickItems(TitleDataDailyCrateInfo[] items, int numPicks)
|
||||
{
|
||||
var itemList = new (TitleDataDailyCrateInfoPoolItem item, float cumulativeWeight)[items.Length];
|
||||
var itemList = new (TitleDataDailyCrateInfo item, float cumulativeWeight)[items.Length];
|
||||
float totalWeight = 0;
|
||||
|
||||
for (int i = 0; i < items.Length; i++) {
|
||||
@@ -54,7 +54,7 @@ public class ClaimGeneratorIncomeClient : ICloudScriptFunction<FYClaimGeneratorI
|
||||
itemList[i] = (item, totalWeight);
|
||||
}
|
||||
|
||||
var selectedItems = new TitleDataDailyCrateInfoPoolItem[numPicks];
|
||||
var selectedItems = new TitleDataDailyCrateInfo[numPicks];
|
||||
|
||||
for (int i = 0; i < numPicks; i++) {
|
||||
float pick = (float)random.NextDouble() * totalWeight;
|
||||
@@ -108,7 +108,7 @@ public class ClaimGeneratorIncomeClient : ICloudScriptFunction<FYClaimGeneratorI
|
||||
var inventory = JsonSerializer.Deserialize<List<FYCustomItemInfo>>(userData["Inventory"].Value);
|
||||
var techTreeBonuses = JsonSerializer.Deserialize<CharacterTechTreeBonuses>(userData["CharacterTechTreeBonuses"].Value);
|
||||
|
||||
var titleData = _titleDataService.Find(new List<string>{"PassiveGenerators", "DailyCrateSetups", "Blueprints"});
|
||||
var titleData = _titleDataService.Find(new List<string>{"PassiveGenerators", "DailyCrateRewardsPools", "Blueprints"});
|
||||
var passiveGenerators = JsonSerializer.Deserialize<Dictionary<string, TitleDataPassiveGeneratorsInfo>>(titleData["PassiveGenerators"]);
|
||||
|
||||
var now = (int)DateTimeOffset.UtcNow.ToUnixTimeSeconds();
|
||||
@@ -187,32 +187,31 @@ public class ClaimGeneratorIncomeClient : ICloudScriptFunction<FYClaimGeneratorI
|
||||
};
|
||||
}
|
||||
|
||||
var dailyCrateSetups = JsonSerializer.Deserialize<TitleDataDailyCrateInfo[]>(titleData["DailyCrateSetups"]);
|
||||
var dailyCrateRewards = JsonSerializer.Deserialize<TitleDataDailyCrateInfo[][]>(titleData["DailyCrateRewardsPools"]);
|
||||
var blueprints = JsonSerializer.Deserialize<Dictionary<string, TitleDataBlueprintInfo>>(titleData["Blueprints"]);
|
||||
var rewardsPool = dailyCrateSetups[crateTier - 1];
|
||||
var rewardsPool = dailyCrateRewards[crateTier - 1];
|
||||
|
||||
foreach (var grant in rewardsPool.RewardGrants) {
|
||||
var items = PickItems(grant.Pool, grant.Amount);
|
||||
// TODO: Stackable? GrantedItems doesn't imply granted OR updated.
|
||||
foreach (var item in items) {
|
||||
var itemInfo = blueprints[item.Name];
|
||||
var grantedItem = new FYCustomItemInfo {
|
||||
ItemId = Guid.NewGuid().ToString(),
|
||||
Amount = item.Amount,
|
||||
BaseItemId = item.Name,
|
||||
Durability = itemInfo.DurabilityMax,
|
||||
Insurance = "",
|
||||
InsuranceOwnerPlayfabId = "",
|
||||
ModData = new FYModItems { M = [] },
|
||||
Origin = new FYItemOriginBackend { G = "", P = "", T = "" },
|
||||
InsuredAttachmentId = "",
|
||||
PrimaryVanityId = 0,
|
||||
SecondaryVanityId = 0,
|
||||
RolledPerks = [],
|
||||
};
|
||||
inventory.Add(grantedItem);
|
||||
grantedItems.Add(grantedItem);
|
||||
}
|
||||
// TODO: Get rewardGrants from PassiveGenerators_CrateRewards_DT
|
||||
var items = PickItems(rewardsPool, 5);
|
||||
// TODO: Stackable? GrantedItems doesn't imply granted OR updated.
|
||||
foreach (var item in items) {
|
||||
var itemInfo = blueprints[item.Name];
|
||||
var grantedItem = new FYCustomItemInfo {
|
||||
ItemId = Guid.NewGuid().ToString(),
|
||||
Amount = item.Amount,
|
||||
BaseItemId = item.Name,
|
||||
Durability = itemInfo.DurabilityMax,
|
||||
Insurance = "",
|
||||
InsuranceOwnerPlayfabId = "",
|
||||
ModData = new FYModItems { M = [] },
|
||||
Origin = new FYItemOriginBackend { G = "", P = "", T = "" },
|
||||
InsuredAttachmentId = "",
|
||||
PrimaryVanityId = 0,
|
||||
SecondaryVanityId = 0,
|
||||
RolledPerks = [],
|
||||
};
|
||||
inventory.Add(grantedItem);
|
||||
grantedItems.Add(grantedItem);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ namespace Prospect.Server.Api.Services.CloudScript.Functions;
|
||||
[CloudScriptFunction("GetSignalRConnection")]
|
||||
public class GetSignalRConnection : ICloudScriptFunction<FYGetSignalRConnection, FYGetSignalRConnectionResult>
|
||||
{
|
||||
private readonly SignalRSettings _settings;
|
||||
private readonly PlayFabSettings _settings;
|
||||
|
||||
public GetSignalRConnection(IOptions<SignalRSettings> settings)
|
||||
public GetSignalRConnection(IOptions<PlayFabSettings> settings)
|
||||
{
|
||||
_settings = settings.Value;
|
||||
}
|
||||
|
||||
+11
-9
@@ -16,7 +16,7 @@ public class RequestActiveObjectivesAndBoardsData : ICloudScriptFunction<FYQuery
|
||||
private readonly UserDataService _userDataService;
|
||||
private readonly TitleDataService _titleDataService;
|
||||
private readonly string[] factions = ["Korolev", "Osiris", "ICA"]; // TODO: Order is important
|
||||
private readonly EYContractDifficulty[] difficulties = [EYContractDifficulty.Easy, EYContractDifficulty.Medium, EYContractDifficulty.Hard];
|
||||
private readonly string[] difficulties = ["Easy", "Medium", "Hard"];
|
||||
private readonly Random rnd = new Random();
|
||||
|
||||
public RequestActiveObjectivesAndBoardsData(IHttpContextAccessor httpContextAccessor, UserDataService userDataService, TitleDataService titleDataService)
|
||||
@@ -47,20 +47,22 @@ public class RequestActiveObjectivesAndBoardsData : ICloudScriptFunction<FYQuery
|
||||
var titleData = _titleDataService.Find(new List<string> { "Contracts", "Jobs", "LevelData" });
|
||||
|
||||
var contracts = JsonSerializer.Deserialize<Dictionary<string, TitleDataContractInfo>>(titleData["Contracts"]);
|
||||
var jobs = JsonSerializer.Deserialize<Dictionary<string, Dictionary<EYContractDifficulty, string[]>>>(titleData["Jobs"]);
|
||||
var jobs = JsonSerializer.Deserialize<Dictionary<string, Dictionary<string, string[]>>>(titleData["Jobs"]);
|
||||
var levelsData = JsonSerializer.Deserialize<Dictionary<string, int[]>>(titleData["LevelData"]);
|
||||
var currentQuests = new Dictionary<string, Dictionary<EYContractDifficulty, bool>> {
|
||||
["Korolev"] = new Dictionary<EYContractDifficulty, bool> { [EYContractDifficulty.Easy] = false, [EYContractDifficulty.Medium] = false, [EYContractDifficulty.Hard] = false },
|
||||
["Osiris"] = new Dictionary<EYContractDifficulty, bool> { [EYContractDifficulty.Easy] = false, [EYContractDifficulty.Medium] = false, [EYContractDifficulty.Hard] = false },
|
||||
["ICA"] = new Dictionary<EYContractDifficulty, bool> { [EYContractDifficulty.Easy] = false, [EYContractDifficulty.Medium] = false, [EYContractDifficulty.Hard] = false },
|
||||
var currentQuests = new Dictionary<string, Dictionary<string, bool>> {
|
||||
["Korolev"] = new Dictionary<string, bool> { ["Easy"] = false, ["Medium"] = false, ["Hard"] = false },
|
||||
["Osiris"] = new Dictionary<string, bool> { ["Easy"] = false, ["Medium"] = false, ["Hard"] = false },
|
||||
["ICA"] = new Dictionary<string, bool> { ["Easy"] = false, ["Medium"] = false, ["Hard"] = false },
|
||||
};
|
||||
|
||||
foreach (var contract in contractsActive.Contracts) {
|
||||
var contractData = contracts[contract.ContractID];
|
||||
if (contractData.IsMainContract) {
|
||||
var parts = contract.ContractID.Split('-');
|
||||
if (parts[0] != "NEW") {
|
||||
continue;
|
||||
}
|
||||
currentQuests[contractData.Faction][contractData.Difficulty] = true;
|
||||
var difficulty = parts[1];
|
||||
var faction = parts[2] == "KOR" ? "Korolev" : parts[2];
|
||||
currentQuests[faction][difficulty] = true;
|
||||
}
|
||||
|
||||
for (var i = 0; i < factions.Length; i++) {
|
||||
|
||||
@@ -43,9 +43,9 @@ public class UpdateRetentionBonus : ICloudScriptFunction<FYRetentionBonusRequest
|
||||
};
|
||||
}
|
||||
|
||||
var currentMidnight = (int)new DateTimeOffset(DateTime.UtcNow.Date, TimeSpan.Zero).ToUnixTimeSeconds();
|
||||
var nextClaimTime = retentionBonus.LastClaimTime.Seconds + 60 * 60 * 24;
|
||||
if (currentMidnight < nextClaimTime) {
|
||||
var now = (int)DateTimeOffset.UtcNow.ToUnixTimeSeconds();
|
||||
var nextClaimTime = retentionBonus.LastClaimTime.Seconds + 60 * 60 * 24 * 2;
|
||||
if (now < nextClaimTime) {
|
||||
return new FYRetentionBonusResult
|
||||
{
|
||||
UserId = userId,
|
||||
@@ -58,7 +58,7 @@ public class UpdateRetentionBonus : ICloudScriptFunction<FYRetentionBonusRequest
|
||||
var bonusData = JsonSerializer.Deserialize<Dictionary<string, TitleDataRetentionBonusInfo>>(titleData["RetentionBonusData"]);
|
||||
|
||||
retentionBonus.DaysClaimed++;
|
||||
retentionBonus.LastClaimTime.Seconds = currentMidnight;
|
||||
retentionBonus.LastClaimTime.Seconds = now;
|
||||
retentionBonus.ClaimedAll = retentionBonus.DaysClaimed >= 14;
|
||||
|
||||
// TODO: Currently only CB2 bonuses are considered
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Prospect.Server.Api.Config;
|
||||
using Prospect.Server.Api.Services.CloudScript.Models;
|
||||
|
||||
namespace Prospect.Server.Api.Services.CloudScript.Functions;
|
||||
@@ -29,13 +27,6 @@ public class FYVivoxJoinTokenRequest
|
||||
[CloudScriptFunction("VivoxJoin")]
|
||||
public class VivoxJoin : ICloudScriptFunction<FYVivoxJoinTokenRequest, object>
|
||||
{
|
||||
private readonly VivoxConfig _settings;
|
||||
|
||||
public VivoxJoin(IOptions<VivoxConfig> settings)
|
||||
{
|
||||
_settings = settings.Value;
|
||||
}
|
||||
|
||||
private int ReturnChannelType(string type) {
|
||||
switch (type) {
|
||||
case "GLOBAL": return 2;
|
||||
@@ -50,7 +41,8 @@ public class VivoxJoin : ICloudScriptFunction<FYVivoxJoinTokenRequest, object>
|
||||
public async Task<object> ExecuteAsync(FYVivoxJoinTokenRequest request)
|
||||
{
|
||||
var exp = (int)DateTimeOffset.UtcNow.AddDays(1).ToUnixTimeSeconds();
|
||||
var token = TokenGenerator.vxGenerateToken(_settings.Key, _settings.Issuer, exp, "join", request.Username, request.Channel);
|
||||
// TODO: Replace with app configuration
|
||||
var token = TokenGenerator.vxGenerateToken("key", "issuer", exp, "join", request.Username, request.Channel);
|
||||
|
||||
return new FYVivoxJoinData
|
||||
{
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using Prospect.Server.Api.Config;
|
||||
using Prospect.Server.Api.Services.CloudScript.Models;
|
||||
using Prospect.Server.Api.Services.CloudScript.Models;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.Json;
|
||||
|
||||
@@ -86,18 +84,12 @@ public class TokenGenerator
|
||||
[CloudScriptFunction("VivoxLogin")]
|
||||
public class VivoxLogin : ICloudScriptFunction<FYVivoxLoginTokenRequest, FYVivoxJoinData>
|
||||
{
|
||||
private readonly VivoxConfig _settings;
|
||||
|
||||
public VivoxLogin(IOptions<VivoxConfig> settings)
|
||||
{
|
||||
_settings = settings.Value;
|
||||
}
|
||||
|
||||
public async Task<FYVivoxJoinData> ExecuteAsync(FYVivoxLoginTokenRequest request)
|
||||
{
|
||||
var channel = $"sip:confctl-g-{_settings.Issuer}.testchannel@mtu1xp.vivox.com"; // e - echo channel, g - global, p - positional
|
||||
// TODO: Replace with app configuration
|
||||
var channel = "sip:confctl-g-<issuer>.testchannel@mtu1xp.vivox.com"; // e - echo channel, g - global, p - positional
|
||||
var exp = (int)DateTimeOffset.UtcNow.AddSeconds(90).ToUnixTimeSeconds();
|
||||
var token = TokenGenerator.vxGenerateToken(_settings.Key, _settings.Issuer, exp, "login", request.Username, channel);
|
||||
var token = TokenGenerator.vxGenerateToken("key", "issuer", exp, "login", request.Username, channel);
|
||||
|
||||
return new FYVivoxJoinData
|
||||
{
|
||||
|
||||
@@ -1,26 +1,18 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using Prospect.Server.Api.Config;
|
||||
using Prospect.Server.Api.Services.CloudScript.Models;
|
||||
using Prospect.Server.Api.Services.CloudScript.Models;
|
||||
|
||||
namespace Prospect.Server.Api.Services.CloudScript.Functions;
|
||||
|
||||
[CloudScriptFunction("VivoxSettings")]
|
||||
public class VivoxSettings : ICloudScriptFunction<FYEmptyRequest, FYVivoxSettingsData>
|
||||
{
|
||||
private readonly VivoxConfig _settings;
|
||||
|
||||
public VivoxSettings(IOptions<VivoxConfig> settings)
|
||||
{
|
||||
_settings = settings.Value;
|
||||
}
|
||||
|
||||
public Task<FYVivoxSettingsData> ExecuteAsync(FYEmptyRequest request)
|
||||
{
|
||||
return Task.FromResult(new FYVivoxSettingsData
|
||||
{
|
||||
VivoxDomain = _settings.Domain,
|
||||
VivoxIssuer = _settings.Issuer,
|
||||
VivoxServer = _settings.Server
|
||||
// TODO: Replace with app configuration
|
||||
// VivoxDomain = "",
|
||||
// VivoxIssuer = "",
|
||||
// VivoxServer = ""
|
||||
});
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -25,8 +25,6 @@ public class Startup
|
||||
services.Configure<AuthTokenSettings>(Configuration.GetSection(nameof(AuthTokenSettings)));
|
||||
services.Configure<DatabaseSettings>(Configuration.GetSection(nameof(DatabaseSettings)));
|
||||
services.Configure<PlayFabSettings>(Configuration.GetSection(nameof(PlayFabSettings)));
|
||||
services.Configure<VivoxConfig>(Configuration.GetSection(nameof(VivoxConfig)));
|
||||
services.Configure<SignalRSettings>(Configuration.GetSection(nameof(SignalRSettings)));
|
||||
|
||||
services.AddSingleton<AuthTokenService>();
|
||||
services.AddSingleton<UserDataService>();
|
||||
|
||||
@@ -8,27 +8,11 @@
|
||||
},
|
||||
"PlayFabSettings": {
|
||||
"PublisherId": "850902E5B40508ED",
|
||||
"TitleId": "2EA46"
|
||||
},
|
||||
"SignalRSettings": {
|
||||
"TitleId": "2EA46",
|
||||
"SignalRURL": "https://127.0.0.1:8443/signalr/?hub=pubsub",
|
||||
"SignalRAccessToken": "TEST"
|
||||
},
|
||||
"VivoxConfig": {
|
||||
"Key": "",
|
||||
"Issuer": "",
|
||||
"Domain": "",
|
||||
"Server": ""
|
||||
},
|
||||
"Kestrel": {
|
||||
"Endpoints": {
|
||||
"Https": {
|
||||
"Url": "https://127.0.0.1:8443"
|
||||
},
|
||||
"Http": {
|
||||
"Url": "http://127.0.0.1:8000"
|
||||
}
|
||||
},
|
||||
"Certificates": {
|
||||
"Default": {
|
||||
"Path": ".\\certificate.pfx"
|
||||
|
||||
Reference in New Issue
Block a user