Exemple #1
0
 public Base(ServiceRecord serviceRecord)
 {
     ServiceRecord = serviceRecord;
     RecentWarGamesHistory =
         GlobalStorage.H4Manager.GetPlayerGameHistory<GameHistoryModel.WarGames>(serviceRecord.Gamertag, 0, 20);
     PublicGamertag = ServiceRecord.Gamertag;
 }
 public CsrDetailViewModel(ServiceRecord serviceRecord, PlaylistOrientationEntity playlistOrientation, CommonModels.CurrentSkillRank currentSkillRank, MetadataModels.Playlist playlist)
     : base(serviceRecord)
 {
     Playlist = playlist;
     PlaylistOrientation = playlistOrientation;
     CurrentSkillRank = currentSkillRank;
 }
        public ActionResult Index(string gamertag, ServiceRecord serviceRecord, string slug)
        {
            GameMode gameMode;
            Enum.TryParse(slug, out gameMode);
            var page = int.Parse(Request.QueryString["page"] ?? "0");
            if (page < 0) page = 0;
            const int count = 25;

            dynamic gameHistory;
            switch (gameMode)
            {
                case GameMode.Customs:
                case GameMode.WarGames:
                    gameHistory =
                        GlobalStorage.H4Manager.GetPlayerGameHistory<GameHistoryModel.WarGames>(
                            serviceRecord.Gamertag, (page * count), count, gameMode);
                    if (gameHistory == null)
                        return FlashMessage.RedirectAndFlash(Response,
                            RedirectToAction("Index", "ServiceRecord", new {area = "Halo4", gamertag}), FlashMessage.FlashMessageType.Failure,
                            "No cached game history",
                            "Branch hasn't cached the game history for this player, and can't load any new data right now.");
                    return View("WarGames", new HistoryViewModel<GameHistoryModel.WarGames>(
                        serviceRecord, gameHistory, gameMode, page));

                case GameMode.Campaign:
                    gameHistory =
                        GlobalStorage.H4Manager.GetPlayerGameHistory<GameHistoryModel.Campaign>(
                            serviceRecord.Gamertag, (page * count), count, gameMode);
                    if (gameHistory == null)
                        return FlashMessage.RedirectAndFlash(Response,
                            RedirectToAction("Index", "ServiceRecord", new {area = "Halo4", gamertag}), FlashMessage.FlashMessageType.Failure,
                            "No cached game history",
                            "Branch hasn't cached the game history for this player, and can't load any new data right now.");
                    return View("Campaign", new HistoryViewModel<GameHistoryModel.Campaign>(
                        serviceRecord, gameHistory, gameMode, page));

                case GameMode.SpartanOps:
                    gameHistory =
                        GlobalStorage.H4Manager.GetPlayerGameHistory<GameHistoryModel.SpartanOps>(
                            serviceRecord.Gamertag, (page * count), count, gameMode);
                    if (gameHistory == null)
                        return FlashMessage.RedirectAndFlash(Response,
                            RedirectToAction("Index", "ServiceRecord", new {area = "Halo4", gamertag}), FlashMessage.FlashMessageType.Failure,
                            "No cached game history",
                            "Branch hasn't cached the game history for this player, and can't load any new data right now.");
                    return View("SpartanOps", new HistoryViewModel<GameHistoryModel.SpartanOps>(
                        serviceRecord, gameHistory, gameMode, page));

                default:
                    return FlashMessage.RedirectAndFlash(Response, RedirectToAction("Index", "History", new { slug = GameMode.WarGames.ToString() }),
                        FlashMessage.FlashMessageType.Info, "Couldn't find specified Game Mode",
                        "Branch was unable to find that specific game mode, so we took you to a familiar, and safe place.");
            }
        }
        public ActionResult Index(string gamertag, ServiceRecord serviceRecord, string id)
        {
            var game = GlobalStorage.H4Manager.GetPlayerGame(serviceRecord.Gamertag, id);
            if (game == null)
            {
                return FlashMessage.RedirectAndFlash(Response, RedirectToAction("Index", "ServiceRecord"),
                    FlashMessage.FlashMessageType.Failure,
                    "Unable to load Game",
                    "It seems the specified game you tried to view doesn't exist, is invalid, or has been purged by 343.");
            }

            return
                View(new GameViewModel(serviceRecord, game));
        }
        public ActionResult Index(string gamertag, string slug, ServiceRecord serviceRecord)
        {
            var commendations = GlobalStorage.H4Manager.GetPlayerCommendations(serviceRecord.Gamertag);
            if (commendations == null)
                return FlashMessage.RedirectAndFlash(Response, RedirectToAction("Index", "ServiceRecord", new { gamertag }),
                    FlashMessage.FlashMessageType.Failure, "No cached player commendation",
                    "Branch hasn't cached the commendations for this player, and can't load any new data right now.");

            CommendationCategory commendationCategory;
            if (!Enum.TryParse(slug, out commendationCategory))
                return FlashMessage.RedirectAndFlash(Response, RedirectToAction("Index", "Commendations", new { slug = CommendationCategory.Weapons.ToString() }),
                    FlashMessage.FlashMessageType.Info, "Couldn't find Commendation Type",
                    "Branch was unable to find that specific commendation type, so we took you to a familiar, and safe place.");

            return View(new CommendationsViewModel(serviceRecord, commendations.Commendations, commendationCategory));
        }
