Example #1
0
 public static void Postfix(SkillVM __instance, PerkObject perk, ref bool __result)
 {
     if (Settings.Instance.Enabled && Settings.Instance.CharacterUpgrades)
     {
         __result = perk.RequiredSkillValue <= __instance.Level;
     }
 }
Example #2
0
 public HeroVM GetHero(int id)
 {
     using (Repository repo = new Repository(new XolarDatabase()))
     {
         var    hero   = repo.GetHero(id);
         HeroVM result = new HeroVM();
         result.Id          = hero.Id;
         result.Name        = hero.Name;
         result.Rarity      = hero.Rarity.Description;
         result.ImgUrl      = hero.Picture.Source;
         result.Stars       = hero.Stars;
         result.Level       = hero.Level;
         result.Description = hero.Description;
         result.Skills      = new List <SkillVM>();
         foreach (Xolartek.Core.Fortnite.SubClass sub in repo.GetSubClass(id))
         {
             SkillVM skill = new SkillVM();
             skill.id          = sub.Id;
             skill.name        = sub.Skill.Name;
             skill.heroname    = result.Name;
             skill.classname   = sub.Name;
             skill.description = sub.Skill.Description;
             skill.issupport   = sub.IsSupport;
             skill.istactical  = sub.IsTactical;
             result.Skills.Add(skill);
         }
         return(result);
     }
 }
Example #3
0
        public ActionResult Create(SkillVM sk)
        {
            HttpClient Client = new HttpClient();

            Client.BaseAddress = new Uri("http://localhost:18080");
            Client.PostAsJsonAsync <SkillVM>("map-web/rest/skills", sk).ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode());
            return(RedirectToAction("Index"));
        }
Example #4
0
        public IHttpActionResult AddSkills(SkillVM model)
        {
            var response           = new ApiResult <SkillVM>();
            var currentApplicantId = (Membership.GetUser(User.Identity.Name) as CustomMembershipUser).ApplicantId;


            if (currentApplicantId == null)
            {
                return(Unauthorized());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest("Incorrect data posted, please check form and try again"));
            }

            if (model.Id > 0)
            {
                var skill = db.Skills.Where(x => x.Id == model.Id).FirstOrDefault();
                if (skill == null)
                {
                    return(NotFound());
                }
                else
                {
                    skill.SkillTitle = model.SkillTitle;
                    skill.Skilllevel = model.Skilllevel;
                    //skill.FromDate = model.FromDate;
                    //skill.ToDate = model.ToDate;
                    //skill.Qualification = model.Qualification;
                    db.SaveChanges();
                }
                response.Message = "Updated successfully";
            }
            else
            {
                var skill = new Skill
                {
                    ApplicantId = (int)currentApplicantId,
                    SkillTitle  = model.SkillTitle,
                    Skilllevel  = model.Skilllevel,
                    //FromDate = model.FromDate,
                    //ToDate = model.ToDate,
                    //Qualification = model.Qualification
                };

                db.Skills.Add(skill);
                db.SaveChanges();
                model.Id = skill.Id;

                response.Message = "Added successfully";
            }


            response.Data     = model;
            response.HasError = false;
            return(Ok(response));
        }
Example #5
0
        public static SkillVM SkillFullData()
        {
            SkillVM skillVM = new SkillVM();

            Console.WriteLine("Write the name of skill");
            skillVM.Name = Console.ReadLine();

            return(skillVM);
        }
        public async Task <IActionResult> CreateSkill(SkillVM skillVM)
        {
            if (!(ModelState.IsValid && await skillService.GetUniqueName(skillVM.Name)))
            {
                ModelState.AddModelError("", "Invalid name or skill already exists");
                return(RedirectToAction("SkillList"));
            }
            var mappedSkill = mapper.Map <SkillVM, Skill>(skillVM);
            await skillService.AddSkill(mappedSkill);

            return(RedirectToAction("SkillList"));
        }
Example #7
0
        public ActionResult AddSkill(SkillVM e, int id)
        {
            Candidate c  = candidateService.GetById(id);
            Skill     e1 = new Skill();

            e1.Designation = e.Designation;
            e1.rating      = e.rating;
            e1.CandidateId = c.CandidateId;
            c.Skills.Add(e1);
            candidateService.Update(c);
            candidateService.Commit();
            return(RedirectToAction("Details", new { id }));
        }
        static void Postfix(SkillVM __instance, ref int ____fullLearningRateLevel, CharacterVM ____developerVM)
        {
            int attr = ____developerVM.GetCurrentAttributePoint(__instance.Skill.CharacterAttributesEnum);

            ____fullLearningRateLevel = (int)(__instance.Level + __instance.CurrentFocusLevel * Reworked_SkillsSubModule.__FOCUS_VALUE + attr * Reworked_SkillsSubModule.__ATTR_VALUE);
            TextObject attrname = CharacterAttributes.GetCharacterAttribute(__instance.Skill.CharacterAttributeEnum).Name;

            __instance.LearningRateTooltip  = new BasicTooltipViewModel(() => GetLearningRateTooltip(attr, __instance.CurrentFocusLevel, __instance.Level, ____developerVM.Hero.CharacterObject.Level, attrname));
            __instance.LearningLimitTooltip = new BasicTooltipViewModel(() => {
                Patch4.SKILLLEVEL = __instance.Level;
                return(GetLearningLimitTooltip(attr, __instance.CurrentFocusLevel, attrname));
            });
        }
        public static SkillVM Create(SkillResource resource)
        {
            Func <SkillVM> creator;

            if (!_creators.TryGetValue(resource.GetType(), out creator))
            {
                throw new NotSupportedException(String.Format("{0} is not supported.", resource.GetType().Name));
            }

            SkillVM viewModel = creator();

            viewModel.Model = resource;
            return(viewModel);
        }
