Пример #1
0
 private void GetTarget(IReadOnlyList <string> currentLine, SkillDto skill)
 {
     skill.TargetType  = byte.Parse(currentLine[2]);
     skill.HitType     = byte.Parse(currentLine[3]);
     skill.Range       = byte.Parse(currentLine[4]);
     skill.TargetRange = byte.Parse(currentLine[5]);
 }
Пример #2
0
 public static Skill ToLocal(this SkillDto skillDto)
 {
     return new Skill(skillDto.ID)
     {
         Name = skillDto.Name
     };
 }
        public async Task <Guid> AddSkillToEmployeeAsync(Guid employeeID, SkillDto skillDto)
        {
            var isSkillAssigned = await _skillAssigmentRepository.EmployeeHasSkillAsync(employeeID, skillDto.ID);

            if (isSkillAssigned)
            {
                throw new CustomEntryExistsException($"Skill {skillDto.ID} is already assigned to Employee {employeeID}");
            }

            var employeeExists = await _employeeRepository.ExistsAsync(employeeID);

            if (!employeeExists)
            {
                throw new CustomNotFoundException($"Employee {employeeID} does not exist");
            }

            var skill = await _skillRepository.GetSingleOrDefaultSkillAsync(skillDto.ID);

            if (skill == null)
            {
                skill = _mapper.Map <SkillDto, Skill>(skillDto);
                _skillAssigmentRepository.AddNewSkillToEmployee(employeeID, skill);
            }
            else
            {
                _skillAssigmentRepository.AddSkillToEmployee(employeeID, skillDto.ID);
            }

            await _skillAssigmentRepository.CommitAsync();

            return(skill.ID);
        }
Пример #4
0
 private void GetEffect(string[] currentLine, SkillDto skill)
 {
     skill.CastEffect      = short.Parse(currentLine[3]);
     skill.CastAnimation   = short.Parse(currentLine[4]);
     skill.Effect          = short.Parse(currentLine[5]);
     skill.AttackAnimation = short.Parse(currentLine[6]);
 }
Пример #5
0
        // helpers

        public static ActorDetailsDto BuildPlayerData(ParsedEvtcLog log, AbstractSingleActor actor, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Buff> usedBuffs)
        {
            var dto = new ActorDetailsDto
            {
                DmgDistributions        = new List <DmgDistributionDto>(),
                DmgDistributionsTargets = new List <List <DmgDistributionDto> >(),
                DmgDistributionsTaken   = new List <DmgDistributionDto>(),
                BoonGraph  = new List <List <BuffChartDataDto> >(),
                Rotation   = new List <List <object[]> >(),
                Food       = FoodDto.BuildFoodData(log, actor, usedBuffs),
                Minions    = new List <ActorDetailsDto>(),
                DeathRecap = DeathRecapDto.BuildDeathRecap(log, actor)
            };

            foreach (PhaseData phase in log.FightData.GetPhases(log))
            {
                dto.Rotation.Add(SkillDto.BuildRotationData(log, actor, phase, usedSkills));
                dto.DmgDistributions.Add(DmgDistributionDto.BuildFriendlyDMGDistData(log, actor, null, phase, usedSkills, usedBuffs));
                var dmgTargetsDto = new List <DmgDistributionDto>();
                foreach (AbstractSingleActor target in phase.Targets)
                {
                    dmgTargetsDto.Add(DmgDistributionDto.BuildFriendlyDMGDistData(log, actor, target, phase, usedSkills, usedBuffs));
                }
                dto.DmgDistributionsTargets.Add(dmgTargetsDto);
                dto.DmgDistributionsTaken.Add(DmgDistributionDto.BuildDMGTakenDistData(log, actor, phase, usedSkills, usedBuffs));
                dto.BoonGraph.Add(BuffChartDataDto.BuildBoonGraphData(log, actor, phase, usedBuffs));
            }
            foreach (KeyValuePair <long, Minions> pair in actor.GetMinions(log))
            {
                dto.Minions.Add(BuildFriendlyMinionsData(log, actor, pair.Value, usedSkills, usedBuffs));
            }

            return(dto);
        }
