public ActionResult MaxStats(QfgCharacter qfgCharacter)
        {
            ResetModelState();

            qfgCharacter.SetMaxValues();

            switch (Request.Form["Page"].ToLower())
            {
                case "inventory":
                    return Inventory(qfgCharacter);

                case "magicstats":
                    return MagicStats(qfgCharacter);

                case "characterstats":
                    return CharacterStats(qfgCharacter);

                default:
                    return General(qfgCharacter);
            }


            //RedirectToAction(Request.Form["Page"], )

            

            //return View(Request.Form["Page"], qfgCharacter);
        }
        public ActionResult Inventory(QfgCharacter qfgCharacter)
        {
            ViewBag.MaxDaggers = qfgCharacter.QfgGameInfo.MaxDaggers;
            ViewBag.MaxHealingPotions = qfgCharacter.QfgGameInfo.MaxHealingPotions;
            ViewBag.MaxMagicPotions = qfgCharacter.QfgGameInfo.MaxMagicPotions;
            ViewBag.MaxVigorPotions = qfgCharacter.QfgGameInfo.MaxVigorPotions;

            return View("Inventory", qfgCharacter);
        }
        public void TestQfg2MagicMaxValues()
        {
            QfgCharacter qfgCharacter = new QfgCharacter();
            qfgCharacter.QfgGame = QfgGames.QFG2;
            qfgCharacter.QfgClass = QfgClasses.Magic;
            qfgCharacter.CharacterName = "Adam";
            qfgCharacter.SetMaxValues();

            string characterString = qfgCharacter.Encode();

            Assert.AreEqual<string>(QFG2_MAGIC_MAX_VAL, characterString);
        }
        public void TestQfg1ThiefMaxValues()
        {
            QfgCharacter qfgCharacter = new QfgCharacter();
            qfgCharacter.QfgGame = QfgGames.QFG1;
            qfgCharacter.QfgClass = QfgClasses.Thief;
            qfgCharacter.CharacterName = "Adam";
            qfgCharacter.SetMaxValues();

            string characterString = qfgCharacter.Encode();

            Assert.AreEqual<string>(QFG1_THIEF_MAX_VAL, characterString);
        }
        public void TestQfg1FighterMaxValues()
        {
            QfgCharacter qfgCharacter = new QfgCharacter();
            qfgCharacter.QfgGame = QfgGames.QFG1;
            qfgCharacter.QfgClass = QfgClasses.Fighter;
            qfgCharacter.CharacterName = "Adam";
            qfgCharacter.SetMaxValues();
            
            string characterString = qfgCharacter.Encode();

            Assert.AreEqual<string>(QFG1_FIGHTER_MAX_VAL, characterString);
        }
        public MainForm()
        {
            InitializeComponent();

            _character = new QfgCharacter();
        }
 public ActionResult MaxStats()
 {
     QfgCharacter qfgCharacter = new QfgCharacter();
     qfgCharacter.SetMaxValues();
     return View("General", qfgCharacter);
 }
        public ActionResult MagicStats(QfgCharacter qfgCharacter)
        {
            ViewBag.MaxMagicStats = qfgCharacter.QfgGameInfo.MaxMagicStatValue;

            return View("MagicStats", qfgCharacter);
        }
 public ActionResult General(QfgCharacter qfgCharacter)
 {
     return View("General", qfgCharacter);
 }
        public ActionResult Save(QfgCharacter qfgCharacter)
        {
            string characterString = qfgCharacter.Encode();

            return File(Encoding.ASCII.GetBytes(characterString), "application/force-download", "character.sav");
        }
        public ActionResult Load(HttpPostedFileBase file)
        {
            QfgCharacter qfgCharacter = new QfgCharacter();

            if (file.ContentLength > 0)
            {
                using (var reader = new StreamReader(file.InputStream))
                {
                    string characterFileString = reader.ReadToEnd();

                    string[] filePieces = characterFileString.Split('\n');

                    if (filePieces.Length > 1)
                    {
                        qfgCharacter.LoadCharacter(filePieces[0].Trim(), filePieces[1]);
                    }
                }
            }

            return View("General", qfgCharacter);
        }
        public ActionResult ChangeGame(QfgCharacter qfgCharacter)
        {
            ResetModelState();

            qfgCharacter.LoadGameInfo();

            return View(Request.Form["Page"], qfgCharacter);
        }
        public void TestMaxValueReset()
        {
            QfgCharacter qfgCharacter = new QfgCharacter();
            qfgCharacter.QfgGame = QfgGames.QFG2;
            qfgCharacter.QfgClass = QfgClasses.Fighter;
            qfgCharacter.CharacterName = "Adam";

            qfgCharacter.SetMaxValues();

            qfgCharacter.QfgGame = QfgGames.QFG1;

            bool valueValid = true;

            if (qfgCharacter.Strength > qfgCharacter.QfgGameInfo.MaxCharacterStatValue)
                valueValid = false;

            if (qfgCharacter.Intelligence > qfgCharacter.QfgGameInfo.MaxCharacterStatValue)
                valueValid = false;

            if (qfgCharacter.Agility > qfgCharacter.QfgGameInfo.MaxCharacterStatValue)
                valueValid = false;

            if (qfgCharacter.Vitality > qfgCharacter.QfgGameInfo.MaxCharacterStatValue)
                valueValid = false;

            if (qfgCharacter.Luck > qfgCharacter.QfgGameInfo.MaxCharacterStatValue)
                valueValid = false;

            if (qfgCharacter.WeaponUse > qfgCharacter.QfgGameInfo.MaxCharacterStatValue)
                valueValid = false;

            if (qfgCharacter.Parry > qfgCharacter.QfgGameInfo.MaxCharacterStatValue)
                valueValid = false;

            if (qfgCharacter.Dodge > qfgCharacter.QfgGameInfo.MaxCharacterStatValue)
                valueValid = false;

            if (qfgCharacter.Stealth > qfgCharacter.QfgGameInfo.MaxCharacterStatValue)
                valueValid = false;

            if (qfgCharacter.PickLocks > qfgCharacter.QfgGameInfo.MaxCharacterStatValue)
                valueValid = false;

            if (qfgCharacter.Throwing > qfgCharacter.QfgGameInfo.MaxCharacterStatValue)
                valueValid = false;

            if (qfgCharacter.Climbing > qfgCharacter.QfgGameInfo.MaxCharacterStatValue)
                valueValid = false;

            if (qfgCharacter.Magic > qfgCharacter.QfgGameInfo.MaxCharacterStatValue)
                valueValid = false;

            if (qfgCharacter.Communication != 0)
                valueValid = false;

            if (qfgCharacter.Honor != 0)
                valueValid = false;

            if (qfgCharacter.Acrobatics != 0)
                valueValid = false;

            Assert.AreEqual<bool>(true, valueValid);
        }
        public void TestQfg2PaladinMaxValues()
        {
            QfgCharacter qfgCharacter = new QfgCharacter();
            qfgCharacter.QfgGame = QfgGames.QFG2;
            qfgCharacter.QfgClass = QfgClasses.Paladin;
            qfgCharacter.CharacterName = "Adam";
            qfgCharacter.SetMaxValues();

            string characterString = qfgCharacter.Encode();

            Assert.AreEqual<string>(QFG2_PALADIN_MAX_VAL, characterString);
        }