Example #10
0
        public static SkillVM CurrentSkill(SkillVM __result, CharacterVM __instance)
        {
            if (__result == null)
            {
                return(__result);
            }
            var bonuses     = new CharacterAttributeBonuses(__instance.Hero.CharacterObject);
            var lerningRate = __result.LearningRate;
            var bonus       = lerningRate * bonuses.XPMultiplier;

            __result.CurrentLearningRateText = "Learning Rate: x " + (lerningRate + bonus).ToString("F2");

            return(__result);
        }
Example #11
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Name,Description")] SkillVM skillVM)
        {
            if (ModelState.IsValid)
            {
                //Map the modelView to Model
                Skill skill = skillVM;
                db.Entry(skill).State = EntityState.Modified;

                //Call the EF to save chages
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(skillVM));
        }
            static void Postfix(SkillVM __instance, ref int ____fullLearningRateLevel, CharacterVM ____developerVM)
            {
                int attr = ____developerVM.GetCurrentAttributePoint(__instance.Skill.CharacterAttributeEnum);

                ____fullLearningRateLevel = (int)(__instance.Level + __instance.CurrentFocusLevel * Reworked_SkillsSubModule.__FOCUS_VALUE + attr * Reworked_SkillsSubModule.__ATTR_VALUE);
                __instance.OnPropertyChanged(nameof(__instance.FullLearningRateLevel));

                __instance.SkillEffects.Clear();
                int skillValue = (int)(__instance.Level + __instance.CurrentFocusLevel * Reworked_SkillsSubModule.__FOCUS_VALUE + attr * Reworked_SkillsSubModule.__ATTR_VALUE);

                foreach (SkillEffect effect in DefaultSkillEffects.GetAllSkillEffects().Where <SkillEffect>((Func <SkillEffect, bool>)(x => ((IEnumerable <SkillObject>)x.EffectedSkills).Contains <SkillObject>(__instance.Skill))))
                {
                    __instance.SkillEffects.Add(new BindingListStringItem(CampaignUIHelper.GetSkillEffectText(effect, skillValue)));
                }
            }
Example #13
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Name,Description")] SkillVM skillVM)
        {
            if (ModelState.IsValid)
            {
                //Map to Model
                Skill skill = skillVM;
                db.Skills.Add(skill);

                //Call the EF to save chages
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(skillVM));
        }
        public async Task <ActionResult <SkillVM> > UpdateSkill([FromRoute] Guid id, [FromBody] SkillVM skillVM)
        {
            // Validation
            if (!ModelState.IsValid || id != skillVM.Id)
            {
                return(BadRequest(ModelState));
            }

            // Mapping
            Skill skill = this.mapper.Map <SkillVM, Skill>(skillVM);

            skill = await this.bll.UpdateSkillAsync(skill);

            // Mapping
            return(Ok(this.mapper.Map <Skill, SkillVM>(skill)));
        }
Example #15
0
        // GET: Skill/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            //Retrieve Skill information for user comfirmation before delete
            SkillVM skillVM = await db.Skills.FindAsync(id);

            if (skillVM == null)
            {
                return(HttpNotFound());
            }

            return(View(skillVM));
        }
Example #16
0
        // GET: Skill/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            //Retrieve the Skill information and Map to ModeView
            SkillVM skillVM = await db.Skills.FindAsync(id);

            if (skillVM == null)
            {
                return(HttpNotFound());
            }

            return(View(skillVM));
        }
Example #17
0
        public List <SkillCkeckVM> GetChecks(SkillVM owner)
        {
            List <SkillCkeckVM> list = new List <SkillCkeckVM>();

            foreach (KeyValuePair <DoubleKey, DoubleCheck> record in _grid)
            {
                if (record.Key.Key1 == owner.ID || record.Key.Key2 == owner.ID)
                {
                    SkillCkeckVM newCheck = new SkillCkeckVM(record.Value)
                    {
                        Owner = owner,
                        Skill = record.Value.Skill1 == owner ? record.Value.Skill2 : record.Value.Skill1
                    };
                    list.Add(newCheck);
                }
            }

            return(list);
        }
        public async Task <ActionResult <SkillVM> > CreateSkill([FromBody] SkillVM skillVM)
        {
            // Validation
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            // Mapping
            Skill skill = this.mapper.Map <SkillVM, Skill>(skillVM);

            skill = await this.bll.CreateSkillAsync(skill);

            // Mapping
            return(CreatedAtAction(
                       "GetSkill",
                       new { id = skill.Id },
                       this.mapper.Map <Skill, SkillVM>(skill)
                       ));
        }
