Continue Ammunation
This commit is contained in:
@@ -20,6 +20,7 @@ export default function ammunation(globalData: IGlobalData) {
|
||||
mp.events.add("AmmunationShop:LoadNativeUI", (weapons: Weapon[]) => {
|
||||
mp.gui.chat.activate(false);
|
||||
globalData.InMenu = true;
|
||||
mp.gui.chat.push(weapons.toString());
|
||||
|
||||
var ammunationMenu = new Menu("Ammunation", "", new Point(0, screenRes.y / 3), null, null);
|
||||
|
||||
|
||||
2
ReallifeGamemode.Client/global.d.ts
vendored
2
ReallifeGamemode.Client/global.d.ts
vendored
@@ -78,7 +78,7 @@ declare type FactionRank = {
|
||||
|
||||
declare type Weapon = {
|
||||
WeaponModel: string;
|
||||
Category: string;
|
||||
Category: number;
|
||||
SlotID: number;
|
||||
Ammo: number;
|
||||
Price: number;
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace ReallifeGamemode.Database.Entities
|
||||
{
|
||||
@@ -12,7 +13,9 @@ namespace ReallifeGamemode.Database.Entities
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
public string WeaponModel { get; set; }
|
||||
public string Category { get; set; }
|
||||
[ForeignKey("WeaponCategory")]
|
||||
public int CategoryId { get; set; }
|
||||
public WeaponCategory WeaponCategory { get; set; }
|
||||
public int SlotID { get; set; }
|
||||
public int Ammo { get; set; }
|
||||
public float Price { get; set; }
|
||||
|
||||
17
ReallifeGamemode.Database/Entities/WeaponCategory.cs
Normal file
17
ReallifeGamemode.Database/Entities/WeaponCategory.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
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 WeaponCategory
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
public string Category { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
1975
ReallifeGamemode.Database/Migrations/20210413201146_Ammunations.Designer.cs
generated
Normal file
1975
ReallifeGamemode.Database/Migrations/20210413201146_Ammunations.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,101 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ReallifeGamemode.Database.Migrations
|
||||
{
|
||||
public partial class Ammunations : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WeaponCategories",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Category = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WeaponCategories", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Weapons",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
WeaponModel = table.Column<string>(nullable: true),
|
||||
CategoryId = table.Column<int>(nullable: false),
|
||||
SlotID = table.Column<int>(nullable: false),
|
||||
Ammo = table.Column<int>(nullable: false),
|
||||
Price = table.Column<float>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Weapons", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Weapons_WeaponCategories_CategoryId",
|
||||
column: x => x.CategoryId,
|
||||
principalTable: "WeaponCategories",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UserWeapons",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
UserId = table.Column<int>(nullable: false),
|
||||
WeaponId = table.Column<int>(nullable: false),
|
||||
Ammo = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserWeapons", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_UserWeapons_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_UserWeapons_Weapons_WeaponId",
|
||||
column: x => x.WeaponId,
|
||||
principalTable: "Weapons",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserWeapons_UserId",
|
||||
table: "UserWeapons",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserWeapons_WeaponId",
|
||||
table: "UserWeapons",
|
||||
column: "WeaponId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Weapons_CategoryId",
|
||||
table: "Weapons",
|
||||
column: "CategoryId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "UserWeapons");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Weapons");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WeaponCategories");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1519,6 +1519,30 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
b.ToTable("UserItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserWeapon", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Ammo")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("WeaponId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.HasIndex("WeaponId");
|
||||
|
||||
b.ToTable("UserWeapons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleItem", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -1567,6 +1591,48 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
b.ToTable("VehicleMods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Weapon", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Ammo")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CategoryId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<float>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("SlotID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("WeaponModel")
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CategoryId");
|
||||
|
||||
b.ToTable("Weapons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.WeaponCategory", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Category")
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WeaponCategories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Whitelist", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -1844,6 +1910,21 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserWeapon", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.Weapon", "Weapon")
|
||||
.WithMany()
|
||||
.HasForeignKey("WeaponId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleItem", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.ServerVehicle", "Vehicle")
|
||||
@@ -1862,6 +1943,15 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Weapon", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.WeaponCategory", "WeaponCategory")
|
||||
.WithMany()
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupVehicle", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.Group", "Group")
|
||||
|
||||
@@ -90,6 +90,7 @@ namespace ReallifeGamemode.Database.Models
|
||||
public DbSet<Entities.ShopClothe> ShopClothes { get; set; }
|
||||
public DbSet<Entities.ShopItem> ShopItems { get; set; }
|
||||
public DbSet<Entities.Weapon> Weapons { get; set; }
|
||||
public DbSet<Entities.WeaponCategory> WeaponCategories { get; set; }
|
||||
|
||||
//Logs
|
||||
|
||||
|
||||
Binary file not shown.
@@ -122,6 +122,7 @@ namespace ReallifeGamemode.Server
|
||||
ShopManager.LoadClotheShops();
|
||||
ShopManager.LoadItemShops();
|
||||
ShopManager.LoadFriseur();
|
||||
ShopManager.LoadAmmunations();
|
||||
TuningManager.LoadTuningGarages();
|
||||
|
||||
TimeManager.StartTimeManager();
|
||||
|
||||
@@ -283,6 +283,13 @@ namespace ReallifeGamemode.Server.Managers
|
||||
NAPI.TextLabel.CreateTextLabel("24/7 - Dr\u00fccke ~y~E", s.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||
}
|
||||
|
||||
foreach (AmmunationPoint s in AmmunationPoints)
|
||||
{
|
||||
NAPI.Marker.CreateMarker(1, new Vector3(s.Position.X, s.Position.Y, s.Position.Z - 2), new Vector3(s.Position.X, s.Position.Y, s.Position.Z + 1),
|
||||
new Vector3(0, 0, 0), 2, new Color(255, 255, 255, 50), false, 0);
|
||||
NAPI.TextLabel.CreateTextLabel("Ammunation - Dr\u00fccke ~y~E", s.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||
}
|
||||
|
||||
#endregion Shops
|
||||
}
|
||||
|
||||
|
||||
@@ -37,15 +37,15 @@ namespace ReallifeGamemode.Server.Shop.Ammunation
|
||||
return;
|
||||
}
|
||||
|
||||
//List<Weapon> melee = weaponList.ToList().FindAll(w => w.Category == "Nahkampfwaffen");
|
||||
List<Weapon> handguns = weaponList.ToList().FindAll(w => w.Category == "Pistolen");
|
||||
//List<Weapon> smgs = weaponList.ToList().FindAll(w => w.Category == "Maschinenpistolen");
|
||||
//List<Weapon> shotguns = weaponList.ToList().FindAll(w => w.Category == "Schrotflinten");
|
||||
//List<Weapon> assaultrifles = weaponList.ToList().FindAll(w => w.Category == "Sturmgewehre");
|
||||
//List<Weapon> lmgs = weaponList.ToList().FindAll(w => w.Category == "Leichte Maschinengewehre");
|
||||
//List<Weapon> sniperrifles = weaponList.ToList().FindAll(w => w.Category == "Scharfschützengewehre");
|
||||
//List<Weapon> heavyweapons = weaponList.ToList().FindAll(w => w.Category == "Schwere Waffen");
|
||||
//List<Weapon> throwables = weaponList.ToList().FindAll(w => w.Category == "Werfbare Waffen");
|
||||
//List<Weapon> melee = weaponList.ToList().FindAll(w => w.Category == "Nahkampfwaffen"); //1
|
||||
List<Weapon> handguns = weaponList.ToList().FindAll(w => w.CategoryId == 2); //2
|
||||
//List<Weapon> smgs = weaponList.ToList().FindAll(w => w.Category == "Maschinenpistolen"); //3
|
||||
//List<Weapon> shotguns = weaponList.ToList().FindAll(w => w.Category == "Schrotflinten"); //4
|
||||
//List<Weapon> assaultrifles = weaponList.ToList().FindAll(w => w.Category == "Sturmgewehre"); //5
|
||||
//List<Weapon> lmgs = weaponList.ToList().FindAll(w => w.Category == "Leichte Maschinengewehre"); //6
|
||||
//List<Weapon> sniperrifles = weaponList.ToList().FindAll(w => w.Category == "Scharfschützengewehre"); //7
|
||||
//List<Weapon> heavyweapons = weaponList.ToList().FindAll(w => w.Category == "Schwere Waffen"); //8
|
||||
//List<Weapon> throwables = weaponList.ToList().FindAll(w => w.Category == "Werfbare Waffen"); //9
|
||||
|
||||
List<Array> shopWeapons = new List<Array>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user