public async Task <Unit> Handle(ShowSkillDetailCommand command, CancellationToken cancellationToken) { var playerId = command.PlayerId; var skillId = command.MySkillId; var player = await _playerDomainService.Get(playerId); if (player == null) { return(Unit.Value); } var playerSkill = await _playerSkillDomainService.Get(skillId); if (playerSkill == null) { return(Unit.Value); } var skill = await _skillDomainService.Get(playerSkill.SkillId); if (skill == null) { return(Unit.Value); } var skillModel = _mapper.Map <SkillModel>(skill); skillModel.PlayerSkillId = playerSkill.Id; skillModel.Level = playerSkill.Level; skillModel.Exp = playerSkill.Exp; await _mudProvider.ShowSkill(playerId, skillModel); return(Unit.Value); }
public async Task ShowSkillDetail(SkillDetailAction questAction) { var result = await DoCommand(async() => { var playerId = _account.PlayerId; var command = new ShowSkillDetailCommand(playerId, questAction.PlayerSkillId); await _bus.SendCommand(command); }); }
public async Task <Unit> Handle(ShowSkillDetailCommand command, CancellationToken cancellationToken) { var playerId = command.PlayerId; var skillId = command.MySkillId; var type = command.Type; var player = await _playerDomainService.Get(playerId); if (player == null) { return(Unit.Value); } if (type == 1) { var playerSkill = await _playerSkillDomainService.Get(skillId); if (playerSkill == null) { return(Unit.Value); } var skill = await _skillDomainService.Get(playerSkill.SkillId); if (skill == null) { return(Unit.Value); } var skillModel = _mapper.Map <SkillModel>(skill); skillModel.ObjectSkillId = playerSkill.Id; skillModel.Level = playerSkill.Level; skillModel.Exp = playerSkill.Exp; skillModel.ObjectType = 1; await _mudProvider.ShowSkill(playerId, skillModel); } else { var npcSkill = await _npcSkillDomainService.Get(skillId); if (npcSkill == null) { return(Unit.Value); } var skill = await _skillDomainService.Get(npcSkill.SkillId); if (skill == null) { return(Unit.Value); } var skillModel = _mapper.Map <SkillModel>(skill); skillModel.ObjectSkillId = npcSkill.Id; skillModel.Level = npcSkill.Level; skillModel.Exp = npcSkill.Exp; skillModel.ObjectType = 2; await _mudProvider.ShowSkill(playerId, skillModel); } return(Unit.Value); }