Exemplo n.º 1
0
        //TODO: Secure this so only authenticated zoneservers who own a claimed session of for this character can update their data.
        //[ProducesJson]
        //[HttpPatch("{id}/UpdateData")]
        //[NoResponseCache]
        private async Task <IActionResult> UpdatePlayerData([FromRoute(Name = "id")] int characterId,
                                                            [FromBody][NotNull] CharacterDataInstance requestModel,
                                                            [FromServices][NotNull] ICharacterDataRepository characterDataRepository)
        {
            CharacterDataModel dataModel = await characterDataRepository.RetrieveAsync(characterId);

            //TODO: Make this updatable
            dataModel.ExperiencePoints = requestModel.Experience;

            await characterDataRepository.UpdateAsync(characterId, dataModel);

            return(Ok());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GetCharacterData([FromRoute(Name = "id")] int characterId,
                                                           [FromServices][NotNull] ICharacterDataRepository characterDataRepository)
        {
            //TODO: We should only let the user themselves get their own character's data OR zoneservers who have a claimed session.
            ProjectVersionStage.AssertBeta();

            if (!await characterDataRepository.ContainsAsync(characterId))
            {
                return(BuildFailedResponseModel(CharacterDataQueryReponseCode.CharacterNotFound));
            }

            CharacterDataModel characterData = await characterDataRepository.RetrieveAsync(characterId);

            return(BuildSuccessfulResponseModel(new CharacterDataInstance(characterData.ExperiencePoints)));
        }