Add Shop / ShopCategory
This commit is contained in:
@@ -48,6 +48,9 @@ namespace reallife_gamemode.Model
|
|||||||
public DbSet<Server.Entities.FactionRank> FactionRanks { get; set; }
|
public DbSet<Server.Entities.FactionRank> FactionRanks { get; set; }
|
||||||
public DbSet<Server.Entities.FactionVehicle> FactionVehicles { get; set; }
|
public DbSet<Server.Entities.FactionVehicle> FactionVehicles { get; set; }
|
||||||
|
|
||||||
|
//Shops
|
||||||
|
public DbSet<Server.Entities.Shop> Shops { get; set; }
|
||||||
|
|
||||||
//Logs
|
//Logs
|
||||||
//public DbSet<Server.Logs.Ban> BanLogs { get; set; }
|
//public DbSet<Server.Logs.Ban> BanLogs { get; set; }
|
||||||
public DbSet<Server.Logs.BankAccountTransactionHistory> BankAccountTransactionLogs { get; set; }
|
public DbSet<Server.Logs.BankAccountTransactionHistory> BankAccountTransactionLogs { get; set; }
|
||||||
|
|||||||
31
Server/Entities/Shop.cs
Normal file
31
Server/Entities/Shop.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using reallife_gamemode.Server.Entities;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @overview Life of German Reallife - Entities Shop (Shop.cs)
|
||||||
|
* @author VegaZ
|
||||||
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace reallife_gamemode.Server.Entities
|
||||||
|
{
|
||||||
|
public class Shop
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string ShopName { get; set; }
|
||||||
|
public float Balance { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("ShopCategory")]
|
||||||
|
public int Category { get; set; }
|
||||||
|
public ShopCategory ShopCategory { get; set; }
|
||||||
|
|
||||||
|
public int Owner { get; set; }
|
||||||
|
public bool Active { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
23
Server/Entities/ShopCategory.cs
Normal file
23
Server/Entities/ShopCategory.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using reallife_gamemode.Server.Entities;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @overview Life of German Reallife - Entities ShopCategory (ShopCategory.cs)
|
||||||
|
* @author VegaZ
|
||||||
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace reallife_gamemode.Server.Entities
|
||||||
|
{
|
||||||
|
public class ShopCategory
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Category { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,6 +20,10 @@ namespace reallife_gamemode.Server.Entities
|
|||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("Shop")]
|
||||||
|
public int ShopId { get; set; }
|
||||||
|
public Shop Shop { get; set; }
|
||||||
|
|
||||||
public VehicleHash Model { get; set; }
|
public VehicleHash Model { get; set; }
|
||||||
[StringLength(32)]
|
[StringLength(32)]
|
||||||
public string ModelName { get; set; }
|
public string ModelName { get; set; }
|
||||||
|
|||||||
@@ -128,7 +128,8 @@ namespace reallife_gamemode.Server.Events
|
|||||||
{
|
{
|
||||||
using (var saveAll = new Model.DatabaseContext())
|
using (var saveAll = new Model.DatabaseContext())
|
||||||
{
|
{
|
||||||
//Alle User Vehicle
|
//TODO Fahrzeugschäden und Tankfüllstände
|
||||||
|
//User Vehicle
|
||||||
foreach (Vehicle v in LoadManager.UserVehicleList)
|
foreach (Vehicle v in LoadManager.UserVehicleList)
|
||||||
{
|
{
|
||||||
int ownerId = v.GetData("ownerId");
|
int ownerId = v.GetData("ownerId");
|
||||||
@@ -139,6 +140,17 @@ namespace reallife_gamemode.Server.Events
|
|||||||
userVehicle.Heading = v.Heading;
|
userVehicle.Heading = v.Heading;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Faction Vehicle
|
||||||
|
foreach (Vehicle v in LoadManager.FactionVehicleList)
|
||||||
|
{
|
||||||
|
int factionId = v.GetData("factionId");
|
||||||
|
Entities.UserVehicle factionVehicle = saveAll.UserVehicles.FirstOrDefault(u => u.UserId == factionId);
|
||||||
|
factionVehicle.PositionX = v.Position.X;
|
||||||
|
factionVehicle.PositionY = v.Position.Y;
|
||||||
|
factionVehicle.PositionZ = v.Position.Z;
|
||||||
|
factionVehicle.Heading = v.Heading;
|
||||||
|
}
|
||||||
|
|
||||||
//Alle Spieler
|
//Alle Spieler
|
||||||
foreach (Client player in NAPI.Pools.GetAllPlayers())
|
foreach (Client player in NAPI.Pools.GetAllPlayers())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user