예제 #1
0
        public static void CreateCharacter(long accountId, string characterName, int jobId) // Creates Character and Inventory
        {
            using (Ms2DbContext context = new Ms2DbContext())
            {
                Character character = new Character() // Set default values here (Refer to character.cs for column names)
                {
                    AccountId   = accountId,
                    Name        = characterName,
                    JobId       = jobId,
                    MapId       = 2000062,
                    CoordX      = 2850,
                    CoordY      = 2550,
                    CoordZ      = 1800,
                    Level       = 70,
                    PrestigeLvl = 100,
                    Motto       = "This works!",
                    HomeName    = "My Home Works!",
                    InsigniaId  = 29,
                    TitleId     = 10000292
                };
                context.Characters.Add(character);
                context.SaveChanges();

                InventoryManager inventory = new InventoryManager();

                character = context.Characters.First(column => column.Name.ToLower() == characterName.ToLower());
                InventoryManager.CreateInventory(character.CharacterId);
            }
        }
 public static void EditCharInfo(/*Character character*/)
 {
     using (Ms2DbContext context = new Ms2DbContext())
     {
         context.SaveChanges();
     }
 }
예제 #3
0
 public static void EditSkill(/*SkillTree skill*/)
 {
     using (Ms2DbContext context = new Ms2DbContext())
     {
         context.SaveChanges();
     }
 }
예제 #4
0
 public static void EditItem(/*Item item*/)
 {
     using (Ms2DbContext context = new Ms2DbContext())
     {
         context.SaveChanges();
     }
 }
예제 #5
0
 public void EditCharInfo(Character character)
 {
     using (Ms2DbContext Context = new Ms2DbContext())
     {
         Character Character = character;
         Context.SaveChanges();
     }
 }
예제 #6
0
 public Character GetCharInfo(long characterId)
 {
     using (Ms2DbContext Context = new Ms2DbContext())
     {
         Character Character = Context.Characters.FirstOrDefault(a => a.CharacterId == characterId);
         return(Character);
     }
 }
예제 #7
0
 public void SetCharInfo(Character CharIn)
 {
     using (Ms2DbContext context = new Ms2DbContext())
     {
         Character character = CharIn;
         context.SaveChanges();
     }
 }
예제 #8
0
 public void EditItem(Item item)
 {
     using (Ms2DbContext Context = new Ms2DbContext())
     {
         Item Item = item;
         Context.SaveChanges();
     }
 }
예제 #9
0
 public Account GetAccountByName(string username)
 {
     using (Ms2DbContext context = new Ms2DbContext())
     {
         Account account = context.Accounts.FirstOrDefault(column => column.Username.ToLower() == username.ToLower()); // Retrieve entry by username
         return(account);
     }
 }
예제 #10
0
 public Account GetAccInfoByUser(string username)
 {
     using (Ms2DbContext Context = new Ms2DbContext())
     {
         Account Account = Context.Accounts.FirstOrDefault(a => a.Username.ToLower() == username.ToLower()); // Retrieve entry by username
         return(Account);
     }
 }
예제 #11
0
 public void UpdateSkill(SkillTree skillObject)
 {
     using (Ms2DbContext context = new Ms2DbContext())
     {
         SkillTree skill = skillObject;
         context.SaveChanges();
     }
 }
예제 #12
0
 public Account GetAccInfoById(long id) // Queries db and retrieves account entry by Id
 {
     using (Ms2DbContext Context = new Ms2DbContext())
     {
         Account Account = Context.Accounts.FirstOrDefault(a => a.AccountId == id); // Retrieve entry by Id
         return(Account);
     }
 }
예제 #13
0
 public void EditSkill(SkillTree skill)
 {
     using (Ms2DbContext Context = new Ms2DbContext())
     {
         SkillTree Skill = skill;
         Context.SaveChanges();
     }
 }
예제 #14
0
 public Character GetCharacterInfo(long characterId)
 {
     using (Ms2DbContext context = new Ms2DbContext())
     {
         Character character = context.Characters.FirstOrDefault(column => column.CharacterId == characterId);
         return(character);
     }
 }
예제 #15
0
 public void UpdateCharInfo(Character characterObject)
 {
     using (Ms2DbContext context = new Ms2DbContext())
     {
         Character character = characterObject;
         context.SaveChanges();
     }
 }
