Exemplo n.º 1
0
        internal JamPlayer ReadData(SqlDataReader reader)
        {
            JamPlayer player = new JamPlayer();

            player.ID       = reader.GetInt32(reader.GetOrdinal("ID"));
            player.TeamID   = reader.GetInt32(reader.GetOrdinal("TeamID"));
            player.PlayerID = reader.GetInt32(reader.GetOrdinal("PlayerID"));
            player.JamID    = reader.GetInt32(reader.GetOrdinal("JamID"));
            player.IsJammer = reader.GetBoolean(reader.GetOrdinal("IsJammer"));
            player.IsPivot  = reader.GetBoolean(reader.GetOrdinal("IsPivot"));
            return(player);
        }
Exemplo n.º 2
0
        private static void ProcessJamPlayer(Dictionary <int, List <PenaltyGroup> > pgMap, Dictionary <int, List <PenaltyGroup> > jamBoxTimeMap, Dictionary <int, int> boxTimeEstimates,
                                             int jamID, JamTeamEffectiveness jte1, List <JamPlayerEffectiveness> pjeList, int jamTime, JamPlayer player)
        {
            // handle penalties
            var playerPenaltyGroups = pgMap.ContainsKey(player.PlayerID) ? pgMap[player.PlayerID] : null;

            ProcessPlayerJamPenalties(jamBoxTimeMap, jamID, playerPenaltyGroups);

            // try to estimate what portion of a jam someone missed via time in the box
            int timeInBox = 0;

            if (jamBoxTimeMap.ContainsKey(jamID))
            {
                foreach (PenaltyGroup group in jamBoxTimeMap[jamID])
                {
                    foreach (BoxTime bt in group.BoxTimes)
                    {
                        if (bt.PlayerID == player.PlayerID && bt.JamID == jamID)
                        {
                            // factor in estimated box time
                            timeInBox += boxTimeEstimates[bt.BoxTimeID];
                        }
                    }
                }
            }

            JamPlayerEffectiveness pje = new JamPlayerEffectiveness
            {
                PlayerID    = player.PlayerID,
                TeamID      = player.TeamID,
                JamPortion  = ((double)jamTime - timeInBox) / jamTime,
                BaseQuality = jte1.Percentile,
                JamID       = jamID,
                IsJammer    = player.IsJammer,
                PenaltyCost = 0
            };

            pjeList.Add(pje);
        }