Exemple #6
0
        public ActionResult Details(string gamertag, ServiceRecord serviceRecord, int? id, string slug)
        {
            if (id == null)
                return FlashMessage.RedirectAndFlash(Response, RedirectToAction("Index", "Csr"),
                    FlashMessage.FlashMessageType.Failure, "Playlist Error", "There was no specified playlist id, the url must have been malformed.");

            var skillRank = serviceRecord.SkillRanks.FirstOrDefault(r => r.PlaylistId == id);
            if (skillRank == null)
                return FlashMessage.RedirectAndFlash(Response, RedirectToAction("Index", "Csr"),
                    FlashMessage.FlashMessageType.Failure, "Playlist Error", "The specified playlist doesn't exist. It either was purged by 343, or never existed.");

            var playlist = MetadataHelpers.GetPlaylist(skillRank.PlaylistId);
            if (playlist == null)
                return FlashMessage.RedirectAndFlash(Response, RedirectToAction("Index", "Csr"),
                    FlashMessage.FlashMessageType.Failure, "Playlist Error", "The specified playlist doesn't exist. It either was purged by 343, or never existed. Try waiting for 343 to update their systems and try again in 30 minutes.");

            if (skillRank.PlaylistName.ToSlug() != slug)
                return FlashMessage.RedirectAndFlash(Response, RedirectToAction("Details", "Csr", new { id, slug = skillRank.PlaylistName.ToSlug() }),
                    FlashMessage.FlashMessageType.Warning, "Haha!", "Nice try changing the slug m8.");

            return
                View(new CsrDetailViewModel(serviceRecord, GlobalStorage.H4Manager.GetPlaylistOrientation(skillRank.PlaylistId),
                    serviceRecord.SkillRanks.FirstOrDefault(r => r.PlaylistId == id), MetadataHelpers.GetPlaylist(skillRank.PlaylistId)));
        }
 public SpecializationsViewModel(ServiceRecord serviceRecord)
     : base(serviceRecord)
 {
 }
 public ActionResult Index(string gamertag, ServiceRecord serviceRecord)
 {
     return View(new SpecializationsViewModel(serviceRecord));
 }
 public CommendationsViewModel(ServiceRecord serviceRecord, IList<CommendationModels.Commendation> commendations, CommendationCategory commendationCategory)
     : base(serviceRecord)
 {
     Commendations = commendations;
     CommendationCategory = commendationCategory;
 }
Exemple #10
0
 public ActionResult Index(string gamertag, ServiceRecord serviceRecord)
 {
     return View(new CsrViewModel(serviceRecord, GlobalStorage.H4Manager.GetPlaylistOrientations()));
 }
Exemple #11
0
 public GameViewModel(ServiceRecord serviceRecord, ElapsedGame elapsedGame)
     : base(serviceRecord)
 {
     ElapsedGame = elapsedGame;
 }
 public ServiceRecordViewModel(ServiceRecord serviceRecord)
     : base(serviceRecord)
 {
 }
 public GamePlayerListViewModel(ServiceRecord serviceRecord, IList<Game.Player> players, Game.Team team)
     : base(serviceRecord)
 {
     Players = players;
     Team = team;
 }
Exemple #14
0
 public CsrViewModel(ServiceRecord serviceRecord, IEnumerable<PlaylistOrientationEntity> playlistOrientations)
     : base(serviceRecord)
 {
     PlaylistOrientations = playlistOrientations;
 }