Example #19
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Skill skill = await db.Skills.FindAsync(id);

            //Check if skill are assigned to employees
            if (db.EmployeeSkills.Where(x => x.SkillId == id).Count() > 0)
            {
                ModelState.AddModelError(string.Empty, "This skill are already associated with employees!");
                SkillVM skillVM = skill;

                return(View(skillVM));
            }

            //Delete the employee
            db.Skills.Remove(skill);

            //Call the EF to save chages
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Example #20
0
 public DataViewModel GetSkills(int id)
 {
     using (Repository repo = new Repository(new XolarDatabase()))
     {
         DataViewModel result = new DataViewModel();
         result.Data = new List <SkillVM>();
         List <Xolartek.Core.Fortnite.SubClass> skills = repo.GetSubClass(id);
         result.Total = skills.Count;
         foreach (Xolartek.Core.Fortnite.SubClass sub in skills)
         {
             SkillVM skill = new SkillVM();
             skill.id          = sub.Id;
             skill.name        = sub.Skill.Name;
             skill.classname   = sub.Name;
             skill.description = sub.Skill.Description;
             skill.issupport   = sub.IsSupport;
             skill.istactical  = sub.IsTactical;
             result.Data.Add(skill);
         }
         return(result);
     }
 }
Example #21
0
        public IHttpActionResult GetSkill(int Id)
        {
            var skill  = db.Skills.Where(x => x.Id == Id).FirstOrDefault();
            var result = new ApiResult <SkillVM>();

            if (skill != null)
            {
                var skillModel = new SkillVM
                {
                    Id         = skill.Id,
                    SkillTitle = skill.SkillTitle,
                    Skilllevel = skill.Skilllevel
                };

                result.HasError = false;
                result.Message  = "Successusfully entered Skills";
                result.Data     = skillModel;
            }
            else
            {
                return(NotFound());
            }
            return(Json(result));
        }
Example #22
0
        public static DigimonVM GetVM(this Digimon digimon)
        {
            var vm = new DigimonVM();

            vm.DigivolveFrom = new ObservableCollection <DigivolveDigimonVM>();
            vm.DigivolveTo   = new ObservableCollection <DigivolveDigimonVM>();
            vm.Skills        = new ObservableCollection <SkillVM>();

            vm.Source = digimon;
            //Локализуем поля
            switch (App.Language.Name)
            {
            case "ru-RU":
                vm.Name       = digimon.NameRus;
                vm.Rank       = ClassHelper.RankRus[digimon.Rank];
                vm.Type       = ClassHelper.TypeRus[digimon.Type];
                vm.Speciality = ClassHelper.SpecialityRus[digimon.Speciality];
                break;

            default:
                vm.Name       = digimon.NameEng;
                vm.Rank       = ClassHelper.RankEng[digimon.Rank];
                vm.Type       = ClassHelper.TypeEng[digimon.Type];
                vm.Speciality = ClassHelper.SpecialityEng[digimon.Speciality];
                break;
            }

            //Переливаем скиллы
            foreach (var skill in digimon.Skills)
            {
                var skillVm = new SkillVM();
                skillVm.Source = skill;
                switch (App.Language.Name)
                {
                case "ru-RU":
                    skillVm.Name        = skill.NameRus;
                    skillVm.Description = skill.SkillSource != SkillSource.Native
                            ? $"{skill.DescriptionRus} ({ClassHelper.SkillSourceRus[skill.SkillSource]})"
                            : skill.DescriptionRus;
                    skillVm.Type = ClassHelper.SkillTypeRus[skill.Type];
                    break;

                default:
                    skillVm.Name        = skill.NameEng;
                    skillVm.Description = skill.SkillSource != SkillSource.Native
                            ? $"{skill.DescriptionEng} ({ClassHelper.SkillSourceEng[skill.SkillSource]})"
                            : skill.DescriptionEng;
                    skillVm.Type = ClassHelper.SkillTypeEng[skill.Type];
                    break;
                }

                vm.Skills.Add(skillVm);
            }


            //Переливаем локации в одну строку

            var locations = new List <string>();

            foreach (var location in digimon.Locations)
            {
                switch (App.Language.Name)
                {
                case "ru-RU":
                    locations.Add(location.Domain != null
                            ? location.Domain.NameRus + " Эт.:" + string.Join(",", location.Floors)
                            : location.DescriptionRus);
                    break;

                default:
                    locations.Add(location.Domain != null
                            ? location.Domain.NameEng + " Lvl:" + string.Join(",", location.Floors)
                            : location.DescriptionEng);
                    break;
                }
            }
            vm.LocationStr = string.Join(" || ", locations);

            return(vm);
        }
Example #23
0
 private bool GetDefaultChecked(SkillVM s1, SkillVM s2) => s1.Model.ExcludedSkillIDs.Contains(s2.ID) || s2.Model.ExcludedSkillIDs.Contains(s1.ID);