Пример #6
0
        public IEnumerable <SkillDto> GetAllSkills()
        {
            List <SkillDto> skillList = new List <SkillDto>();

            try {
                var getSkills = Context.Skills.ToList();
                foreach (Skills skill in getSkills)
                {
                    SkillDto singleSkill = new SkillDto();
                    singleSkill.SkillId   = skill.SkillID;
                    singleSkill.SkillName = skill.SkillName;

                    skillList.Add(singleSkill);
                }
            }
            catch (SqlException sqlExp)
            {
                throw sqlExp;
            }
            catch (NullReferenceException expNull)
            {
                throw expNull;
            }
            return(skillList);
        }
        public async Task <IActionResult> PutSkill(int id, SkillDto skillDto)
        {
            var skill = _mapper.Map <Skill>(skillDto);

            if (id != skill.Id)
            {
                return(BadRequest());
            }

            skill.SkillCategory = null;

            _context.SetModified(skill);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!await SkillExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #8
0
        public async Task <IActionResult> PutSkill(int id, SkillDto skill)
        {
            // Create response object
            CommonResponse <SkillDto> respons = new CommonResponse <SkillDto>();

            if (id != skill.Id)
            {
                respons.Error = new Error {
                    Status = 400, Message = "There was a mismatch with the provided id and the object."
                };
                return(BadRequest(respons));
            }
            _context.Entry(_mapper.Map <Skill>(skill)).State = EntityState.Modified;
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SkillExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            return(NoContent());
        }
Пример #9
0
 public Skill map(SkillDto dto)
 {
     return(new Skill()
     {
         ID = dto.ID, Name = dto.Name
     });
 }
Пример #10
0
 private void GetFCombo(string[] currentLine, SkillDto skill)
 {
     for (int i = 3; i < currentLine.Length - 4; i += 3)
     {
         /*
          * var comb = new ComboDTO
          * {
          *  SkillVNum = skill.SkillVNum,
          *  Hit = short.Parse(currentLine[i]),
          *  Animation = short.Parse(currentLine[i + 1]),
          *  Effect = short.Parse(currentLine[i + 2])
          * };
          *
          * if (comb.Hit == 0 && comb.Animation == 0 && comb.Effect == 0)
          * {
          *  continue;
          * }
          *
          * if (!DaoFactory.ComboDao.LoadByVNumHitAndEffect(comb.SkillVNum, comb.Hit, comb.Effect).Any())
          * {
          *  combo.Add(comb);
          * }
          */
     }
 }
Пример #11
0
 private void SyncSkillStop(SkillDto dto)
 {
     if (dto == null)
     {
         return;
     }
     Dispatch(AreaCode.SKILL, SkillEvents.SKILL_SYNC_STOP, dto);
 }
Пример #12
0
 private static void GetTypeData(IReadOnlyList <string> currentLine, SkillDto skill)
 {
     skill.SkillType = byte.Parse(currentLine[2]);
     skill.CastId    = short.Parse(currentLine[3]);
     skill.Class     = byte.Parse(currentLine[4]);
     skill.Type      = byte.Parse(currentLine[5]);
     skill.Element   = byte.Parse(currentLine[7]);
 }
Пример #13
0
 public IActionResult Post([FromBody] SkillDto model)
 {
     if (ModelState.IsValid)
     {
         //repository.AddSkill(model);
     }
     return(BadRequest(ModelState));
 }
Пример #14
0
        public async Task <ActionResult <SkillDto> > Update([FromBody] SkillDto content)
        {
            _logger.LogInformation("SkillsController: Preceding update request");
            var result = await _skillRepository.Update(content);

            _logger.LogInformation("SkillsController: Updated results");
            return(Ok(result));
        }
Пример #15
0
 private void ReceiveStopSkill(SkillDto dto)
 {
     if (dto == null)
     {
         return;
     }
     Dispatch(AreaCode.GAME, GameEvent.GAME_STOPSKILL, dto);
 }
Пример #16
0
        public async Task <Skill> AddOrUpdate(SkillDto entry)
        {
            var skill = _mapper.Map <SkillDto, Skill>(entry);

            _service.AddOrUpdate(skill);
            await _unitOfWok.CommitAsync();

            return(skill);
        }
Пример #17
0
 private static void GetData(IReadOnlyList <string> currentLine, SkillDto skill)
 {
     skill.UpgradeSkill = short.Parse(currentLine[2]);
     skill.UpgradeType  = short.Parse(currentLine[3]);
     skill.CastTime     = short.Parse(currentLine[6]);
     skill.Cooldown     = short.Parse(currentLine[7]);
     skill.MpCost       = short.Parse(currentLine[10]);
     skill.ItemVNum     = short.Parse(currentLine[12]);
 }
Пример #18
0
    /// <summary>
    /// 同步玩家释放技能
    /// </summary>
    private void SyncSkill(SkillDto dto)
    {
        if (dto == null)
        {
            return;
        }
        SkillMesg skillMesg = new SkillMesg(dto.Account, (SkillType)dto.SkillType, userGameObjDict[dto.Account]);

        Dispatch(AreaCode.SKILL, SkillEvents.SKILL_SYNC_SKILL, skillMesg);
    }
Пример #19
0
 public ArmySkillBase()
 {
     canPerTurn      = false;
     isPassive       = false;
     isNeedOtherDead = false;
     isUsed          = false;
     isBind          = false;
     skillDto        = new SkillDto();
     socketMsg       = new SocketMsg();
 }
Пример #20
0
        public async Task <Guid> CreateSkillAsync(SkillDto skillDto)
        {
            var skill = _mapper.Map <SkillDto, Skill>(skillDto);

            _skillRepository.CreateSkill(skill);

            await _skillRepository.CommitAsync();

            return(skill.ID);
        }
Пример #21
0
        public async Task <IActionResult> Update(Guid skillId, [FromBody] SkillDto skillDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var result = await _skillService.UpdateSkill(skillId, skillDto);

            return(Ok(result));
        }
Пример #22
0
        public async Task <IActionResult> UpdateSkill([FromBody] SkillDto skill)
        {
            if (!Enum.IsDefined(typeof(SkillType), skill.Type))
            {
                return(BadRequest());
            }
            await _skillService.AddOrUpdate(skill);

            return(NoContent());
        }
Пример #23
0
        public void Remove(SkillDto skillDto)
        {
            var skill = _unitOfWork.Skills.GetById(skillDto.Id);

            if (skill != null)
            {
                _unitOfWork.Skills.Delete(skill);
                _unitOfWork.Save();
            }
        }
Пример #24
0
        private ProjectDto Map(Project project)
        {
            if (project == null)
            {
                return(null);
            }

            var projectDto = new ProjectDto();

            projectDto.Id               = project.Id;
            projectDto.Name             = project.Name;
            projectDto.DXCServices      = project.DXCServices;
            projectDto.Facts            = project.Facts;
            projectDto.DXCSolution      = project.DXCSolution;
            projectDto.Betriebsleistung = project.Betriebsleistung;

            if (project.Customer != null)
            {
                var dc = new CustomerDto();
                dc.Id               = project.Customer.Id;
                dc.Name             = project.Customer.Name;
                projectDto.Customer = dc;
            }
            if (project.Industry != null)
            {
                var di = new IndustryDto();
                di.Id               = project.Industry.Id;
                di.Name             = project.Industry.Name;
                projectDto.Industry = di;
            }
            foreach (Region r in project.Regions)
            {
                var dr = new RegionDto();
                dr.Id          = r.Id;
                dr.Name        = r.Name;
                dr.KeyNamePath = r.KeyNamePath;
                projectDto.Regions.Add(dr);
            }
            foreach (Offering o in project.Offerings)
            {
                var doff = new OfferingDto();
                doff.Id          = o.Id;
                doff.Name        = o.Name;
                doff.KeyNamePath = o.KeyNamePath;
                projectDto.Offerings.Add(doff);
            }
            foreach (Skill s in project.Skills)
            {
                var ds = new SkillDto();
                ds.Id   = s.Id;
                ds.Name = s.Name;
                projectDto.Skills.Add(ds);
            }
            return(projectDto);
        }
Пример #25
0
        public IActionResult OnGet(int skillId)
        {
            Skill = repository.GetSkillById(skillId);

            if (Skill == null)
            {
                return(RedirectToPage("./NotFound"));
            }

            return(Page());
        }
Пример #26
0
        public async Task <ActionResult <SkillDto> > GetSkill(ulong id)
        {
            SkillDto skillDto = await _business.GetFirstOrDefault <SkillDto>((skill => skill.Id == id));

            if (skillDto == null)
            {
                return(NotFound($"A skill with id \"{id}\" was not found."));
            }

            return(Ok(skillDto));
        }
Пример #27
0
 public static string GetCssClass(this SkillDto skill,
                                  string className, string relevantCssClass = "font-weight-bolder")
 {
     if (skill == null)
     {
         return(string.Empty);
     }
     return(skill.IsRelevant
         ? $"{className} {relevantCssClass}"
         : className);
 }
Пример #28
0
        public async Task <IActionResult> CreateSkill([FromBody] SkillDto skill)
        {
            if (!Enum.IsDefined(typeof(SkillType), skill.Type))
            {
                return(BadRequest());
            }

            var createdSkill = await _skillService.AddOrUpdate(skill);

            return(CreatedAtRoute("SkillById", new { id = createdSkill.Id }, createdSkill));
        }
Пример #29
0
        public async Task <IActionResult> Put(Guid id, [FromBody] SkillDto skillDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await _skillsService.UpdateSkillAsync(id, skillDto);

            return(new NoContentResult());
        }
Пример #30
0
        public void Update(SkillDto skillDto)
        {
            var skill = _unitOfWork.Skills.GetById(skillDto.Id);

            if (skill != null)
            {
                skill.Name       = skillDto.Name;
                skill.CategoryId = skillDto.CategoryId;
                _unitOfWork.Save();
            }
        }
Пример #31
0
 public SkillDto selectSkillById(SkillDto obj)
 {
     try
     {
         ISkillRecruiteeSvc svc = (ISkillRecruiteeSvc)this.getService(typeof(ISkillRecruiteeSvc).Name);
         return svc.selectSkillById(obj);
     }
     catch (ServiceLoadException ex)
     {
         return null;
     }
 }
Пример #32
0
 public Boolean deleteSkill(SkillDto obj)
 {
     try
     {
         ISkillRecruiteeSvc svc = (ISkillRecruiteeSvc)this.getService(typeof(ISkillRecruiteeSvc).Name);
         return svc.deleteSkill(obj);
     }
     catch (ServiceLoadException ex)
     {
         return false;
     }
 }
        public SkillDto selectSkillById(SkillDto obj)
        {
            NewRecruiteeService.ServiceWCFClient svc = new NewRecruiteeService.ServiceWCFClient();

            try
            {
                return svc.selectSkillById(obj);
            }
            catch (Exception ex)
            {
                return null;
            }
        }
Пример #34
0
        public Boolean updateSkill(SkillDto obj)
        {
            try
            {
                ISkillJobSvc svc = (ISkillJobSvc)this.getService(typeof(ISkillJobSvc).Name);
                return svc.updateSkill(obj);

            }
            catch (ServiceLoadException ex)
            {
                return false;
            }
        }
 public Boolean insertSkill(SkillDto obj)
 {
     using (NewRecruiteeService.ServiceWCFClient svc = new NewRecruiteeService.ServiceWCFClient())
     {
         try
         {
             return svc.insertSkill(obj);
         }
         catch (Exception ex)
         {
             return false;
         }
     }
 }
        public Boolean deleteSkill(SkillDto obj)
        {
            using (NewRecruiteeService.ServiceWCFClient svc = new NewRecruiteeService.ServiceWCFClient())
            {
                try
                {
                    SkillDto rec = svc.selectSkillById(obj);

                    if (rec != null)
                    {
                        return svc.deleteSkill(obj);
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
Пример #37
0
        public Boolean updateSkill(SkillDto obj)
        {
            using (NewJobService.ServiceWCFClient svc = new NewJobService.ServiceWCFClient())
            {
                try
                {
                    SkillDto skill = svc.selectSkillById(obj);

                    if (skill != null)
                    {
                        return svc.updateSkill(obj);
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }