SkillDTO GetSkillDto(SKILL skill) { SkillDTO skillDto = new SkillDTO(); skillDto.id = skill.Id; skillDto.UserId = skill.UserId; skillDto.shortcutId = skill.ShortcutId; skillDto.nextLevel = skill.NextLevel; skillDto.coldTime = skill.ColdTime; skillDto.range = skill.Range; skillDto.applyValue = skill.ApplyValue; skillDto.applyTime = skill.ApplyTime; skillDto.mp = skill.Mp; skillDto.dis = skill.Dis; skillDto.back = skill.Back; skillDto.skillId = skill.SkillId; SkillModelDTO skillModelDto = new SkillModelDTO(); skillModelDto.code = skill.Code; skillModelDto.name = skill.Name; SkillInitial skillInitial = SkillInitialProperty.mapSkill[skillDto.skillId]; skillModelDto.info = skillInitial.info; skillModelDto.icon_name = skillInitial.icon_name; skillModelDto.applyType = skillInitial.applyType; skillModelDto.applyProperty = skillInitial.applyProperty; skillModelDto.releaseType = skillInitial.releaseType; skillModelDto.efx_name = skillInitial.efx_name; skillModelDto.aniname = skillInitial.aniname; skillDto.SkillModelDto = skillModelDto; return(skillDto); }
public List <SkillDTO> AddSkill(UserToken userToken) { int userId = UserCache.GetUserId(userToken); USER user = UserCache.GetUserById(userId); string[] skillids = user.SkillIds.Split(','); List <int> skillidlist = new List <int>(); for (int i = 0; i < skillids.Length; i++) { skillidlist.Add(int.Parse(skillids[i])); } if (!SkillCache.IsInSkillDic(userId)) { List <SKILL> skills = new List <SKILL>(); for (int i = 0; i < skillidlist.Count; i++) { SkillInitial skillInitial = SkillInitialProperty.mapSkill[skillidlist[i]]; if (skillInitial.code == user.ModelName) { SKILL skill = new SKILL(); skill.Id = skillInitial.id; skill.UserId = userId; skill.SkillId = skillInitial.id; skill.ShortcutId = -1; skill.Code = skillInitial.code; skill.Level = skillInitial.SkillLevelDates[0].level; skill.NextLevel = skillInitial.SkillLevelDates[0].nextLevel; skill.ColdTime = skillInitial.SkillLevelDates[0].coldTime; skill.Name = skillInitial.name; skill.Range = skillInitial.SkillLevelDates[0].range; skill.ApplyValue = skillInitial.SkillLevelDates[0].applyValue; skill.ApplyTime = skillInitial.SkillLevelDates[0].applyTime; skill.Dis = skillInitial.SkillLevelDates[0].dis; skill.Back = skillInitial.SkillLevelDates[0].back; skill.Mp = skillInitial.SkillLevelDates[0].mp; skills.Add(skill); } } List <SKILL> skillList = SkillCache.AddSkill(userId, skills); return(GetSkillDtoList(skillList)); } return(null); }
List <SkillDTO> GetSkillDtoList(List <SKILL> skillList) { List <SkillDTO> skillDtos = new List <SkillDTO>(); for (int i = 0; i < skillList.Count; i++) { SkillDTO skillDto = new SkillDTO(); skillDto.id = skillList[i].Id; skillDto.UserId = skillList[i].UserId; skillDto.shortcutId = skillList[i].ShortcutId; skillDto.level = skillList[i].Level; skillDto.nextLevel = skillList[i].NextLevel; skillDto.coldTime = skillList[i].ColdTime; skillDto.range = skillList[i].Range; skillDto.applyValue = skillList[i].ApplyValue; skillDto.applyTime = skillList[i].ApplyTime; skillDto.mp = skillList[i].Mp; skillDto.dis = skillList[i].Dis; skillDto.back = skillList[i].Back; skillDto.skillId = skillList[i].SkillId; SkillModelDTO skillModelDto = new SkillModelDTO(); skillModelDto.code = skillList[i].Code; skillModelDto.name = skillList[i].Name; SkillInitial skillInitial = SkillInitialProperty.mapSkill[skillList[i].SkillId]; skillModelDto.info = skillInitial.info; skillModelDto.icon_name = skillInitial.icon_name; skillModelDto.applyType = skillInitial.applyType; skillModelDto.applyProperty = skillInitial.applyProperty; skillModelDto.releaseType = skillInitial.releaseType; skillModelDto.efx_name = skillInitial.efx_name; skillModelDto.aniname = skillInitial.aniname; skillDto.SkillModelDto = skillModelDto; skillDtos.Add(skillDto); } return(skillDtos); }