public virtual void updateRosters() { //First of all i must load the two rosters. Roster homeR = new Roster(homeTeam + ".xml"); Roster awayR = new Roster(awayTeam + ".xml"); for (int i = 0; i < homePlayers.Count; i++) { UpdaterPlayer up = (UpdaterPlayer)homePlayers[i]; if (up.played()) { Player player = homeR.getPlayer(up.Name); int oldDps = player.Dps; player.increaseAbilities(up.StIncrease, up.TkIncrease, up.PsIncrease, up.ShIncrease); player.increaseStats(up.Saves, up.Tackles, up.Passes, up.Shots, up.Goals, up.Assists, up.Dps); player.Injury = up.Injury; //Ora bisogna settare le suspensions int newDps = player.Dps; int margin = ((System.Int32)Config.getConfig().getConfigValue("SUSPENSION_MARGIN")); int suspension; if (oldDps % margin < newDps % margin) { suspension = newDps % margin; } } } for (int i = 0; i < awayPlayers.Count; i++) { UpdaterPlayer up = (UpdaterPlayer)awayPlayers[i]; if (up.played()) { Player player = awayR.getPlayer(up.Name); int oldDps = player.Dps; player.increaseAbilities(up.StIncrease, up.TkIncrease, up.PsIncrease, up.ShIncrease); player.increaseStats(up.Saves, up.Tackles, up.Passes, up.Shots, up.Goals, up.Assists, up.Dps); player.Injury = up.Injury; //Ora bisogna settare le suspensions int newDps = player.Dps; int margin = ((System.Int32)Config.getConfig().getConfigValue("SUSPENSION_MARGIN")); int suspension; if (oldDps % margin < newDps % margin) { suspension = newDps % margin; } } } homeR.WriteRoster(Updater.externalUrl); awayR.WriteRoster(Updater.externalUrl); }
public virtual void addPlayer(System.String team, UpdaterPlayer p) { if (team.Equals(homeTeam)) { homePlayers.Add(p); } else if (team.Equals(awayTeam)) { awayPlayers.Add(p); } else { throw new System.Exception("team " + team + " is not in the match"); } }