Ejemplo n.º 1
0
        public virtual ActionResult Quest()
        {
            IQuestRepository repo = new EFQuestRepository();

            var myMembershipId = User.Identity.GetUserId();
            var me             = PlayerProcedures.GetPlayerFromMembership(myMembershipId);

            var unopenedMessageCount = DomainRegistry.Repository.FindSingle(new GetUnreadMessageCountByPlayer {
                OwnerId = me.Id
            });
            var openedUnreadMessageCount = DomainRegistry.Repository.FindSingle(new GetReadAndMarkedAsUnreadMessageCountByPlayer {
                OwnerId = me.Id
            });

            var output = new QuestPlayPageViewModel();

            output.Player               = PlayerProcedures.GetPlayerFormViewModel(me.Id);
            output.QuestStart           = QuestProcedures.GetQuest(me.InQuest);
            output.QuestState           = QuestProcedures.GetQuestState(me.InQuestState);
            output.QuestConnections     = QuestProcedures.GetChildQuestConnections(me.InQuestState);
            output.BuffBox              = ItemProcedures.GetPlayerBuffs(me);
            output.QuestPlayerVariables = QuestProcedures.GetAllQuestPlayerVariablesFromQuest(output.QuestStart.Id, me.Id);
            output.HasNewMessages       = unopenedMessageCount != 0;
            output.UnreadMessageCount   = unopenedMessageCount + openedUnreadMessageCount;

            ViewBag.ErrorMessage    = TempData["Error"];
            ViewBag.SubErrorMessage = TempData["SubError"];
            ViewBag.Result          = TempData["Result"];

            output.SetConnectionText((string)TempData["ConnectionText"]);

            return(PartialView(MVC.Quest.Views.Quest, output));
        }