From 92fbe801b0b702d58596e14027dd2f543fcdff4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20G=C3=B3rzy=C5=84ski?= Date: Wed, 20 Jan 2021 18:53:20 +0100 Subject: [PATCH] SES-152 Add Seed methods for Shopkeepers --- .../ApplicationDbContext.cs | 10 +- .../SessionCompanion.Database/SeedData.cs | 204 ++++++++++++++++++ 2 files changed, 208 insertions(+), 6 deletions(-) diff --git a/SessionCompanion/SessionCompanion.Database/ApplicationDbContext.cs b/SessionCompanion/SessionCompanion.Database/ApplicationDbContext.cs index 38457bb..a974f1b 100644 --- a/SessionCompanion/SessionCompanion.Database/ApplicationDbContext.cs +++ b/SessionCompanion/SessionCompanion.Database/ApplicationDbContext.cs @@ -42,6 +42,8 @@ namespace SessionCompanion.Database public virtual DbSet GameActions { get; set; } public virtual DbSet LegendaryActions { get; set; } public virtual DbSet SpecialAbilities { get; set; } + public virtual DbSet Shopkeepers { get; set; } + public virtual DbSet ShopkeeperItems { get; set; } public ApplicationDbContext(DbContextOptions options) : base(options) { } @@ -136,7 +138,6 @@ namespace SessionCompanion.Database SpecialAbilitiesList = specAbilities; return specAbilities; } - protected IEnumerable SeedActions() { const string file = "../SessionCompanion.Database/JsonData/monsters.json"; @@ -164,7 +165,6 @@ namespace SessionCompanion.Database GameActionsList = gameActions; return gameActions; } - protected IEnumerable SeedLegendaryActions() { const string file = "../SessionCompanion.Database/JsonData/monsters.json"; @@ -192,7 +192,6 @@ namespace SessionCompanion.Database LegendaryActionsList = legendaryActions; return legendaryActions; } - protected IEnumerable SeedMonster() { const string file = "../SessionCompanion.Database/JsonData/monsters.json"; @@ -206,7 +205,6 @@ namespace SessionCompanion.Database } return monsters; } - protected IEnumerable SeedMonsterSpecialAbilities() { const string file = "../SessionCompanion.Database/JsonData/monsters.json"; @@ -231,7 +229,6 @@ namespace SessionCompanion.Database } return monsterSpecialAbilities; } - protected IEnumerable SeedMonsterActions() { const string file = "../SessionCompanion.Database/JsonData/monsters.json"; @@ -256,7 +253,6 @@ namespace SessionCompanion.Database } return monsterActions; } - protected IEnumerable SeedMonsterLegendaryActions() { const string file = "../SessionCompanion.Database/JsonData/monsters.json"; @@ -314,6 +310,8 @@ namespace SessionCompanion.Database builder.Entity().HasData(SeedMonsterSpecialAbilities()); builder.Entity().HasData(SeedMonsterActions()); builder.Entity().HasData(SeedMonsterLegendaryActions()); + builder.Entity().HasData(SeedData.SeedSchopkeepers()); + builder.Entity().HasData(SeedData.SeedShopkeeperItems()); } } } diff --git a/SessionCompanion/SessionCompanion.Database/SeedData.cs b/SessionCompanion/SessionCompanion.Database/SeedData.cs index 24dac9c..2bd65a9 100644 --- a/SessionCompanion/SessionCompanion.Database/SeedData.cs +++ b/SessionCompanion/SessionCompanion.Database/SeedData.cs @@ -843,5 +843,209 @@ namespace SessionCompanion.Database }; return characterSpellSlots; } + static public List SeedSchopkeepers() + { + List shopkeepers = new List() + { + new Shopkeeper + { + Id = 1, + Name = "Swędzioch", + IsAvailable = true + }, + new Shopkeeper + { + Id = 2, + Name = "Lucius Prawowity", + IsAvailable = false + }, + new Shopkeeper + { + Id = 3, + Name = "Bohr Twarda Zbroja", + IsAvailable = true + }, + new Shopkeeper + { + Id = 4, + Name = "Skwarczyk Podobny", + IsAvailable = false + }, + new Shopkeeper + { + Id = 5, + Name = "Zielony spod Gruszkowego Lasu", + IsAvailable = true + }, + new Shopkeeper + { + Id = 6, + Name = "Zmarniały", + IsAvailable = false + } + }; + return shopkeepers; + } + static public List SeedShopkeeperItems() + { + List shopkeeperItems = new List() + { + new ShopkeeperItem + { + Id = 1, + ShopkeeperId = 1, + ArmorId = 2, + Amount = 3 + }, + new ShopkeeperItem + { + Id = 2, + ShopkeeperId = 1, + WeaponId = 33, + Amount = 5 + }, + new ShopkeeperItem + { + Id = 3, + ShopkeeperId = 1, + ArmorId = 10, + Amount = 20 + }, + new ShopkeeperItem + { + Id = 4, + ShopkeeperId = 1, + WeaponId = 17, + Amount = 34 + }, + new ShopkeeperItem + { + Id = 5, + ShopkeeperId = 1, + ArmorId = 12, + Amount = 12 + }, + new ShopkeeperItem + { + Id = 6, + ShopkeeperId = 2, + WeaponId = 3, + Amount = 48 + }, + new ShopkeeperItem + { + Id = 7, + ShopkeeperId = 2, + WeaponId = 25, + Amount = 25 + }, + new ShopkeeperItem + { + Id = 8, + ShopkeeperId = 2, + WeaponId = 14, + Amount = 34 + }, + new ShopkeeperItem + { + Id = 9, + ShopkeeperId = 3, + ArmorId = 1, + Amount = 44 + }, + new ShopkeeperItem + { + Id = 10, + ShopkeeperId = 3, + ArmorId = 8, + Amount = 2 + }, + new ShopkeeperItem + { + Id = 11, + ShopkeeperId = 3, + WeaponId = 7, + Amount = 21 + }, + new ShopkeeperItem + { + Id = 12, + ShopkeeperId = 4, + WeaponId = 1, + Amount = 36 + }, + new ShopkeeperItem + { + Id = 13, + ShopkeeperId = 4, + WeaponId = 24, + Amount = 5 + }, + new ShopkeeperItem + { + Id = 14, + ShopkeeperId = 4, + WeaponId = 14, + Amount = 13 + }, + new ShopkeeperItem + { + Id = 15, + ShopkeeperId = 4, + ArmorId = 11, + Amount = 19 + }, + new ShopkeeperItem + { + Id = 16, + ShopkeeperId = 5, + ArmorId = 6, + Amount = 17 + }, + new ShopkeeperItem + { + Id = 17, + ShopkeeperId = 5, + ArmorId = 9, + Amount = 3 + }, + new ShopkeeperItem + { + Id = 18, + ShopkeeperId = 5, + ArmorId = 7, + Amount = 1 + }, + new ShopkeeperItem + { + Id = 19, + ShopkeeperId = 6, + ArmorId = 2, + Amount = 6 + }, + new ShopkeeperItem + { + Id = 20, + ShopkeeperId = 6, + ArmorId = 13, + Amount = 9 + }, + new ShopkeeperItem + { + Id = 21, + ShopkeeperId = 6, + ArmorId = 10, + Amount = 12 + }, + new ShopkeeperItem + { + Id = 22, + ShopkeeperId = 6, + WeaponId = 37, + Amount = 6 + } + }; + return shopkeeperItems; + } } }