Change vehicle taxation
see https://life-of-german.org/bugtracker/bug/60-neue-fahrzeugsteuern/ @hydrant update DB before merge with master.
This commit is contained in:
@@ -15,10 +15,13 @@ namespace ReallifeGamemode.Database.Entities
|
||||
{
|
||||
[ForeignKey("User")]
|
||||
public int UserId { get; set; }
|
||||
|
||||
public User User { get; set; }
|
||||
|
||||
public int? Price { get; set; }
|
||||
|
||||
public int? BusinessId { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Spieler Fahrzeug | Besitzer: " + GetOwner().Name;
|
||||
|
||||
2177
ReallifeGamemode.Database/Migrations/20210421190610_UserVehicleBusinessId.Designer.cs
generated
Normal file
2177
ReallifeGamemode.Database/Migrations/20210421190610_UserVehicleBusinessId.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,109 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ReallifeGamemode.Database.Migrations
|
||||
{
|
||||
public partial class UserVehicleBusinessId : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ChatLogs_Users_UserId",
|
||||
table: "ChatLogs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ChatLogs_Factions_FactionId",
|
||||
table: "ChatLogs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ChatLogs_Groups_GroupId",
|
||||
table: "ChatLogs");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "UserVehicle_BusinessId",
|
||||
table: "ServerVehicles",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "UserId",
|
||||
table: "ChatLogs",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ChatLogs_Users_UserId",
|
||||
table: "ChatLogs",
|
||||
column: "UserId",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ChatLogs_Factions_FactionId",
|
||||
table: "ChatLogs",
|
||||
column: "FactionId",
|
||||
principalTable: "Factions",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ChatLogs_Groups_GroupId",
|
||||
table: "ChatLogs",
|
||||
column: "GroupId",
|
||||
principalTable: "Groups",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ChatLogs_Users_UserId",
|
||||
table: "ChatLogs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ChatLogs_Factions_FactionId",
|
||||
table: "ChatLogs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ChatLogs_Groups_GroupId",
|
||||
table: "ChatLogs");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UserVehicle_BusinessId",
|
||||
table: "ServerVehicles");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "UserId",
|
||||
table: "ChatLogs",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int));
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ChatLogs_Users_UserId",
|
||||
table: "ChatLogs",
|
||||
column: "UserId",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ChatLogs_Factions_FactionId",
|
||||
table: "ChatLogs",
|
||||
column: "FactionId",
|
||||
principalTable: "Factions",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ChatLogs_Groups_GroupId",
|
||||
table: "ChatLogs",
|
||||
column: "GroupId",
|
||||
principalTable: "Groups",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -814,7 +814,7 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int?>("UserId")
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
@@ -1749,7 +1749,7 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
{
|
||||
b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry");
|
||||
|
||||
b.Property<int?>("FactionId")
|
||||
b.Property<int>("FactionId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasIndex("FactionId");
|
||||
@@ -1768,7 +1768,7 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
{
|
||||
b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry");
|
||||
|
||||
b.Property<int?>("GroupId")
|
||||
b.Property<int>("GroupId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
@@ -1891,6 +1891,10 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
{
|
||||
b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle");
|
||||
|
||||
b.Property<int?>("BusinessId")
|
||||
.HasColumnName("UserVehicle_BusinessId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("Price")
|
||||
.HasColumnName("UserVehicle_Price")
|
||||
.HasColumnType("int");
|
||||
@@ -2011,7 +2015,9 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId");
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.CommandLogEntry", b =>
|
||||
@@ -2134,14 +2140,18 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction")
|
||||
.WithMany()
|
||||
.HasForeignKey("FactionId");
|
||||
.HasForeignKey("FactionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.GroupChatLogEntry", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.Group", "Group")
|
||||
.WithMany()
|
||||
.HasForeignKey("GroupId");
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupVehicle", b =>
|
||||
|
||||
@@ -44,11 +44,31 @@ namespace ReallifeGamemode.Server.Finance
|
||||
foreach (UserVehicle uVeh in dbContext.UserVehicles.Where(u => u.UserId == user.Id))
|
||||
{
|
||||
if (uVeh.Price == null)
|
||||
{
|
||||
vehicleTaxation += 400;
|
||||
continue;
|
||||
}
|
||||
vehicleTaxation += (int)(uVeh.Price * 0.005f);
|
||||
else
|
||||
vehicleTaxation += (int)(uVeh.Price * 0.0015f);
|
||||
|
||||
int taxation = uVeh.BusinessId switch
|
||||
{
|
||||
3 => 75, ///<see cref="Business.VapidCarDealerBusiness"/>
|
||||
4 => 200, ///<see cref="Business.PremiumDeluxeMotorsportCarDealerBusiness"/>
|
||||
5 => 150, ///<see cref="Business.BoatDealerBusiness"/>
|
||||
6 => 150, ///<see cref="Business.HelicopterDealerBusiness"/>
|
||||
7 => 150, ///<see cref="Business.AirplaneDealerBusiness"/>
|
||||
8 => 50, ///<see cref="Business.BikeDealerBusiness"/>
|
||||
9 => 20, ///<see cref="Business.BeachDealerBusiness"/>
|
||||
10 => 50, ///<see cref="Business.LastTrainDealerBusiness"/>
|
||||
11 => 100, ///<see cref="Business.SUVDealerBusiness"/>
|
||||
12 => 50, ///<see cref="Business.AdminDealerBusiness"/>
|
||||
13 => 100, ///<see cref="Business.ClassicAndLuxuryCarshop"/>
|
||||
14 => 200, ///<see cref="Business.OldschoolCarshop"/>
|
||||
_ => 0,
|
||||
};
|
||||
|
||||
if (taxation is 0)
|
||||
Console.WriteLine($"[FINANCE] USER: {user.Name} ({user.Id}) has no BusinessId on UserVehicle ({uVeh.Id})");
|
||||
|
||||
vehicleTaxation += taxation;
|
||||
}
|
||||
}
|
||||
return vehicleTaxation;
|
||||
|
||||
Reference in New Issue
Block a user