Esempio n. 1
0
        private SkillPch2 MapPch2(SkillDataDto data)
        {
            int hitTime      = CalculateHitTime(data.HitTime, data.CoolTime);
            int cooldownTime = CalculateReuseCooldown(data.ReuseDelay, data.HitTime, data.HitCancelTime, data.CoolTime);

            int targetTypeId   = _manualPchService.GetTargetId(data.TargetType);
            int attributeId    = _manualPchService.GetAttributeId(data.Attribute);
            int abnormalTypeId = _manualPchService.GetAbnormalId(data.AbnormalType);

            return(new SkillPch2
            {
                Id = data.SkillId * SkillContants.SkillIdMultiplierV1 + data.Level,
                CastRange = data.CastRange,
                HpConsume = data.HpConsume,
                MpConsume2 = data.MpConsume2,
                TargetTypeId = targetTypeId,
                EffectPoint = data.EffectPoint,
                AttributeId = attributeId,
                AbnormalTypeId = abnormalTypeId,
                AbnormalLevel = data.AbnormalLevel,
                HitTime = hitTime,
                ReuseCooldown = cooldownTime,
                IsMagic = data.IsMagic
            });
        }
Esempio n. 2
0
        public SkillDataDto Parse(string record)
        {
            ParsedData   data         = ParseService.Parse(record);
            SkillDataDto skillDataDto = _mapper.Map(data);

            return(skillDataDto);
        }
Esempio n. 3
0
 private SkillPch Map(SkillDataDto data)
 {
     return(new SkillPch
     {
         Name = data.Name,
         Id = data.SkillId * SkillContants.SkillIdMultiplierV1 + data.Level
     });
 }
Esempio n. 4
0
        public ActionResult Save(SkillDataDto data)
        {
            var context = new ContextManager();

            //Setting data from result
            data.SelectedItem.SkillModifier = context.Get <Ability>(data.SelectedAbility.ToGuid().GetValueOrDefault());
            context.CreateOrUpdate(data.SelectedItem);
            return(RedirectToAction("Index", "Skill", new { id = data.SelectedItem.ID }));
            //return View("Creator/Skill", "CreatorLayoutPage", GetSkills(data.SelectedItem.ID));
        }
Esempio n. 5
0
        public ServiceResult Generate(string SkillDataDir, string SkillDataFile, IProgress <int> progress)
        {
            string inNpcdataFile = Path.Combine(SkillDataDir, SkillDataFile);
            string outPchFile    = Path.Combine(SkillDataDir, SkillContants.SkillPchFileName);
            string outPch2File   = Path.Combine(SkillDataDir, SkillContants.SkillPch2FileName);
            string outPch3File   = Path.Combine(SkillDataDir, SkillContants.SkillPch3FileName);

            IEnumerable <string> rawNpcData      = FileUtils.Read(inNpcdataFile);
            IEnumerable <string> collectedRecord = _skillDataService.Collect(rawNpcData);
            List <SkillDataDto>  skillData       = _skillDataService.Parse(collectedRecord).ToList();

            StreamWriter sw2 = new StreamWriter(outPch2File, false, Encoding.Unicode);

            using (StreamWriter sw = new StreamWriter(outPchFile, false, Encoding.Unicode))
            {
                for (var index = 0; index < skillData.Count; index++)
                {
                    SkillDataDto npcDataDto = skillData[index];
                    SkillPch     pch        = Map(npcDataDto);
                    SkillPch2    pch2       = MapPch2(npcDataDto);

                    sw.WriteLine(Print(pch));
                    sw2.WriteLine(Print(pch2));

                    progress.Report((int)(index * 100 / skillData.Count));
                }
            }

            sw2.Close();
            sw2.Dispose();
            File.Create(outPch3File).Close();

            return(new ServiceResult {
                HasErrors = false
            });
        }