public double getShPointsForStblDaily(String PlayerName, ConfigsForYear shPointsDef) { double ret = 0; if (stblPoints.isValidForStblDay()) { int Position = stblPoints.getSortedPlayerList().FindIndex(x => x == PlayerName); String[] splits = shPointsDef.stlDay.Replace(" ", "").Split(','); if (splits.Length > Position) { Double.TryParse(splits[Position], out ret); } } return(ret); }
public double getShPointsForMatch(String PlayerName, ConfigsForYear shPointsDef) { double ret = 0; flight ctF = getMyFlight(PlayerName); if (ctF != null) { double shForMatch = getShPointsForMatchType(ctF.matchType, shPointsDef); foreach (match m in ctF.matchs.Values) { team myTeam = m.GetMyTeam(PlayerName); if (myTeam == null) { continue; //suis pas dans le match } else { if (matchScores.matchResults.ContainsKey(m.name)) { switch (matchScores.matchResults[m.name].WinnerteamName) { case 0: ret += shForMatch / 2; //half the points for a draw break; case 1: if (m.Team1.name1based == myTeam.name1based) { ret += shForMatch; } break; //half the points for a draw case 2: if (m.Team2.name1based == myTeam.name1based) { ret += shForMatch; } break; //half the points for a draw } } } } } return(ret); }
public double getShPointsForMatchType(flight.MatchType matchType, ConfigsForYear shPointsDef) { double ret = 2; String[] splits = shPointsDef.ptsMatch.Replace(" ", "").Split(','); if (matchType == flight.MatchType.Foursome && splits.Length > 1) //Foursome used to be only 1 points { double.TryParse(splits[1], out ret); // old } else { double.TryParse(splits[0], out ret); switch (matchType) { case flight.MatchType.FoursomeWinch5: case flight.MatchType.Winch: ret = ret / 2; // only half points for Winch break; } } return(ret); }