Exemple #1
0
 internal static void AddNewCharacter(string name, int phy, int men, int vit, int luc, ulong userId)
 {
     using (CharacterContext db = new CharacterContext())
     {
         db.Characters.Add(new Character(name, phy, men, vit, luc, 2, userId));
         db.SaveChanges();
     }
 }
Exemple #2
0
        internal static string GetItems()
        {
            string msg = "\n";

            using (CharacterContext db = new CharacterContext())
            {
                List <Item> items = db.Items.ToList <Item>();
                foreach (Item item in items)
                {
                    msg += item.ItemID + " | " + item.ItemName + " | " + item.ItemDescription + " | " + item.ItemCost + "\n";
                }
            }
            return(msg);
        }
Exemple #3
0
        internal static string GetSkills()
        {
            string msg = "\n";

            using (CharacterContext db = new CharacterContext())
            {
                List <Skill> skills = db.Skills.ToList <Skill>();
                foreach (Skill skill in skills)
                {
                    msg += skill.SkillID + " | " + skill.SkillName + " | " + skill.SkillDescription + "\n";
                }
            }
            return(msg);
        }
Exemple #4
0
        internal static string GetCharacters(string id)
        {
            string msg = "\n";

            using (CharacterContext db = new CharacterContext())
            {
                List <Character> chars = db.Characters.ToList <Character>();
                foreach (Character chr in chars)
                {
                    if (chr.UserId == id)
                    {
                        msg += chr.CharacterID + " | " + chr.Name + " | " + chr.PHY + " | " + chr.MEN + " | " + chr.VIT + " | " + chr.LUC + " | " + chr.Cash + " | " + chr.SkillPoints + "\n";
                    }
                }
            }
            return(msg);
        }
Exemple #5
0
        internal static string GetCharacterItems(int selectedCharacter)
        {
            string msg = "\n";

            using (CharacterContext db = new CharacterContext())
            {
                List <CharacterItem> items = db.CharacterItems.ToList <CharacterItem>();
                foreach (CharacterItem item in items)
                {
                    if (item.CharacterId == selectedCharacter)
                    {
                        msg += item.ItemID + " | " + item.ItemName + " | " + item.ItemDescription + " | " + item.ItemCost + " | " + item.QuantityOwned + "\n";
                    }
                }
            }
            return(msg);
        }
Exemple #6
0
        internal static void InitializeCharacterDatabase()
        {
            using (CharacterContext db = new CharacterContext())
            {
                //Add default items to CharacterDB
                foreach (Item item in GenerateNewItemList())
                {
                    db.Items.Add(item);
                }

                //Add default Skills to CharacterDB
                foreach (Skill skill in GenerateNewSkillList())
                {
                    db.Skills.Add(skill);
                }
                db.SaveChanges();
            }
        }