コード例 #1
0
        public PlayerGameBuildViewModel GetPlayerGameBuild(int gameId, string playerName)
        {
            PlayerGameBuildViewModel vm   = new PlayerGameBuildViewModel();
            PlayerGameBuildData      data = _detailDal.GetPlayerGameBuildDetail(playerName, gameId);

            //TO DO: Is there any cleaner way of doing this?
            vm.PlayerName       = playerName;
            vm.HeroIconURL      = ContentURL.GetHeroIconURL(data.HeroUnitTypeId);
            vm.Strength         = data.StatBuildDic.GetValueOrDefault("A02W");
            vm.Agility          = data.StatBuildDic.GetValueOrDefault("A03D");
            vm.Intelligence     = data.StatBuildDic.GetValueOrDefault("A03E");
            vm.Attack           = data.StatBuildDic.GetValueOrDefault("A03W");
            vm.Armor            = data.StatBuildDic.GetValueOrDefault("A03X");
            vm.HealthRegen      = data.StatBuildDic.GetValueOrDefault("A03Y");
            vm.ManaRegen        = data.StatBuildDic.GetValueOrDefault("A03Z");
            vm.MoveSpeed        = data.StatBuildDic.GetValueOrDefault("A04Y");
            vm.GoldRegen        = data.StatBuildDic.GetValueOrDefault("A0A9");
            vm.PrelatiMana      = data.StatBuildDic.GetValueOrDefault("A0CJ");
            vm.WardCount       += data.PurchasedItemsDic.GetValueOrDefault("I003");
            vm.WardCount       += data.PurchasedItemsDic.GetValueOrDefault("I00N");
            vm.WardCount       += data.PurchasedItemsDic.GetValueOrDefault("SWAR");
            vm.FamiliarCount   += data.PurchasedItemsDic.GetValueOrDefault("I002");
            vm.FamiliarCount   += data.PurchasedItemsDic.GetValueOrDefault("I005");
            vm.SpiritLinkCount += data.PurchasedItemsDic.GetValueOrDefault("I00G");
            vm.SpiritLinkCount += data.PurchasedItemsDic.GetValueOrDefault("I00R");
            vm.FirstCS          = data.CommandSealDic.GetValueOrDefault("A094");
            vm.SecondCS         = data.CommandSealDic.GetValueOrDefault("A043");
            vm.ThirdCS          = data.CommandSealDic.GetValueOrDefault("A044");
            vm.FourthCS         = data.CommandSealDic.GetValueOrDefault("A05Q");

            vm.AttributeList = new List <PlayerGameBuildAttribute>();
            foreach (Tuple <string, string> attributeData in data.LearnedAttributeList)
            {
                PlayerGameBuildAttribute attr = new PlayerGameBuildAttribute
                {
                    AttributeImgUrl = ContentURL.GetAttributeIconURL(attributeData.Item1),
                    AttributeName   = attributeData.Item2
                };
                vm.AttributeList.Add(attr);
            }
            return(vm);
        }
コード例 #2
0
ファイル: MainModule.cs プロジェクト: l46kok/fate-web-server
        public MainModule(IResourceLinker linker, GameSL gameSl,
                          PlayerStatSL playerStatsSl, GhostCommSL ghostCommSl,
                          StatisticsSL statisticsSl, GameDetailSL gameDetailSl,
                          BanListSL banListSl)
        {
            Get["/"] = _ =>
            {
                Context.EnableOutputCache(15);
                MainPageViewModel mpVm = new MainPageViewModel
                {
                    CurrentBotTime     = DateTime.Now,
                    RecentGameDataList = gameSl.GetRecentGames(10)
                };
                return(View["Views/MainPage.sshtml", mpVm]);
            };

            Post["/Search"] = param => Response.AsRedirect($"/PlayerStats/USEast/{Request.Form.searchPlayerName}");

            Get["/GameList"] = param =>
            {
                Context.EnableOutputCache(10);
                return(View["Views/GameList.sshtml", ghostCommSl.GetGameList()]);
            };

            Get["/About"] = Param => View["Views/About.sshtml"];

            Get["/ServantStatistics"] = Param =>
            {
                Context.EnableOutputCache(30);
                return(View["Views/ServantStatistics.sshtml", statisticsSl.GetServantStatistics()]);
            };

            Get["/LeaderBoards"] = Param =>
            {
                Context.EnableOutputCache(30);
                return(View["Views/LeaderBoards.sshtml"]);
            };

            Get["/Downloads"] = Param => View["Views/Downloads.sshtml", ConfigHandler.MapName];

            Get["/PlayerGameBuildDetail/{GameID}/{PlayerName}"] = param =>
            {
                PlayerGameBuildViewModel vm = gameDetailSl.GetPlayerGameBuild(param.GameID, param.PlayerName);
                return(View["Views/PlayerGameBuildDetail.sshtml", vm]);
            };

            Get["/Log"] = x =>
            {
                string gameLog = gameSl.GetGameLog(Request.Query.gameId);
                return(View["Views/Log.sshtml", gameLog]);
            };
            Get["/PlayerStats/{server}/{playerName}"] = param =>
            {
                PlayerStatsPageViewModel summaryData = playerStatsSl.GetPlayerStatSummary(param.playerName, param.server, int.MaxValue);
                return(View["Views/PlayerStatsPage.sshtml", summaryData]);
            };

            Get["/Maintenance"] = param => View["Views/Maintenance.sshtml"];

            Get["/Login"] = param => View["Views/Login.sshtml", new LoginViewModel()];

            Get["/BanList"] = param =>
            {
                Context.EnableOutputCache(60);
                return(View["Views/BanList.sshtml", banListSl.GetBannedPlayers()]);
            };
        }