コード例 #1
0
ファイル: session.cs プロジェクト: kjm00king/FEH-TEAM
        public static TRE GetTre(dal.UserData.Hero h)
        {
            TRE it = new TRE()
            {
                id = h.id,
                H  = h.hid,
                L  = CML.ComUtility.XInt(h.hl.ToUpper().Replace("LV", ""), 0),
                R  = CML.ComUtility.XInt(h.hr.ToUpper().Replace("R", ""), 0),
                P  = CML.ComUtility.XInt(h.hp.ToUpper().Replace("+", ""), 0),
            };


            dal.Hero hero = CML.ComUtility.QueryFirst(from x in Bll.webcache.wiki.heroes where x.Id == it.H select x, null);
            if (hero != null)
            {
                it.N = hero.Name;
                it.W = hero.WeaponClassId;
                it.M = hero.MoveTypeId;
            }

            SetTreProp(it.H, it.R, h.var[0], (o => o.HP), ref it.Hp);
            SetTreProp(it.H, it.R, h.var[1], (o => o.ATK), ref it.Atk);
            SetTreProp(it.H, it.R, h.var[2], (o => o.SPD), ref it.Spd);
            SetTreProp(it.H, it.R, h.var[3], (o => o.DEF), ref it.Def);
            SetTreProp(it.H, it.R, h.var[4], (o => o.RES), ref it.Res);

            return(it);
        }
コード例 #2
0
        public JsonResult ReportModHero()
        {
            try
            {
                if (!Bll.session.ExistUserData(HttpContext))
                {
                    throw new Exception("Session Time out!");
                }

                dal.UserData user = Bll.session.GetUserData(HttpContext);

                dal.UserData.Hero hero = CML.ComUtility.FromJson <dal.UserData.Hero>(Request["param"]);

                dal.UserData.Hero mod = user.Mod(hero);

                if (mod == null)
                {
                    throw new Exception("Modify Fail: No Found Hero!");
                }

                return(Json(new
                {
                    result = true,
                    data = new
                    {
                        user = mod,
                        report = Bll.session.GetTre(mod)
                    }
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { result = false, msg = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #3
0
        public JsonResult DelHero()
        {
            try
            {
                if (!Bll.session.ExistUserData(HttpContext))
                {
                    throw new Exception("Session Time out!");
                }

                dal.UserData user = Bll.session.GetUserData(HttpContext);

                dal.UserData.Hero del = user.Del(CML.ComUtility.XInt(Request["param"], 0));

                if (del == null)
                {
                    throw new Exception("Delete Fail: No Found Hero!");
                }

                return(Json(new { result = true, data = del }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { result = false, msg = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #4
0
        public JsonResult AddHero()
        {
            try
            {
                if (!Bll.session.ExistUserData(HttpContext))
                {
                    throw new Exception("Session Time out!");
                }

                dal.UserData user = Bll.session.GetUserData(HttpContext);

                dal.UserData.Hero hero = CML.ComUtility.FromJson <dal.UserData.Hero>(Request["param"]);

                user.Add(hero);

                return(Json(new { result = true, data = hero }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { result = false, msg = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }