SES-152 Add Seed methods for Shopkeepers

This commit is contained in:
Karol Górzyński 2021-01-20 18:53:20 +01:00
parent 8fe7584682
commit 92fbe801b0
2 changed files with 208 additions and 6 deletions

View File

@ -42,6 +42,8 @@ namespace SessionCompanion.Database
public virtual DbSet<GameAction> GameActions { get; set; }
public virtual DbSet<LegendaryAction> LegendaryActions { get; set; }
public virtual DbSet<SpecialAbility> SpecialAbilities { get; set; }
public virtual DbSet<Shopkeeper> Shopkeepers { get; set; }
public virtual DbSet<ShopkeeperItem> ShopkeeperItems { get; set; }
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { }
@ -136,7 +138,6 @@ namespace SessionCompanion.Database
SpecialAbilitiesList = specAbilities;
return specAbilities;
}
protected IEnumerable<GameAction> SeedActions()
{
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
@ -164,7 +165,6 @@ namespace SessionCompanion.Database
GameActionsList = gameActions;
return gameActions;
}
protected IEnumerable<LegendaryAction> SeedLegendaryActions()
{
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
@ -192,7 +192,6 @@ namespace SessionCompanion.Database
LegendaryActionsList = legendaryActions;
return legendaryActions;
}
protected IEnumerable<Monster> SeedMonster()
{
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
@ -206,7 +205,6 @@ namespace SessionCompanion.Database
}
return monsters;
}
protected IEnumerable<MonsterSpecialAbility> SeedMonsterSpecialAbilities()
{
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
@ -231,7 +229,6 @@ namespace SessionCompanion.Database
}
return monsterSpecialAbilities;
}
protected IEnumerable<MonsterAction> SeedMonsterActions()
{
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
@ -256,7 +253,6 @@ namespace SessionCompanion.Database
}
return monsterActions;
}
protected IEnumerable<MonsterLegendaryAction> SeedMonsterLegendaryActions()
{
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
@ -314,6 +310,8 @@ namespace SessionCompanion.Database
builder.Entity<MonsterSpecialAbility>().HasData(SeedMonsterSpecialAbilities());
builder.Entity<MonsterAction>().HasData(SeedMonsterActions());
builder.Entity<MonsterLegendaryAction>().HasData(SeedMonsterLegendaryActions());
builder.Entity<Shopkeeper>().HasData(SeedData.SeedSchopkeepers());
builder.Entity<ShopkeeperItem>().HasData(SeedData.SeedShopkeeperItems());
}
}
}

View File

@ -843,5 +843,209 @@ namespace SessionCompanion.Database
};
return characterSpellSlots;
}
static public List<Shopkeeper> SeedSchopkeepers()
{
List<Shopkeeper> shopkeepers = new List<Shopkeeper>()
{
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<ShopkeeperItem> SeedShopkeeperItems()
{
List<ShopkeeperItem> shopkeeperItems = new List<ShopkeeperItem>()
{
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;
}
}
}