/// <summary> /// takes a string and parses it returning CharStat /// token sequence: CharType, CharLvl, X, Y, number of skill, skill, lvl, skill, lvl... /// tokens seperated by a '#' /// </summary> /// <param name="character"></param> /// <returns></returns> public static CharStat parseCharacter(string[] character) { List <(Spells[], int)> spellList = new List <(Spells[], int)>(); int spellNum = Convert.ToInt32(character[5]); for (int i = 0; i < spellNum; i++) { spellList.Add((Spells.getSpell(Convert.ToInt32(character[6 + 2 * i])), Convert.ToInt32(character[7 + 2 * i]))); } return(new CharStat( CharacterType.getCharacterType(Convert.ToInt32(character[1])), Convert.ToInt32(character[2]), Convert.ToInt32(character[3]), Convert.ToInt32(character[4]), spellList)); }