Convert to new namespace stuff and implicit usings
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Prospect.Server.Api.Config;
|
||||
@@ -15,256 +12,258 @@ using Prospect.Server.Api.Services.Database.Models;
|
||||
using Prospect.Server.Api.Services.UserData;
|
||||
using Prospect.Server.Steam;
|
||||
|
||||
namespace Prospect.Server.Api.Controllers
|
||||
namespace Prospect.Server.Api.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("Client")]
|
||||
public class ClientController : Controller
|
||||
{
|
||||
[ApiController]
|
||||
[Route("Client")]
|
||||
public class ClientController : Controller
|
||||
{
|
||||
private readonly PlayFabSettings _settings;
|
||||
private readonly AuthTokenService _authTokenService;
|
||||
private readonly DbUserService _userService;
|
||||
private readonly DbEntityService _entityService;
|
||||
private readonly UserDataService _userDataService;
|
||||
private readonly TitleDataService _titleDataService;
|
||||
|
||||
public ClientController(IOptions<PlayFabSettings> settings,
|
||||
AuthTokenService authTokenService,
|
||||
DbUserService userService,
|
||||
DbEntityService entityService,
|
||||
UserDataService userDataService,
|
||||
TitleDataService titleDataService)
|
||||
{
|
||||
_settings = settings.Value;
|
||||
_authTokenService = authTokenService;
|
||||
_userService = userService;
|
||||
_entityService = entityService;
|
||||
_userDataService = userDataService;
|
||||
_titleDataService = titleDataService;
|
||||
}
|
||||
private const int AppIdDefault = 480;
|
||||
private const int AppIdCycleBeta = 1600361;
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost("LoginWithSteam")]
|
||||
[Produces("application/json")]
|
||||
public async Task<IActionResult> LoginWithSteam(ClientLoginWithSteamRequest request)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(request.SteamTicket))
|
||||
{
|
||||
var ticket = AppTicket.Parse(request.SteamTicket);
|
||||
if (ticket.IsValid && ticket.HasValidSignature)
|
||||
{
|
||||
var userSteamId = ticket.SteamId.ToString();
|
||||
|
||||
var user = await _userService.FindOrCreateAsync(PlayFabUserAuthType.Steam, userSteamId);
|
||||
var entity = await _entityService.FindOrCreateAsync(user.Id);
|
||||
|
||||
var userTicket = _authTokenService.GenerateUser(entity);
|
||||
var entityTicket = _authTokenService.GenerateEntity(entity);
|
||||
private readonly PlayFabSettings _settings;
|
||||
private readonly AuthTokenService _authTokenService;
|
||||
private readonly DbUserService _userService;
|
||||
private readonly DbEntityService _entityService;
|
||||
private readonly UserDataService _userDataService;
|
||||
private readonly TitleDataService _titleDataService;
|
||||
|
||||
await _userDataService.InitAsync(user.Id);
|
||||
public ClientController(IOptions<PlayFabSettings> settings,
|
||||
AuthTokenService authTokenService,
|
||||
DbUserService userService,
|
||||
DbEntityService entityService,
|
||||
UserDataService userDataService,
|
||||
TitleDataService titleDataService)
|
||||
{
|
||||
_settings = settings.Value;
|
||||
_authTokenService = authTokenService;
|
||||
_userService = userService;
|
||||
_entityService = entityService;
|
||||
_userDataService = userDataService;
|
||||
_titleDataService = titleDataService;
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost("LoginWithSteam")]
|
||||
[Produces("application/json")]
|
||||
public async Task<IActionResult> LoginWithSteam(ClientLoginWithSteamRequest request)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(request.SteamTicket))
|
||||
{
|
||||
var ticket = AppTicket.Parse(request.SteamTicket);
|
||||
if (ticket.IsValid && ticket.HasValidSignature && (ticket.AppId == AppIdDefault || ticket.AppId == AppIdCycleBeta))
|
||||
{
|
||||
var userSteamId = ticket.SteamId.ToString();
|
||||
|
||||
return Ok(new ClientResponse<FServerLoginResult>
|
||||
var user = await _userService.FindOrCreateAsync(PlayFabUserAuthType.Steam, userSteamId);
|
||||
var entity = await _entityService.FindOrCreateAsync(user.Id);
|
||||
|
||||
var userTicket = _authTokenService.GenerateUser(entity);
|
||||
var entityTicket = _authTokenService.GenerateEntity(entity);
|
||||
|
||||
await _userDataService.InitAsync(user.Id);
|
||||
|
||||
return Ok(new ClientResponse<FServerLoginResult>
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FServerLoginResult
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FServerLoginResult
|
||||
EntityToken = new FEntityTokenResponse
|
||||
{
|
||||
EntityToken = new FEntityTokenResponse
|
||||
Entity = new FEntityKey
|
||||
{
|
||||
Entity = new FEntityKey
|
||||
{
|
||||
Id = entity.Id,
|
||||
Type = "title_player_account",
|
||||
TypeString = "title_player_account"
|
||||
},
|
||||
EntityToken = entityTicket,
|
||||
TokenExpiration = DateTime.UtcNow.AddDays(6), // TODO:
|
||||
Id = entity.Id,
|
||||
Type = "title_player_account",
|
||||
TypeString = "title_player_account"
|
||||
},
|
||||
InfoResultPayload = new FGetPlayerCombinedInfoResultPayload
|
||||
EntityToken = entityTicket,
|
||||
TokenExpiration = DateTime.UtcNow.AddDays(6), // TODO:
|
||||
},
|
||||
InfoResultPayload = new FGetPlayerCombinedInfoResultPayload
|
||||
{
|
||||
CharacterInventories = new List<object>(),
|
||||
PlayerProfile = new FPlayerProfileModel
|
||||
{
|
||||
CharacterInventories = new List<object>(),
|
||||
PlayerProfile = new FPlayerProfileModel
|
||||
{
|
||||
DisplayName = user.DisplayName,
|
||||
PlayerId = user.Id,
|
||||
PublisherId = _settings.PublisherId,
|
||||
TitleId = _settings.TitleId
|
||||
},
|
||||
UserDataVersion = 0,
|
||||
UserInventory = new List<object>(),
|
||||
UserReadOnlyDataVersion = 0
|
||||
DisplayName = user.DisplayName,
|
||||
PlayerId = user.Id,
|
||||
PublisherId = _settings.PublisherId,
|
||||
TitleId = _settings.TitleId
|
||||
},
|
||||
LastLoginTime = DateTime.UtcNow, // TODO:
|
||||
NewlyCreated = false, // TODO:
|
||||
PlayFabId = user.Id,
|
||||
SessionTicket = userTicket,
|
||||
SettingsForUser = new FUserSettings
|
||||
{
|
||||
GatherDeviceInfo = true,
|
||||
GatherFocusInfo = true,
|
||||
NeedsAttribution = false,
|
||||
},
|
||||
TreatmentAssignment = new FTreatmentAssignment
|
||||
{
|
||||
Variables = new List<FVariable>(),
|
||||
Variants = new List<string>()
|
||||
}
|
||||
UserDataVersion = 0,
|
||||
UserInventory = new List<object>(),
|
||||
UserReadOnlyDataVersion = 0
|
||||
},
|
||||
LastLoginTime = DateTime.UtcNow, // TODO:
|
||||
NewlyCreated = false, // TODO:
|
||||
PlayFabId = user.Id,
|
||||
SessionTicket = userTicket,
|
||||
SettingsForUser = new FUserSettings
|
||||
{
|
||||
GatherDeviceInfo = true,
|
||||
GatherFocusInfo = true,
|
||||
NeedsAttribution = false,
|
||||
},
|
||||
TreatmentAssignment = new FTreatmentAssignment
|
||||
{
|
||||
Variables = new List<FVariable>(),
|
||||
Variants = new List<string>()
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return BadRequest(new ClientResponse
|
||||
{
|
||||
Code = 400,
|
||||
Status = "BadRequest",
|
||||
Error = "InvalidSteamTicket",
|
||||
ErrorCode = 1010,
|
||||
ErrorMessage = "Steam API AuthenticateUserTicket error response .."
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("AddGenericID")]
|
||||
[Produces("application/json")]
|
||||
[Authorize(AuthenticationSchemes = UserAuthenticationOptions.DefaultScheme)]
|
||||
public IActionResult AddGenericId(FAddGenericIDRequest request)
|
||||
return BadRequest(new ClientResponse
|
||||
{
|
||||
return Ok(new ClientResponse<object>
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new object()
|
||||
});
|
||||
}
|
||||
Code = 400,
|
||||
Status = "BadRequest",
|
||||
Error = "InvalidSteamTicket",
|
||||
ErrorCode = 1010,
|
||||
ErrorMessage = "Steam API AuthenticateUserTicket error response .."
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("UpdateUserTitleDisplayName")]
|
||||
[Produces("application/json")]
|
||||
[Authorize(AuthenticationSchemes = UserAuthenticationOptions.DefaultScheme)]
|
||||
public IActionResult UpdateUserTitleDisplayName(FUpdateUserTitleDisplayNameRequest request)
|
||||
[HttpPost("AddGenericID")]
|
||||
[Produces("application/json")]
|
||||
[Authorize(AuthenticationSchemes = UserAuthenticationOptions.DefaultScheme)]
|
||||
public IActionResult AddGenericId(FAddGenericIDRequest request)
|
||||
{
|
||||
return Ok(new ClientResponse<object>
|
||||
{
|
||||
return Ok(new ClientResponse<FUpdateUserTitleDisplayNameResult>
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FUpdateUserTitleDisplayNameResult
|
||||
{
|
||||
DisplayName = request.DisplayName
|
||||
}
|
||||
});
|
||||
}
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new {}
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("UpdateUserData")]
|
||||
[Produces("application/json")]
|
||||
[Authorize(AuthenticationSchemes = UserAuthenticationOptions.DefaultScheme)]
|
||||
public async Task<IActionResult> UpdateUserData(FUpdateUserDataRequest request)
|
||||
[HttpPost("UpdateUserTitleDisplayName")]
|
||||
[Produces("application/json")]
|
||||
[Authorize(AuthenticationSchemes = UserAuthenticationOptions.DefaultScheme)]
|
||||
public IActionResult UpdateUserTitleDisplayName(FUpdateUserTitleDisplayNameRequest request)
|
||||
{
|
||||
return Ok(new ClientResponse<FUpdateUserTitleDisplayNameResult>
|
||||
{
|
||||
var userId = User.FindAuthUserId();
|
||||
await _userDataService.UpdateAsync(userId, request.PlayFabId, request.Data);
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FUpdateUserTitleDisplayNameResult
|
||||
{
|
||||
DisplayName = request.DisplayName
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("UpdateUserData")]
|
||||
[Produces("application/json")]
|
||||
[Authorize(AuthenticationSchemes = UserAuthenticationOptions.DefaultScheme)]
|
||||
public async Task<IActionResult> UpdateUserData(FUpdateUserDataRequest request)
|
||||
{
|
||||
var userId = User.FindAuthUserId();
|
||||
await _userDataService.UpdateAsync(userId, request.PlayFabId, request.Data);
|
||||
|
||||
return Ok(new ClientResponse<FUpdateUserDataResult>
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FUpdateUserDataResult
|
||||
{
|
||||
DataVersion = 0
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("GetUserData")]
|
||||
[Produces("application/json")]
|
||||
[Authorize(AuthenticationSchemes = UserAuthenticationOptions.DefaultScheme)]
|
||||
public async Task<IActionResult> GetUserData(FGetUserDataRequest request)
|
||||
return Ok(new ClientResponse<FUpdateUserDataResult>
|
||||
{
|
||||
var userId = User.FindAuthUserId();
|
||||
var userData = await _userDataService.FindAsync(userId, request.PlayFabId, request.Keys);
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FUpdateUserDataResult
|
||||
{
|
||||
DataVersion = 0
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("GetUserData")]
|
||||
[Produces("application/json")]
|
||||
[Authorize(AuthenticationSchemes = UserAuthenticationOptions.DefaultScheme)]
|
||||
public async Task<IActionResult> GetUserData(FGetUserDataRequest request)
|
||||
{
|
||||
var userId = User.FindAuthUserId();
|
||||
var userData = await _userDataService.FindAsync(userId, request.PlayFabId, request.Keys);
|
||||
|
||||
return Ok(new ClientResponse<FGetUserDataResult>
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FGetUserDataResult
|
||||
{
|
||||
Data = userData,
|
||||
DataVersion = 0
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("GetUserReadOnlyData")]
|
||||
[Produces("application/json")]
|
||||
[Authorize(AuthenticationSchemes = UserAuthenticationOptions.DefaultScheme)]
|
||||
public IActionResult GetUserReadOnlyData(FGetUserDataRequest request)
|
||||
return Ok(new ClientResponse<FGetUserDataResult>
|
||||
{
|
||||
return Ok(new ClientResponse<FGetUserDataResult>
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FGetUserDataResult
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FGetUserDataResult
|
||||
{
|
||||
Data = new Dictionary<string, FUserDataRecord>(),
|
||||
DataVersion = 0
|
||||
}
|
||||
});
|
||||
}
|
||||
Data = userData,
|
||||
DataVersion = 0
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("GetUserInventory")]
|
||||
[Produces("application/json")]
|
||||
[Authorize(AuthenticationSchemes = UserAuthenticationOptions.DefaultScheme)]
|
||||
public IActionResult GetUserReadOnlyData(FGetUserInventoryRequest request)
|
||||
[HttpPost("GetUserReadOnlyData")]
|
||||
[Produces("application/json")]
|
||||
[Authorize(AuthenticationSchemes = UserAuthenticationOptions.DefaultScheme)]
|
||||
public IActionResult GetUserReadOnlyData(FGetUserDataRequest request)
|
||||
{
|
||||
return Ok(new ClientResponse<FGetUserDataResult>
|
||||
{
|
||||
return Ok(new ClientResponse<FGetUserInventoryResult>
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FGetUserDataResult
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FGetUserInventoryResult
|
||||
{
|
||||
Inventory = new List<FItemInstance>
|
||||
{
|
||||
// new FItemInstance
|
||||
// {
|
||||
// ItemId = "Helmet_03",
|
||||
// ItemInstanceId = "0102030405060708",
|
||||
// ItemClass = "Helmet",
|
||||
// PurchaseDate = DateTime.Now.AddDays(-1),
|
||||
// CatalogVersion = "StaticItems",
|
||||
// DisplayName = "Helmet",
|
||||
// UnitPrice = 0,
|
||||
// CustomData = new Dictionary<string, string>
|
||||
// {
|
||||
// ["insurance"] = "None",
|
||||
// ["mods"] = "{\"m\":[]}",
|
||||
// ["vanity_misc_data"] = "{\"v\":\"\",\"s\":\"\",\"l\":3,\"a\":1,\"d\":300}"
|
||||
// }
|
||||
// }
|
||||
},
|
||||
VirtualCurrency = new Dictionary<string, int>
|
||||
{
|
||||
["AE"] = 0,
|
||||
["AS"] = 0,
|
||||
["AU"] = int.MaxValue,
|
||||
["SC"] = int.MaxValue
|
||||
},
|
||||
VirtualCurrencyRechargeTimes = new Dictionary<string, FVirtualCurrencyRechargeTime>()
|
||||
}
|
||||
});
|
||||
}
|
||||
Data = new Dictionary<string, FUserDataRecord>(),
|
||||
DataVersion = 0
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("GetTitleData")]
|
||||
[Produces("application/json")]
|
||||
[Authorize(AuthenticationSchemes = UserAuthenticationOptions.DefaultScheme)]
|
||||
public IActionResult GetTitleData(FGetTitleDataRequest request)
|
||||
[HttpPost("GetUserInventory")]
|
||||
[Produces("application/json")]
|
||||
[Authorize(AuthenticationSchemes = UserAuthenticationOptions.DefaultScheme)]
|
||||
public IActionResult GetUserReadOnlyData(FGetUserInventoryRequest request)
|
||||
{
|
||||
return Ok(new ClientResponse<FGetUserInventoryResult>
|
||||
{
|
||||
return Ok(new ClientResponse<FGetTitleDataResult>
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FGetUserInventoryResult
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FGetTitleDataResult()
|
||||
Inventory = new List<FItemInstance>
|
||||
{
|
||||
Data = _titleDataService.Find(request.Keys)
|
||||
}
|
||||
});
|
||||
}
|
||||
// new FItemInstance
|
||||
// {
|
||||
// ItemId = "Helmet_03",
|
||||
// ItemInstanceId = "0102030405060708",
|
||||
// ItemClass = "Helmet",
|
||||
// PurchaseDate = DateTime.Now.AddDays(-1),
|
||||
// CatalogVersion = "StaticItems",
|
||||
// DisplayName = "Helmet",
|
||||
// UnitPrice = 0,
|
||||
// CustomData = new Dictionary<string, string>
|
||||
// {
|
||||
// ["insurance"] = "None",
|
||||
// ["mods"] = "{\"m\":[]}",
|
||||
// ["vanity_misc_data"] = "{\"v\":\"\",\"s\":\"\",\"l\":3,\"a\":1,\"d\":300}"
|
||||
// }
|
||||
// }
|
||||
},
|
||||
VirtualCurrency = new Dictionary<string, int>
|
||||
{
|
||||
["AE"] = 0,
|
||||
["AS"] = 0,
|
||||
["AU"] = int.MaxValue,
|
||||
["SC"] = int.MaxValue
|
||||
},
|
||||
VirtualCurrencyRechargeTimes = new Dictionary<string, FVirtualCurrencyRechargeTime>()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("GetTitleData")]
|
||||
[Produces("application/json")]
|
||||
[Authorize(AuthenticationSchemes = UserAuthenticationOptions.DefaultScheme)]
|
||||
public IActionResult GetTitleData(FGetTitleDataRequest request)
|
||||
{
|
||||
return Ok(new ClientResponse<FGetTitleDataResult>
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FGetTitleDataResult()
|
||||
{
|
||||
Data = _titleDataService.Find(request.Keys)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,306 +1,302 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
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;
|
||||
|
||||
namespace Prospect.Server.Api.Controllers
|
||||
namespace Prospect.Server.Api.Controllers;
|
||||
|
||||
[Route("CloudScript")]
|
||||
[ApiController]
|
||||
[Authorize(AuthenticationSchemes = EntityAuthenticationOptions.DefaultScheme)]
|
||||
public class CloudScriptController : Controller
|
||||
{
|
||||
[Route("CloudScript")]
|
||||
[ApiController]
|
||||
[Authorize(AuthenticationSchemes = EntityAuthenticationOptions.DefaultScheme)]
|
||||
public class CloudScriptController : Controller
|
||||
private readonly ILogger<CloudScriptController> _logger;
|
||||
|
||||
public CloudScriptController(ILogger<CloudScriptController> logger)
|
||||
{
|
||||
private readonly ILogger<CloudScriptController> _logger;
|
||||
|
||||
public CloudScriptController(ILogger<CloudScriptController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpPost("ExecuteFunction")]
|
||||
[Produces("application/json")]
|
||||
public IActionResult ExecuteFunction(FExecuteFunctionRequest request)
|
||||
[HttpPost("ExecuteFunction")]
|
||||
[Produces("application/json")]
|
||||
public IActionResult ExecuteFunction(FExecuteFunctionRequest request)
|
||||
{
|
||||
_logger.LogInformation("Executing function {Function}", request.FunctionName);
|
||||
|
||||
object result = null;
|
||||
|
||||
switch (request.FunctionName)
|
||||
{
|
||||
_logger.LogInformation("Executing function {Function}", request.FunctionName);
|
||||
|
||||
object result = null;
|
||||
|
||||
switch (request.FunctionName)
|
||||
{
|
||||
case "RequestMaintenanceModeState":
|
||||
result = new
|
||||
{
|
||||
enabled = false
|
||||
};
|
||||
break;
|
||||
case "GetCharacterVanity":
|
||||
result = new
|
||||
case "RequestMaintenanceModeState":
|
||||
result = new
|
||||
{
|
||||
enabled = false
|
||||
};
|
||||
break;
|
||||
case "GetCharacterVanity":
|
||||
result = new
|
||||
{
|
||||
userId = User.FindAuthUserId(),
|
||||
error = (object) null,
|
||||
returnVanity = new
|
||||
{
|
||||
userId = User.FindAuthUserId(),
|
||||
error = (object) null,
|
||||
returnVanity = new
|
||||
head_item = 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
|
||||
},
|
||||
id = "Black02M_Head1",
|
||||
materialIndex = 0,
|
||||
},
|
||||
userId = User.FindAuthUserId(),
|
||||
error = ""
|
||||
};
|
||||
break;
|
||||
case "GetPlayersInventoriesLimits":
|
||||
result = new
|
||||
{
|
||||
success = true,
|
||||
entries = new []
|
||||
boots_item = new
|
||||
{
|
||||
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(),
|
||||
inventoryStashLimit = 75,
|
||||
inventoryBagLimit = 300,
|
||||
inventorySafeLimit = 5
|
||||
}
|
||||
kit = "",
|
||||
shield = "",
|
||||
helmet = "",
|
||||
weaponOne = "",
|
||||
weaponTwo = "",
|
||||
bag = "",
|
||||
bagItemsAsJsonStr = "",
|
||||
safeItemsAsJsonStr = ""
|
||||
},
|
||||
items = Array.Empty<object>()
|
||||
}
|
||||
};
|
||||
break;
|
||||
case "UpdateRetentionBonus":
|
||||
result = new
|
||||
}
|
||||
};
|
||||
break;
|
||||
case "RequestFactionProgression":
|
||||
result = new
|
||||
{
|
||||
factions = new []
|
||||
{
|
||||
playerData = new
|
||||
new
|
||||
{
|
||||
daysClaimed = 0,
|
||||
lastClaimTime = new
|
||||
{
|
||||
seconds = 1635033600
|
||||
}
|
||||
factionId = "ICA",
|
||||
currentProgression = 0
|
||||
},
|
||||
userId = User.FindAuthUserId(),
|
||||
error = (object)null
|
||||
};
|
||||
break;
|
||||
case "GetCraftingInProgressData":
|
||||
result = new FYGetCraftingInProgressDataResult
|
||||
{
|
||||
UserId = User.FindAuthUserId(),
|
||||
Error = null,
|
||||
ItemCurrentlyBeingCrafted = new FYItemCurrentlyBeingCrafted
|
||||
new
|
||||
{
|
||||
ItemId = null,
|
||||
ItemRarity = -1,
|
||||
PurchaseAmount = -1,
|
||||
UtcTimestampWhenCraftingStarted = new FYTimestamp
|
||||
{
|
||||
Seconds = 0
|
||||
}
|
||||
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 "RequestPlayerContracts":
|
||||
result = new FYGetPlayerContractsResult
|
||||
}
|
||||
};
|
||||
break;
|
||||
case "UpdateRetentionBonus":
|
||||
result = new
|
||||
{
|
||||
playerData = new
|
||||
{
|
||||
UserId = User.FindAuthUserId(),
|
||||
Error = null,
|
||||
ActiveContracts = new List<FYActiveContractPlayerData>(),
|
||||
FactionsContracts = new FYFactionsContractsData
|
||||
daysClaimed = 0,
|
||||
lastClaimTime = new
|
||||
{
|
||||
Boards = new List<FYFactionContractsData>
|
||||
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
|
||||
{
|
||||
new FYFactionContractsData
|
||||
FactionId = "ICA",
|
||||
Contracts = new List<FYFactionContractData>
|
||||
{
|
||||
FactionId = "ICA",
|
||||
Contracts = new List<FYFactionContractData>
|
||||
new 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>
|
||||
ContractId = "NEW-Easy-ICA-Gather-1",
|
||||
ContractIsLockedDueToLowFactionReputation = false
|
||||
},
|
||||
new 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>
|
||||
ContractId = "NEW-Medium-ICA-Uplink-1",
|
||||
ContractIsLockedDueToLowFactionReputation = false
|
||||
},
|
||||
new 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
|
||||
}
|
||||
ContractId = "NEW-Hard-ICA-Uplink-1",
|
||||
ContractIsLockedDueToLowFactionReputation = false
|
||||
}
|
||||
}
|
||||
},
|
||||
LastBoardRefreshTimeUtc = new FYTimestamp
|
||||
new FYFactionContractsData
|
||||
{
|
||||
Seconds = (int)DateTimeOffset.UtcNow.ToUnixTimeSeconds()
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
RefreshHours24UtcFromBackend = 12
|
||||
};
|
||||
break;
|
||||
default:
|
||||
_logger.LogWarning("Missing function {Function}", request.FunctionName);
|
||||
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
|
||||
result = new
|
||||
{
|
||||
ExecutionTimeMilliseconds = 12,
|
||||
FunctionName = request.FunctionName,
|
||||
FunctionResult = result
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
return Ok(new ClientResponse<FExecuteFunctionResult>
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FExecuteFunctionResult
|
||||
{
|
||||
ExecutionTimeMilliseconds = 12,
|
||||
FunctionName = request.FunctionName,
|
||||
FunctionResult = result
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user