public static Dictionary <PlayerSkillTypes, uint> GetPlayerSkills(Hattrick.Players.Player player) { Dictionary <PlayerSkillTypes, uint> skills = new Dictionary <PlayerSkillTypes, uint>(); skills[PlayerSkillTypes.Defending] = (uint)player.defenderSkillField; skills[PlayerSkillTypes.Experience] = (uint)player.experienceField; skills[PlayerSkillTypes.Form] = (uint)player.playerFormField; skills[PlayerSkillTypes.Keeper] = (uint)player.keeperSkillField; skills[PlayerSkillTypes.Leadership] = (uint)player.leadershipField; skills[PlayerSkillTypes.Loyalty] = (uint)player.loyaltyField; skills[PlayerSkillTypes.Passing] = (uint)player.passingSkillField; skills[PlayerSkillTypes.Playmaking] = (uint)player.playmakerSkillField; skills[PlayerSkillTypes.Scoring] = (uint)player.scorerSkillField; skills[PlayerSkillTypes.SetPieces] = (uint)player.setPiecesSkillField; skills[PlayerSkillTypes.Stamina] = (uint)player.staminaSkillField; skills[PlayerSkillTypes.Winger] = (uint)player.wingerSkillField; skills[PlayerSkillTypes.MotherClubMonus] = (uint)(player.motherClubField ? 1 : 0); return(skills); }
private List<Player> ParsePlayerListNode(XmlNode playerListNode) { try { List<Player> playerList = new List<Player>(); foreach (XmlNode xmlPlayerNode in playerListNode.ChildNodes) { if (xmlPlayerNode.ChildNodes != null) { Player player = new Player(); foreach (XmlNode xmlNode in xmlPlayerNode.ChildNodes) { switch (xmlNode.Name) { case Tags.PlayerID: player.playerIdField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.FirstName: player.firstNameField = xmlNode.InnerText; break; case Tags.NickName: player.nickNameField = xmlNode.InnerText; break; case Tags.LastName: player.lastNameField = xmlNode.InnerText; break; case Tags.PlayerNumber: player.playerNumberField = GenericFunctions.ConvertStringToByte(xmlNode.InnerText); break; case Tags.Age: player.ageField = GenericFunctions.ConvertStringToByte(xmlNode.InnerText); break; case Tags.AgeDays: player.ageDaysField = GenericFunctions.ConvertStringToByte(xmlNode.InnerText); break; case Tags.TSI: player.tsiField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.PlayerForm: player.playerFormField = (PlayerForm)Convert.ToInt32(xmlNode.InnerText); break; case Tags.Statement: player.statementField = xmlNode.InnerText; break; case Tags.Experience: player.experienceField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.Leadership: player.leadershipField = (Leadership)Convert.ToInt32(xmlNode.InnerText); break; case Tags.Salary: player.salaryField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.IsAbroad: player.isAbroadField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; case Tags.Agreeability: player.agreeabilityField = (Agreeability)Convert.ToInt32(xmlNode.InnerText); break; case Tags.Aggressiveness: player.aggressivenessField = (Aggressiveness)Convert.ToInt32(xmlNode.InnerText); break; case Tags.Honesty: player.honestyField = (Honesty)Convert.ToInt32(xmlNode.InnerText); break; case Tags.LeagueGoals: player.leagueGoalsField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.CupGoals: player.cupGoalsField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.FriendliesGoals: player.friendliesGoalsField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.CareerGoals: player.careerGoalsField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.CareerHattricks: player.careerHattricksField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.Specialty: player.specialtyField = (PlayerSpecialty)Convert.ToInt32(xmlNode.InnerText); break; case Tags.TransferListed: player.transferlistedField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; case Tags.NationalTeamID: player.nationalTeamIdField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); break; case Tags.CountryID: player.countryIdField = GenericFunctions.ConvertStringToUInt(xmlNode.InnerText); player.leagueIdField = HM.Resources.Constants.EnumNames.CountryToLeagueID[player.countryIdField]; break; case Tags.Caps: player.capsField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.CapsU20: player.capsU20Field = Convert.ToInt32(xmlNode.InnerText); break; case Tags.Cards: player.cardsField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.InjuryLevel: player.injuryLevelField = Convert.ToInt32(xmlNode.InnerText); break; case Tags.MotherClubBonus: player.motherClubField = Convert.ToBoolean(xmlNode.InnerText); break; case Tags.Loyalty: player.loyaltyField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.StaminaSkill: player.staminaSkillField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.KeeperSkill: player.keeperSkillField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.PlaymakerSkill: player.playmakerSkillField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.ScorerSkill: player.scorerSkillField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.PassingSkill: player.passingSkillField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.WingerSkill: player.wingerSkillField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.DefenderSkill: player.defenderSkillField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.SetPiecesSkill: player.setPiecesSkillField = (PlayerSkill)Convert.ToInt32(xmlNode.InnerText); break; case Tags.PlayerCategoryId: player.playerCategoryIdField = (PlayerCategory)Convert.ToInt32(xmlNode.InnerText); break; case Tags.LastMatch: if (xmlNode.ChildNodes != null) { player.lastMatchField = ParseLastMatchDataNode(xmlNode); } break; case Tags.TrainerData: if (xmlNode.ChildNodes != null) { player.trainerDataField = ParseTrainerDataNode(xmlNode); } break; } } playerList.Add(player); } } return playerList; } catch (Exception ex) { throw ex; } }