public JsonResult Select(string server, Guid allcards, Guid allrunes, Guid allskills, Guid allmapstage, Guid allmaphardstage, Guid keywords)
        {
            try
            {
                var version = GameDataManager.Load(allcards, allrunes, allskills, allmapstage, allmaphardstage, keywords);
                var gdm     = GameDataManager.Get(version);

                Response.Cookies.Append("server", server, new CookieOptions {
                    Expires = DateTime.MaxValue
                });
                Response.Cookies.Append("version", version.ToString());
                Response.Cookies.Append("allcards", gdm.allcards.ToString());
                Response.Cookies.Append("allrunes", gdm.allrunes.ToString());
                Response.Cookies.Append("allskills", gdm.allskills.ToString());
                Response.Cookies.Append("allmapstage", gdm.allmapstage.ToString());
                Response.Cookies.Append("allmaphardstage", gdm.allmaphardstage.ToString());
                Response.Cookies.Append("keywords", gdm.keywords.ToString());

                return(new JsonResult(new
                {
                    success = true,
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(new
                {
                    success = false,
                    message = ex.Message,
                }));
            }
        }
示例#2
0
        public IActionResult Card2d()
        {
            var dm       = GameDataManager.Get(Request);
            var cardList = dm.CardList;
            var list     = cardList.Where(m => dm.CardData_GetIsBattleCard(m));

            return(View(list));
        }
        public IActionResult AllCardTable()
        {
            var dbContext = new MkhxCoreContext();
            var dm        = GameDataManager.Get(Request);
            var cardList  = dm.CardList;
            var skillList = dm.SkillList;

            ViewData["skillList"] = skillList;
            return(View(cardList));
        }
示例#4
0
        public IActionResult CardFragment()
        {
            var dm       = GameDataManager.Get(Request);
            var cardList = dm.CardList;

            ViewData["data"] = cardList
                               .GroupBy(m => m.Rank)
                               .ToDictionary(rank => rank.Key, rank => rank.GroupBy(card => (card.CanDecompose > 0 ? 1 : 0) * 0b1 + (card.DecomposeGet > 0 ? 1 : 0) * 0b10).ToDictionary(m => m.Key, m => m.ToArray()));
            ViewData["keyMask"] = new Dictionary <int, string> {
                { 0b1, "可以分解" },
        public JsonResult KeyWords()
        {
            var dm          = GameDataManager.Get(Request);
            var keywordList = dm.KeywordList;

            return(new JsonResult(keywordList.ToDictionary(m => m.id.ToString(), m => new
            {
                m.key,
                m.des,
            })));
        }
示例#6
0
        public IActionResult Hard(string id)
        {
            try
            {
                var dm = GameDataManager.Get(Request);
                var MapHardStageData = dm.MapHardStageList;

                ViewData["type"] = "hard";
                var Id = id.Split('-');
                switch (Id.Length)
                {
                case 1:
                {
                    try
                    {
                        var MapStage = MapHardStageData.First(m => FindMapStageData(m, Id));
                        ViewData["Prev"] = MapHardStageData.FirstOrDefault(m => m.MapStageId == MapStage.Prev);
                        ViewData["Next"] = MapHardStageData.FirstOrDefault(m => m.MapStageId == MapStage.Next);
                        return(View("MapStage", MapStage));
                    }
                    catch
                    {
                        ViewData["id"] = id;
                        return(new NotFoundResult());
                    }
                }

                case 2:
                {
                    try
                    {
                        var MapStage       = MapHardStageData.First(m => FindMapStageData(m, Id));
                        var MapStageDetail = MapStage.MapStageDetails.First(m => FindMapStageData(m, Id));
                        return(View("MapStageDetail", MapStageDetail));
                    }
                    catch
                    {
                        ViewData["id"] = id;
                        return(new NotFoundResult());
                    }
                }

                default:
                {
                    ViewData["id"] = id;
                    return(new NotFoundResult());
                }
                }
            }
            catch (NeedVersionSelectedException)
            {
                return(View("Blank"));
            }
        }
示例#7
0
        public IActionResult Index()
        {
            try
            {
                var dm = GameDataManager.Get(Request);
                var normalMapStages = dm.MapStageList;
                var hardMapStages   = dm.MapHardStageList;

                ViewData["normalMapStages"] = normalMapStages;
                ViewData["hardMapStages"]   = hardMapStages;
                return(View());
            }
            catch (NeedVersionSelectedException)
            {
                return(View("Blank"));
            }
        }
示例#8
0
        public IActionResult Index()
        {
            try
            {
                var dm        = GameDataManager.Get(Request);
                var dbContext = new MkhxCoreContext();
                var PvCounter = dbContext.PvCounter;

                ViewData["V_Article"] = dbContext.V_Article;

                ViewData["GameDataManager"] = dm;
                ViewData["PvCounter"]       = PvCounter;

                return(View());
            }
            catch (NeedVersionSelectedException)
            {
                return(View("Blank"));
            }
        }
        public IActionResult Detail(string id)
        {
            try
            {
                var dbContext = new MkhxCoreContext();
                var dm        = GameDataManager.Get(Request);
                var cardList  = dm.CardList;

                ParsedCardData card = cardList.FirstOrDefault(m => m.CardId + "" == id || m.CardName == id);
                ViewData["id"] = id;
                if (card == null)
                {
                    return(new NotFoundResult());
                }
                else
                {
                    if (!int.TryParse(id, out int CardId))  //  如果使用了名称选取,则跳转为编号选取,避免Edge浏览器Header编码问题
                    {
                        return(new RedirectResult($"/carddata/{card.CardId}", false));
                    }

                    {
                        var picture = dbContext.Picture.ToArray().Where(m => m.Name.Split(' ').Contains(card.CardName)).ToArray();
                        ViewData["picture"] = picture;
                    }
                    {
                        var SummonerCards = dm.CardData_GetAllSummonerCards(card);
                        ViewData["SummonerCards"] = SummonerCards;
                    }
                    {
                        var SummoneeCards = dm.CardData_GetAllSummoneeCards(card);
                        ViewData["SummoneeCards"] = SummoneeCards;
                    }
                    {
                        var ShowInMapStageLevel = dm.CardData_GetShowInMapStageLevel(card);
                        ViewData["ShowInMapStageLevel"] = ShowInMapStageLevel;
                    }
                    {
                        var RewardInMapStage     = dm.CardData_GetRewardInMapStage(card);
                        var ChipRewardInMapStage = dm.CardData_GetChipRewardInMapStage(card);
                        var list = new List <KeyValuePair <ParsedMapStageData, int> >();
                        list.AddRange(RewardInMapStage);
                        list.AddRange(ChipRewardInMapStage);
                        ViewData["RewardInMapStage"] = list.Distinct().ToArray();
                    }
                    {
                        var RewardInMapStageLevel     = dm.CardData_GetRewardInMapStageLevel(card);
                        var ChipRewardInMapStageLevel = dm.CardData_GetChipRewardInMapStageLevel(card);
                        var list = new List <KeyValuePair <ParsedMapStageDetailLevelData, int> >();
                        list.AddRange(RewardInMapStageLevel);
                        list.AddRange(ChipRewardInMapStageLevel);
                        ViewData["RewardInMapStageLevel"] = list.Distinct().ToArray();
                    }
                    {
                        var vc = Request.Cookies["vc"] ?? "";
                        if (!vc.Contains((char)(card.CardId + 1024)))
                        {
                            Response.Cookies.Append("vc", vc + ((char)(card.CardId + 1024)));
                            dbContext.PvCounter.Add(new PvCounter
                            {
                                Id   = Guid.NewGuid(),
                                Time = DateTime.Now,
                                Ip   = Request.HttpContext.Connection.RemoteIpAddress.ToString(),
                                Ua   = Request.Headers["User-Agent"],
                                Type = "card",
                                Name = card.CardName,
                            });
                            var timeDelete = DateTime.Now.AddDays(-7);
                            dbContext.PvCounter.RemoveRange(dbContext.PvCounter.Where(m => m.Time < timeDelete));
                            dbContext.SaveChanges();
                        }
                    }

                    return(View(card));
                }
            }
            catch (NeedVersionSelectedException)
            {
                return(View("Blank"));
            }
        }
        public IActionResult Index()
        {
            try
            {
                var type    = string.Join(",", Request.Query["type"]).ToLower();
                var color   = string.Join(",", Request.Query["color"]).ToLower();
                var race    = string.Join(",", Request.Query["race"]).ToLower();
                var orderby = string.Join(",", Request.Query["orderby"]).ToLower();
                var desc    = string.Join(",", Request.Query["desc"]).ToLower();
                var view    = string.Join(",", Request.Query["view"]).ToLower();

                ViewData["type"]    = type;
                ViewData["color"]   = color;
                ViewData["race"]    = race;
                ViewData["orderby"] = orderby;
                ViewData["desc"]    = desc;
                ViewData["view"]    = view;

                var dm       = GameDataManager.Get(Request);
                var cardList = dm.CardList;

                var list = (IEnumerable <ParsedCardData>)cardList;

                switch (type)
                {
                default:
                {
                    list = list.Where(m => dm.CardData_GetIsBattleCard(m));
                    break;
                }

                case "materialcards":
                {
                    list = list.Where(m => !dm.CardData_GetIsBattleCard(m));
                    break;
                }

                case "all":
                {
                    break;
                }
                }

                try
                {
                    if (!string.IsNullOrEmpty(color))
                    {
                        var c = color.Split(',').Select(m => int.Parse(m));
                        list = list.Where(m => c.Contains(m.Color));
                    }
                }
                catch { }

                try
                {
                    if (!string.IsNullOrEmpty(race))
                    {
                        var r = race.Split(',').Select(m => int.Parse(m));
                        list = list.Where(m => r.Contains(m.Race));
                    }
                }
                catch { }

                list = list.OrderBy(m => m.CardId);
                switch (orderby)
                {
                default:
                {
                    list = list.OrderBy(m => m.CardId);
                    break;
                }

                case "name":
                {
                    list = list.OrderBy(m => m.CardName);
                    break;
                }

                case "reversename":
                {
                    list = list.OrderBy(m => string.Join("", m.CardName.Reverse()));
                    break;
                }

                case "color":
                {
                    list = list.OrderBy(m => m.Color);
                    break;
                }

                case "race":
                {
                    list = list.OrderBy(m => m.Race);
                    break;
                }

                case "cost":
                {
                    list = list.OrderBy(m => m.Cost);
                    break;
                }

                case "evocost":
                {
                    list = list.OrderBy(m => m.EvoCost);
                    break;
                }

                case "wait":
                {
                    list = list.OrderBy(m => m.Wait);
                    break;
                }

                case "atk0":
                {
                    list = list.OrderBy(m => m.AttackArray[0]);
                    break;
                }

                case "atk10":
                {
                    list = list.OrderBy(m => m.AttackArray[10]);
                    break;
                }

                case "atk15":
                {
                    list = list.OrderBy(m => m.AttackArray[15]);
                    break;
                }

                case "hp0":
                {
                    list = list.OrderBy(m => m.HpArray[0]);
                    break;
                }

                case "hp10":
                {
                    list = list.OrderBy(m => m.HpArray[10]);
                    break;
                }

                case "hp15":
                {
                    list = list.OrderBy(m => m.HpArray[15]);
                    break;
                }

                case "rank":
                {
                    list = list.OrderBy(m => m.Rank);
                    break;
                }

                case "terminate":
                {
                    list = list.OrderBy(m => m.Terminate);
                    break;
                }
                }

                if (desc == "1")
                {
                    list = list.Reverse();
                }

                return(View(list));
            }
            catch (NeedVersionSelectedException)
            {
                return(View("Blank"));
            }
        }
        public IActionResult Index()
        {
            try
            {
                var type          = string.Join(",", Request.Query["type"]).ToLower();
                var skillCategory = string.Join(",", Request.Query["skillCategory"]).ToLower();
                var orderby       = string.Join(",", Request.Query["orderby"]).ToLower();
                var desc          = string.Join(",", Request.Query["desc"]).ToLower();

                ViewData["type"]          = type;
                ViewData["skillCategory"] = skillCategory;
                ViewData["orderby"]       = orderby;
                ViewData["desc"]          = desc;

                var dm        = GameDataManager.Get(Request);
                var skillList = dm.SkillList;

                var list = (IEnumerable <ParsedSkillData>)skillList;

                switch (type.ToLower())
                {
                default:
                {
                    list = list.Where(m => m.IsBattleSkill && !m.IsMultipleSkill);
                    break;
                }

                case "multipleskill":
                {
                    list = list.Where(m => m.IsMultipleSkill);
                    break;
                }

                case "materialskill":
                {
                    list = list.Where(m => !m.IsBattleSkill);
                    break;
                }

                case "all":
                {
                    break;
                }
                }

                try
                {
                    if (!string.IsNullOrEmpty(skillCategory))
                    {
                        var c = skillCategory.Split(',').Select(m => int.Parse(m));
                        list = list.Where(m => c.Contains(m.SkillCategory));
                    }
                }
                catch { }

                switch (orderby.ToLower())
                {
                default:
                {
                    list = list.OrderBy(m => m.SkillId);
                    break;
                }

                case "name":
                {
                    list = list.OrderBy(m => m.Abbreviation);
                    break;
                }

                case "reversename":
                {
                    list = list.OrderBy(m => string.Join("", m.Abbreviation.Reverse()));
                    break;
                }

                case "skillcategory":
                {
                    list = list.OrderBy(m => m.SkillCategory);
                    break;
                }

                case "affecttype":
                {
                    list = list.OrderBy(m => m.AffectType[0]);
                    break;
                }

                case "lanchtype":
                {
                    list = list.OrderBy(m => m.LanchType);
                    break;
                }

                case "lanchcondition":
                {
                    list = list.OrderBy(m => m.LanchCondition);
                    break;
                }
                }

                if (desc == "1")
                {
                    list = list.Reverse();
                }

                ViewData["AffectTypeContent"] = AffectTypeContent.List;
                return(View(list.GroupBy(m => m.Abbreviation)));
            }
            catch (NeedVersionSelectedException)
            {
                return(View("Blank"));
            }
        }
        public IActionResult Detail(string id, string all)
        {
            try
            {
                var dbContext = new MkhxCoreContext();
                var dm        = GameDataManager.Get(Request);

                ViewData["AffectTypeContent"] = AffectTypeContent.List;
                ViewData["GameDataManager"]   = dm;

                {
                    var listall = dm.SkillList.Where(m => m.Abbreviation == id || m.SkillId + "" == id || m.Name == id);

                    var count = listall.Count();
                    if (count < 1)
                    {
                        return(new NotFoundResult());
                    }

                    var skill = listall.First();
                    if (!int.TryParse(id, out int SkillId)) //  如果使用了名称选取,则跳转为编号选取,避免Edge浏览器Header编码问题
                    {
                        return(new RedirectResult($"/skilldata/{skill.SkillId}{(string.IsNullOrEmpty(all) ? "" : $"?all={all}")}", false));
                    }
                    if (count == 1)
                    {
                        listall = dm.SkillList.Where(m => m.Abbreviation == skill.Abbreviation);
                    }

                    ViewData["listall"] = listall;

                    {
                        var sr = Request.Cookies["sr"] ?? "";
                        if (!sr.Contains((char)(skill.SkillId + 1024)))
                        {
                            Response.Cookies.Append("sr", sr + ((char)(skill.SkillId + 1024)));
                            dbContext.PvCounter.Add(new PvCounter
                            {
                                Id   = Guid.NewGuid(),
                                Time = DateTime.Now,
                                Ip   = Request.HttpContext.Connection.RemoteIpAddress.ToString(),
                                Ua   = Request.Headers["User-Agent"],
                                Type = "skill",
                                Name = skill.Abbreviation,
                            });
                            var timeDelete = DateTime.Now.AddDays(-7);
                            dbContext.PvCounter.RemoveRange(dbContext.PvCounter.Where(m => m.Time < timeDelete));
                            dbContext.SaveChanges();
                        }
                    }

                    if (string.IsNullOrEmpty(all))
                    {
                        //  选择特定技能
                        return(View(new ParsedSkillData[] { skill }));
                    }
                    else
                    {
                        //  选择所有同系列技能
                        return(View(listall.OrderBy(m => m.SkillId)));
                    }
                }
            }
示例#13
0
        public IActionResult JourneyDeck(string server)
        {
            var dbContext = new MkhxCoreContext();

            if (string.IsNullOrEmpty(server))
            {
                return(new JsonResult(dbContext.V_JourneyDeck.GroupBy(m => m.Server).ToDictionary(m => m.Key, m => m.GroupBy(n => n.DefendPlayerName).ToDictionary(n => n.Key, n => n))));
            }
            else
            {
                var dm        = GameDataManager.Get(Request);
                var cardList  = dm.CardList;
                var runeList  = dm.RuneList;
                var skillList = dm.SkillList;

                return(new JsonResult(dbContext.V_JourneyDeck.Where(m => m.Server == server).GroupBy(m => m.DefendPlayerName).ToDictionary(n => n.Key, n => n.Select(i => new
                {
                    i.DefendPlayerName,
                    DefendPlayerCards = i.DefendPlayerCards.Split(',').Select(m => m.Split('_')).Select(c => new
                    {
                        Card = cardList.FirstOrDefault(m => m.CardId + "" == c[0] || m.CardName == c[0]),
                        Level = int.Parse(c[1]),
                        BonusSkill = skillList.FirstOrDefault(m => m.SkillId + "" == c[2] || m.Name == c[2]),
                        Attack = double.Parse(c[3]),
                        Hp = double.Parse(c[4]),
                    }),
                    DefendPlayerRunes = i.DefendPlayerRunes.Split(',').Select(m => m.Split('_')).Select(r => new
                    {
                        Rune = runeList.FirstOrDefault(m => m.RuneId + "" == r[0] || m.RuneName == r[0]),
                        Level = int.Parse(r[1]),
                    }),
                }).Select(i => new
                {
                    i.DefendPlayerName,
                    DefendPlayerCards = i.DefendPlayerCards.Select(c => new
                    {
                        c.Card.CardId,
                        c.Card.CardName,
                        c.Card.Color,
                        c.Card.Race,
                        c.Level,
                        BonusSkill = c.BonusSkill == null ? null : new
                        {
                            c.BonusSkill.SkillId,
                            c.BonusSkill.Name,
                            c.BonusSkill.SkillCategory,
                        },
                        c.Attack,
                        c.Hp,
                    }),
                    DefendPlayerRunes = i.DefendPlayerRunes.Select(r => new
                    {
                        r.Rune.RuneId,
                        r.Rune.RuneName,
                        r.Rune.Color,
                        r.Rune.Property,
                        r.Level,
                    }),
                    HpSum = i.DefendPlayerCards.Sum(h => h.Hp)
                }).OrderBy(i => i.HpSum))));
            }
        }
        public IActionResult Detail(string id)
        {
            try
            {
                var dbContext = new MkhxCoreContext();
                var dm        = GameDataManager.Get(Request);
                var runeList  = dm.RuneList;

                ParsedRuneData rune = runeList.FirstOrDefault(m => m.RuneId + "" == id || m.RuneName == id);

                if (rune == null)
                {
                    return(new NotFoundResult());
                }
                else
                {
                    if (!int.TryParse(id, out int RuneId))  //  如果使用了名称选取,则跳转为编号选取,避免Edge浏览器Header编码问题
                    {
                        return(new RedirectResult($"/runedata/{rune.RuneId}", false));
                    }

                    {
                        var ShowInMapStageLevel = dm.RuneData_GetShowInMapStageLevel(rune);
                        ViewData["ShowInMapStageLevel"] = ShowInMapStageLevel;
                    }
                    {
                        var RewardInMapStage = dm.RuneData_GetRewardInMapStage(rune);
                        var list             = new List <KeyValuePair <ParsedMapStageData, int> >();
                        list.AddRange(RewardInMapStage);
                        ViewData["RewardInMapStage"] = list.Distinct().ToArray();
                    }
                    {
                        var RewardInMapStageLevel = dm.RuneData_GetRewardInMapStageLevel(rune);
                        var list = new List <KeyValuePair <ParsedMapStageDetailLevelData, int> >();
                        list.AddRange(RewardInMapStageLevel);
                        ViewData["RewardInMapStageLevel"] = list.Distinct().ToArray();
                    }
                    {
                        var vr = Request.Cookies["vr"] ?? "";
                        if (!vr.Contains((char)(rune.RuneId + 1024)))
                        {
                            Response.Cookies.Append("vr", vr + ((char)(rune.RuneId + 1024)));
                            dbContext.PvCounter.Add(new PvCounter
                            {
                                Id   = Guid.NewGuid(),
                                Time = DateTime.Now,
                                Ip   = Request.HttpContext.Connection.RemoteIpAddress.ToString(),
                                Ua   = Request.Headers["User-Agent"],
                                Type = "rune",
                                Name = rune.RuneName,
                            });
                            var timeDelete = DateTime.Now.AddDays(-7);
                            dbContext.PvCounter.RemoveRange(dbContext.PvCounter.Where(m => m.Time < timeDelete));
                            dbContext.SaveChanges();
                        }
                    }
                    return(View(rune));
                }
            }
            catch (NeedVersionSelectedException)
            {
                return(View("Blank"));
            }
        }
        public IActionResult Index()
        {
            try
            {
                var color    = string.Join(",", Request.Query["color"]).ToLower();
                var property = string.Join(",", Request.Query["property"]).ToLower();
                var orderby  = string.Join(",", Request.Query["orderby"]).ToLower();
                var desc     = string.Join(",", Request.Query["desc"]).ToLower();

                var dm       = GameDataManager.Get(Request);
                var runeList = dm.RuneList;

                var list = (IEnumerable <ParsedRuneData>)runeList;

                try
                {
                    if (!string.IsNullOrEmpty(color))
                    {
                        var c = color.Split(',').Select(m => int.Parse(m));
                        list = list.Where(m => c.Contains(m.Color));
                    }
                }
                catch { }

                try
                {
                    if (!string.IsNullOrEmpty(property))
                    {
                        var r = property.Split(',').Select(m => int.Parse(m));
                        list = list.Where(m => r.Contains(m.Property));
                    }
                }
                catch { }

                switch (orderby.ToLower())
                {
                default:
                {
                    list = list.OrderBy(m => m.RuneId);
                    break;
                }

                case "name":
                {
                    list = list.OrderBy(m => m.RuneName);
                    break;
                }

                case "reversename":
                {
                    list = list.OrderBy(m => m.RuneName.Reverse());
                    break;
                }

                case "color":
                {
                    list = list.OrderBy(m => m.Color);
                    break;
                }

                case "property":
                {
                    list = list.OrderBy(m => m.Property);
                    break;
                }
                }

                if (!string.IsNullOrEmpty(desc))
                {
                    list = list.Reverse();
                }

                return(View(list));
            }
            catch (NeedVersionSelectedException)
            {
                return(View("Blank"));
            }
        }