fix Financial Interest and set new Vehicle Taxation based on buy price

This commit is contained in:
Siga
2020-03-17 17:02:19 +01:00
parent 43bae1d4d4
commit 14cdab27af
3 changed files with 12 additions and 94 deletions

View File

@@ -17,6 +17,8 @@ namespace ReallifeGamemode.Database.Entities
public int UserId { get; set; } public int UserId { get; set; }
public User User { get; set; } public User User { get; set; }
public int? Price { get; set; }
public override string ToString() public override string ToString()
{ {
return "Spieler Fahrzeug | Besitzer: " + GetOwner().Name; return "Spieler Fahrzeug | Besitzer: " + GetOwner().Name;

View File

@@ -30,6 +30,9 @@ namespace ReallifeGamemode.Server.Finance
if (financialInterest >= 0.7) if (financialInterest >= 0.7)
financialInterest = 0.7f; financialInterest = 0.7f;
if (financialHelp > 2500)
financialHelp = 2500;
return (bankAccount, financialHelp, financialInterest); return (bankAccount, financialHelp, financialInterest);
} }
@@ -39,104 +42,16 @@ namespace ReallifeGamemode.Server.Finance
using (var dbContext = new DatabaseContext()) using (var dbContext = new DatabaseContext())
{ {
User user = client.GetUser(dbContext); User user = client.GetUser(dbContext);
foreach (VehicleHash vehHash in dbContext.UserVehicles.Where(u => u.UserId == user.Id).Select(u => u.Model)) foreach (UserVehicle uVeh in dbContext.UserVehicles.Where(u => u.UserId == user.Id))
{ {
int type = NAPI.Vehicle.GetVehicleClass(vehHash); if (uVeh.Price == null)
switch (type)
{ {
/* vehicleTaxation += 400;
0 Compacts continue;
1 Sedans }
2 SUVs vehicleTaxation += (int)(uVeh.Price * 0.005f);
3 Coupes }
4 Muscle
5 Sports
6 Sports
7 Super
8 Motorcycles
9 Off-Road
10 Industrial
11 Utility
12 Vans
13 Cycles
14 Boats
15 Helicopters
16 Planes
17 Service
18 Emergency
19 Military
20 Commercial
21 Trains
*/
case 0:
vehicleTaxation += 250;
break;
case 1:
vehicleTaxation += 350;
break;
case 2:
vehicleTaxation += 500;
break;
case 3:
vehicleTaxation += 400;
break;
case 4:
vehicleTaxation += 300;
break;
case 5:
vehicleTaxation += 800;
break;
case 6:
vehicleTaxation += 950;
break;
case 7:
vehicleTaxation += 0;
break;
case 8:
vehicleTaxation += 400;
break;
case 9:
vehicleTaxation += 500;
break;
case 10:
vehicleTaxation += 300;
break;
case 11:
vehicleTaxation += 0;
break;
case 12:
vehicleTaxation += 350;
break;
case 13:
vehicleTaxation += 0;
break;
case 14:
vehicleTaxation += 500;
break;
case 15:
vehicleTaxation += 650;
break;
case 16:
vehicleTaxation += 750;
break;
case 17:
vehicleTaxation += 0;
break;
case 18:
vehicleTaxation += 0;
break;
case 19:
vehicleTaxation += 0;
break;
case 20:
vehicleTaxation += 400;
break;
case 21:
vehicleTaxation += 69696969;
break;
}
}
} }
return vehicleTaxation; return vehicleTaxation;
} }

View File

@@ -183,6 +183,7 @@ namespace ReallifeGamemode.Server.Managers
PrimaryColor = 111, PrimaryColor = 111,
SecondaryColor = 111, SecondaryColor = 111,
Active = true, Active = true,
Price = price,
}; };
} }
else if (target == "Fraktion") else if (target == "Fraktion")