Continue Finance System

This commit is contained in:
Lukas Moungos
2019-07-06 17:28:03 +02:00
parent a1bbc196cf
commit 33255fc97e
2 changed files with 23 additions and 6 deletions

View File

@@ -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.");
}
}
}