From 8c0e440d2e71d512d5c1368324003ba68c7f26cb Mon Sep 17 00:00:00 2001 From: hydrant Date: Sun, 11 Apr 2021 00:05:45 +0200 Subject: [PATCH] =?UTF-8?q?frak=20lohn=20dynamisch=20(3000=20/=20anzahl=20?= =?UTF-8?q?r=C3=A4nge)=20*=20rang?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ReallifeGamemode.Server/Finance/Economy.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ReallifeGamemode.Server/Finance/Economy.cs b/ReallifeGamemode.Server/Finance/Economy.cs index ac805cd7..f8d0672f 100644 --- a/ReallifeGamemode.Server/Finance/Economy.cs +++ b/ReallifeGamemode.Server/Finance/Economy.cs @@ -85,12 +85,17 @@ namespace ReallifeGamemode.Server.Finance if (user.Faction != null && user.FactionRank != null) { - int factioWage = user.FactionRank.Order * 300; + using var dbContext = new DatabaseContext(); + int factionRankCount = dbContext.FactionRanks.Where(r => r.FactionId == user.FactionId).Count(); + + int factionWage = (3000 / factionRankCount) * user.FactionRank.Order; if (wage > 2500) - factioWage /= 2; - else - factionMoney = factioWage; + { + factionWage /= 2; + } + + factionMoney = factionWage; } int otheramount = user.otheramount; int amount = wage - (int)(wage * financialInterest) - vehicleTaxation - (int)propertyTax + (int)financialHelp - rentalFees - healthInsurance + (factionMoney ?? 0) + otheramount;