예제 #16
0
 public static void UpdateItem(Item itemObject)
 {
     using (Ms2DbContext context = new Ms2DbContext())
     {
         Item item = itemObject;
         context.SaveChanges();
     }
 }
예제 #17
0
 public Account GetAccountById(long id) // Queries db and retrieves account entry by Id
 {
     using (Ms2DbContext context = new Ms2DbContext())
     {
         Account account = context.Accounts.FirstOrDefault(column => column.AccountId == id); // Retrieve entry by Id
         return(account);
     }
 }
예제 #18
0
 public void DeleteCharacter(long characterId)
 {
     using (Ms2DbContext context = new Ms2DbContext())
     {
         Character character = context.Characters.FirstOrDefault(column => column.CharacterId == characterId);
         context.Remove(character);
         context.SaveChanges();
     }
 }
예제 #19
0
 public void DeleteAccount(long id)
 {
     using (Ms2DbContext Context = new Ms2DbContext())
     {
         Account Account = Context.Accounts.Find(id);
         Context.Remove(Account);
         Context.SaveChanges();
     }
 }
예제 #20
0
        public Item findItem(long uid)
        {
            using (Ms2DbContext Context = new Ms2DbContext())
            {
                Item Item = Context.Items.Find(uid);

                return(Item);
            }
        }
예제 #21
0
        public static SkillTree FindSkill(long characterId, long skillId)
        {
            using (Ms2DbContext context = new Ms2DbContext())
            {
                SkillTree skill = context.SkillTrees.Where(c => c.CharacterId == characterId).FirstOrDefault(s => s.SkillId == skillId);

                return(skill);
            }
        }
예제 #22
0
        public static Item FindItem(long uid)
        {
            using (Ms2DbContext context = new Ms2DbContext())
            {
                Item item = context.Items.Find(uid);

                return(item);
            }
        }
예제 #23
0
 public static void DeleteAccount(long id)
 {
     using (Ms2DbContext context = new Ms2DbContext())
     {
         Account account = context.Accounts.Find(id);
         context.Remove(account);
         context.SaveChanges();
     }
 }
 public static void DeleteCharacter(long characterId, string characterName = "")
 {
     using (Ms2DbContext context = new Ms2DbContext())
     {
         Character character = context.Characters.FirstOrDefault(a => (a.CharacterId == characterId) || (a.Name.ToLower() == characterName.ToLower()));
         context.Remove(character);
         context.SaveChanges();
     }
 }
예제 #25
0
 public List <SkillTree> GetSkillTree(long characterId)
 {
     using (Ms2DbContext context = new Ms2DbContext())
     {
         List <SkillTree> skillTree = context.SkillTrees.Where(column => column.CharacterId == characterId)
                                      .ToList();
         return(skillTree);
     }
 }
예제 #26
0
        public void DeleteItem(long uid)
        {
            using (Ms2DbContext Context = new Ms2DbContext())
            {
                Item Item = Context.Items.Find(uid);

                Context.Remove(Item);
                Context.SaveChanges();
            }
        }
예제 #27
0
        public SkillTree GetSkill(long characterId, long skillId)
        {
            using (Ms2DbContext context = new Ms2DbContext())
            {
                SkillTree skill = context.SkillTrees.Where(column => column.CharacterId == characterId)
                                  .FirstOrDefault(column => column.SkillId == skillId);

                return(skill);
            }
        }
예제 #28
0
 public static void DeleteSkill(long characterId, long skillId)
 {
     using (Ms2DbContext context = new Ms2DbContext())
     {
         SkillTree skill = context.SkillTrees.Where(column => column.CharacterId == characterId)
                           .FirstOrDefault(column => column.SkillId == skillId);
         context.Remove(skill);
         context.SaveChanges();
     }
 }
예제 #29
0
 public List <Character> GetCharacterList(long accountId)
 {
     using (Ms2DbContext context = new Ms2DbContext())
     {
         List <Character> characters = context.Characters.Include(table => table.Account)
                                       .Where(column => column.Account.AccountId == accountId)
                                       .ToList();
         return(characters);
     }
 }
예제 #30
0
        public static void DeleteItem(long uid)
        {
            using (Ms2DbContext context = new Ms2DbContext())
            {
                Item item = context.Items.Find(uid);

                context.Remove(item);
                context.SaveChanges();
            }
        }