Log UserWeapon

This commit is contained in:
VegaZ
2021-04-11 19:28:12 +02:00
parent d27b205242
commit e0a34d8f00
6 changed files with 92 additions and 6 deletions

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace ReallifeGamemode.Database.Entities
{
public partial class UserWeapon
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[ForeignKey("User")]
public int UserId { get; set; }
public User User { get; set; }
[ForeignKey("Weapon")]
public int WeaponId { get; set; }
public Weapon Weapon { get; set; }
public int Ammo { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace ReallifeGamemode.Database.Entities
{
public partial class Weapon
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string WeaponModel { get; set; }
public string Category { get; set; }
public int SlotID { get; set; }
public int Ammo { get; set; }
public float Price { get; set; }
}
}

View File

@@ -74,6 +74,8 @@ namespace ReallifeGamemode.Database.Models
public DbSet<Entities.UserVehicle> UserVehicles { get; set; }
public DbSet<Entities.UserBankAccount> UserBankAccounts { get; set; }
public DbSet<Entities.UserWeapon> UserWeapons { get; set; }
//Inventar
public DbSet<Entities.UserItem> UserItems { get; set; }
@@ -85,8 +87,12 @@ namespace ReallifeGamemode.Database.Models
public DbSet<Entities.FactionVehicle> FactionVehicles { get; set; }
//Shops
public DbSet<Entities.ShopClothe> ShopClothes { get; set; }
public DbSet<Entities.ShopItem> ShopItems { get; set; }
public DbSet<Entities.Weapon> Weapons { get; set; }
//Logs
//public DbSet<Logs.Ban> BanLogs { get; set; }
public DbSet<Entities.Logs.BankAccountTransactionHistory> BankAccountTransactionLogs { get; set; }
public DbSet<Entities.Logs.Death> DeathLogs { get; set; }
@@ -155,12 +161,6 @@ namespace ReallifeGamemode.Database.Models
//Gangwar
public DbSet<Entities.Turfs> Turfs { get; set; }
//ClothesShop
public DbSet<Entities.ShopClothe> ShopClothes { get; set; }
//ItemShop
public DbSet<Entities.ShopItem> ShopItems { get; set; }
//Server Variablen
public DbSet<Entities.ServerVariable> ServerVariables { get; set; }
}

View File

@@ -6,6 +6,7 @@ using ReallifeGamemode.Server.Shop.SevenEleven;
using ReallifeGamemode.Server.Shop.Friseur;
using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Shop.Ammunation;
namespace ReallifeGamemode.Server.Managers
{
@@ -29,6 +30,8 @@ namespace ReallifeGamemode.Server.Managers
public static List<Player> cuffPoints = new List<Player>();
public static List<AmmunationPoint> AmmunationPoints = new List<AmmunationPoint>();
public static void LoadPositionManager()
{
#region DutyPoints
@@ -407,3 +410,9 @@ public class ElevatorPoint
public int FactionId { get; set; }
public string Stage { get; set; }
}
public class AmmunationPoint
{
public Vector3 Position { get; set; }
public Ammunation Ammunation { get; set; }
}

View File

@@ -14,6 +14,7 @@ namespace ReallifeGamemode.Server.Managers
public static List<ClotheShop> clotheStores = new List<ClotheShop>();
public static List<ItemShop> itemShops = new List<ItemShop>();
public static List<Friseur> FriseurStores = new List<Friseur>();
public static List<AmmunationPoint> Ammunations = new List<Ammunation>();
public static void LoadClotheShops()
{

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GTANetworkAPI;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
namespace ReallifeGamemode.Server.Shop.Ammunation
{
public class Ammunation
{
public Vector3 vector { get; set; }
public List<Weapon> weaponList = new List<Weapon>();
public Ammunation(Vector3 position)
{
this.vector = vector;
LoadWeapons();
}
public void LoadWeapons()
{
using (var dbContext = new DatabaseContext())
{
weaponList = dbContext.Weapons.ToList();
}
}
}
}