public static void CreateInventory(long characterId) { using (Ms2DbContext context = new Ms2DbContext()) { Inventory inventory = new Inventory() { CharacterId = characterId }; context.Add(inventory); context.SaveChanges(); } }
public static void AddSkill(long characterId, long skillId, string skillName = "", int level = 0, bool learned = false) { using (Ms2DbContext context = new Ms2DbContext()) { SkillTree skill = new SkillTree() { CharacterId = characterId, SkillId = skillId, SkillName = skillName, Level = level, Learned = learned }; context.Add(skill); context.SaveChanges(); } }
public static void AddItem(long characterId, long itemId, long amount, int tab, int slot, int rarity) { using (Ms2DbContext context = new Ms2DbContext()) { Inventory inventory = context.Inventories.Find(characterId); Item item = new Item() { InventoryId = inventory.InventoryId, Id = itemId, Amount = amount, Tab = tab, Slot = slot, Rarity = rarity }; context.Add(item); context.SaveChanges(); } }