示例#1
0
        public RecordDisplay(WarcraftLadderRecord record)
            : this()
        {
            switch (record.LadderType)
            {
                case WarcraftLadderType.Solo:
                    recordTitle.Text = "Solo Games";
                    break;
                case WarcraftLadderType.Team:
                    recordTitle.Text = "Team Games";
                    break;
                case WarcraftLadderType.FreeForAll:
                    recordTitle.Text = "FFA Games";
                    break;
            }

            level.Text = string.Format(CultureInfo.CurrentUICulture, "Level {0}", record.Level);
            exp.Text = record.TotalExperience.ToString("#,##0", CultureInfo.CurrentUICulture);
            wins.Text = record.Wins.ToString("#,##0", CultureInfo.CurrentUICulture);
            losses.Text = record.Losses.ToString("#,##0", CultureInfo.CurrentUICulture);
            rank.Text = (record.Rank == 0) ? "Unranked" : record.Rank.ToString(CultureInfo.CurrentUICulture);
            progress.Value = Math.Min(record.HoursUntilExperienceDecay, 100);
        }
示例#2
0
        /// <summary>
        /// In derived classes, sets the statistical data associated with the user's profile.
        /// </summary>
        /// <param name="ladderRecords">The user's ladder game records.</param>
        /// <param name="arrangedTeams">The user's arranged team game records.</param>
        /// <param name="raceRecords">The user's records by playable race.</param>
        /// <exception cref="ArgumentNullException">Thrown if any parameters are <see langword="null" />.</exception>
        protected internal void SetStats(WarcraftLadderRecord[] ladderRecords, ArrangedTeamRecord[] arrangedTeams,
            WarcraftRaceRecord[] raceRecords)
        {
            if (object.ReferenceEquals(null, ladderRecords))
                throw new ArgumentNullException("ladderRecords");
            if (object.ReferenceEquals(null, arrangedTeams))
                throw new ArgumentNullException("arrangedTeams");
            if (object.ReferenceEquals(null, raceRecords))
                throw new ArgumentNullException("raceRecords");

            m_ladderRecords = ladderRecords;
            m_arrangedTeams = arrangedTeams;
            m_raceStats = raceRecords;
        }
        private void HandleWarcraftUserInfoRequest(ParseData data, DataReader dr)
        {
            int cookie = dr.ReadInt32();
            if (!m_warcraftProfileRequests.ContainsKey(cookie))
            {
                Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "Unable to locate profile request with cookie {0:x2}", cookie));
                return;
            }
            WarcraftProfileEventArgs args = m_warcraftProfileRequests[cookie];

            string iconID = dr.ReadDwordString(0);
            args.Profile.IconID = iconID;

            int recordCount = dr.ReadByte();
            WarcraftLadderRecord[] ladderRecords = new WarcraftLadderRecord[recordCount];
            for (int i = 0; i < recordCount; i++)
            {
                WarcraftLadderType ladderType = (WarcraftLadderType)dr.ReadInt32();
                int wins = dr.ReadInt16();
                int losses = dr.ReadInt16();
                int level = dr.ReadByte();
                int hrs = dr.ReadByte();
                int xp = dr.ReadInt16();
                int rank = dr.ReadInt32();

                WarcraftLadderRecord record = new WarcraftLadderRecord(ladderType, wins, losses, level, hrs, xp, rank);
                ladderRecords[i] = record;
            }

            int raceRecordCount = dr.ReadByte();
            Warcraft3IconRace[] raceOrder = new Warcraft3IconRace[] { Warcraft3IconRace.Random, Warcraft3IconRace.Human, Warcraft3IconRace.Orc, Warcraft3IconRace.Undead, Warcraft3IconRace.NightElf, Warcraft3IconRace.Tournament };
            WarcraftRaceRecord[] raceRecords = new WarcraftRaceRecord[raceRecordCount];
            for (int i = 0; i < raceRecordCount; i++)
            {
                int wins = dr.ReadInt16();
                int losses = dr.ReadInt16();

                WarcraftRaceRecord record = new WarcraftRaceRecord(raceOrder[i], wins, losses);
                raceRecords[i] = record;
            }

            int teamRecordsCount = dr.ReadByte();
            ArrangedTeamRecord[] teamRecords = new ArrangedTeamRecord[teamRecordsCount];
            for (int i = 0; i < teamRecordsCount; i++)
            {
                ArrangedTeamType teamType = (ArrangedTeamType)dr.ReadInt32();
                int wins = dr.ReadInt16();
                int losses = dr.ReadInt16();
                int level = dr.ReadByte();
                int hrs = dr.ReadByte();
                int xp = dr.ReadInt16();
                int rank = dr.ReadInt32();
                long ftLastGameplay = dr.ReadInt64();
                DateTime lastGamePlayed = DateTime.FromFileTime(ftLastGameplay);
                int numPartners = dr.ReadByte();
                string[] partnerList = new string[numPartners];
                for (int p = 0; p < numPartners; p++)
                    partnerList[p] = dr.ReadCString();

                ArrangedTeamRecord record = new ArrangedTeamRecord(teamType, wins, losses, level, hrs, xp, rank, lastGamePlayed, partnerList);
                teamRecords[i] = record;
            }

            args.Profile.SetStats(ladderRecords, teamRecords, raceRecords);

            args.EventData = data;

            OnWarcraftProfileReceived(args);
        }