Ejemplo n.º 1
0
        protected override void HandleMessage(EntityActorMessageContext messageContext, DefaultEntityActorStateContainer state, EntityActorInitializationSuccessMessage message)
        {
            //We should send ourselves the level initialization message because it takes care of stats
            CharacterDataInstance     entity = InitialCharacterDataMappable.RetrieveEntity(state.EntityGuid);
            IEntityDataFieldContainer entityDataFieldContainer = state.EntityData;

            entityDataFieldContainer.SetFieldValue((int)PlayerObjectField.PLAYER_TOTAL_EXPERIENCE, entity.Experience);

            //Set the level from the initial experience data.
            messageContext.Entity.Tell(new SetEntityActorLevelMessage(LevelStrategy.ComputeLevelFromExperience(entity.Experience)));
        }
Ejemplo n.º 2
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());
        }
Ejemplo n.º 3
0
        private void InitializeCharacterLevel([NotNull] NetworkEntityGuid guid, [NotNull] IUICharacterSlot button)
        {
            if (guid == null)
            {
                throw new ArgumentNullException(nameof(guid));
            }
            if (button == null)
            {
                throw new ArgumentNullException(nameof(button));
            }

            CharacterDataInstance dataInstance = InitialCharacterDataMappable.RetrieveEntity(guid);

            button.LevelText.Text = $"Level {LevelStrategy.ComputeLevelFromExperience(dataInstance.Experience).ToString()}";
        }