Continue Finance System
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Server.Entities;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Finance;
|
||||
using ReallifeGamemode.Server.Models;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
@@ -10,6 +11,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
{
|
||||
class UserCommands : Script
|
||||
{
|
||||
|
||||
[Command("car", "~m~Benutzung: ~s~/car")]
|
||||
public void CmdUserCar(Client player)
|
||||
{
|
||||
@@ -32,8 +34,19 @@ namespace ReallifeGamemode.Server.Commands
|
||||
[Command("paycheck", "~m~Benutzung: ~s~/paycheck")]
|
||||
public void CmdUserPaycheck(Client client)
|
||||
{
|
||||
ChatService.SendMessage(client, "~g~[PAYCHECK] -------------------------------------------------------");
|
||||
|
||||
|
||||
User user = client.GetUser();
|
||||
if (Economy.Paychecks.ContainsKey(user.Id))
|
||||
{
|
||||
ChatService.SendMessage(client, "~g~[PAYCHECK] -------------------------------------------------------");
|
||||
ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Lohn : ~g~+$" + Economy.Paychecks[user.Id].Wage);
|
||||
ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Fahrzeugsteuer : ~r~-$" + Economy.Paychecks[user.Id].VehicleTaxation);
|
||||
ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Grundsteuer (Haus) : ~r~-$" + Economy.Paychecks[user.Id].PropertyTaxation);
|
||||
ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Steuer : ~r~" + (int)(Economy.Paychecks[user.Id].FinancialInterest * 100) + " %");
|
||||
ChatService.SendMessage(client, "");
|
||||
ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Ausgaben : ~r~-$" + (Economy.Paychecks[user.Id].Wage - Economy.Paychecks[user.Id].Amount));
|
||||
ChatService.SendMessage(client, "~g~[PAYCHECK] -------------------------------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,11 +21,13 @@ namespace ReallifeGamemode.Server.Finance
|
||||
{
|
||||
public static Dictionary<int, Paycheck> Paychecks { get; set; } = new Dictionary<int, Paycheck>();
|
||||
|
||||
public static (int, float, float) GetEconomyClass(Client client)
|
||||
public static (int, float, float) GetEconomyClass(Client client, int wage)
|
||||
{
|
||||
int bankAccount = client.GetUser().GetBankAccount().Balance;
|
||||
float financialHelp = (float)Math.Pow(-1.0005, -bankAccount) * -1000;
|
||||
float financialInterest = 1 - (float)Math.Pow(1.00005, -bankAccount) * 1;
|
||||
float financialInterest = 1 - (float)Math.Pow(1.00006, -wage) * 1;
|
||||
if (financialInterest >= 0.7)
|
||||
financialInterest = 0.7f;
|
||||
|
||||
return (bankAccount, financialHelp, financialInterest);
|
||||
}
|
||||
@@ -153,14 +155,15 @@ namespace ReallifeGamemode.Server.Finance
|
||||
|
||||
public static void SetPaycheck(Client client, int wage)
|
||||
{
|
||||
(int bankAccount, float financialHelp, float financialInterest) = GetEconomyClass(client);
|
||||
(int bankAccount, float financialHelp, float financialInterest) = GetEconomyClass(client, wage);
|
||||
float propertyTax = GetPropertyTaxation(client);
|
||||
int vehicleTaxation = GetVehicleTaxation(client);
|
||||
|
||||
int amount = wage - (int)(wage * financialInterest) - vehicleTaxation - (int)propertyTax + (int)financialHelp;
|
||||
|
||||
Paycheck paycheck = new Paycheck(financialHelp, financialInterest, vehicleTaxation, propertyTax, wage, amount);
|
||||
|
||||
User user = client.GetUser();
|
||||
Paychecks[user.Id] = paycheck;
|
||||
ReleasePayDay(client, paycheck);
|
||||
}
|
||||
|
||||
@@ -175,6 +178,7 @@ namespace ReallifeGamemode.Server.Finance
|
||||
ChatService.SendMessage(client, "~g~[PAYDAY]~s~ Du hast einen Payday von ~g~$" + paycheck.Amount + "~s~ bekommen.");
|
||||
else
|
||||
ChatService.SendMessage(client, "~g~[PAYDAY]~s~ Du hast einen Payday von ~r~$" + paycheck.Amount + "~s~ bekommen.");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user