Skip to content

Commit

Permalink
fix wage console
Browse files Browse the repository at this point in the history
  • Loading branch information
Rxup committed Mar 21, 2024
1 parent aa70fcc commit 0557b7c
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions Content.Server/Backmen/Economy/WageConsole/WageConsoleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void OnBonusMsg(Entity<WageConsoleComponent> ent, ref BonusWageRowMsg ar
}

_adminLogger.Add(LogType.Transactions, LogImpact.Extreme,
$"Player {args.Session.Name} use BonusSystem on accountId {wagePayout.ToAccountNumber.Comp.AccountNumber} with name {wagePayout.ToAccountNumber:entity} and add {args.Wage}");
$"wage, player {ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} use bonus on accountId {wagePayout.ToAccountNumber.Comp.AccountNumber} with name {wagePayout.ToAccountNumber:entity} and add {args.Wage}");

QueueLocalEvent(new WagePaydayEvent()
{
Expand Down Expand Up @@ -116,7 +116,7 @@ private void OnEditWageRow(Entity<WageConsoleComponent> ent, ref SaveEditedWageR
}

_adminLogger.Add(LogType.Transactions, LogImpact.Extreme,
$"Player {args.Session.Name} use EditPayoutSystem on accountId {wagePayout.ToAccountNumber.Comp.AccountNumber} with name {wagePayout.ToAccountNumber:entity} and set payout to {args.Wage}");
$"wage, player {ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} use edit on accountId {wagePayout.ToAccountNumber.Comp.AccountNumber} with name {wagePayout.ToAccountNumber.Owner:entity} and set payout to {args.Wage}");

wagePayout.PayoutAmount = args.Wage;
UpdateUserInterface(ent);
Expand All @@ -132,16 +132,20 @@ private void OnOpenWageRow(Entity<WageConsoleComponent> ent, ref OpenWageRowMsg
return;
}

if(!TryComp<MetaDataComponent>(wagePayout.FromAccountNumber, out var mdFrom) ||
!TryComp<MetaDataComponent>(wagePayout.ToAccountNumber, out var mdTp))
return;

_ui.TrySetUiState(ent, WageUiKey.Key, new OpenEditWageConsoleUi
{
Row = new UpdateWageRow
{
Id = wagePayout.Id,
FromId = GetNetEntity(wagePayout.FromAccountNumber),
FromName = Name(wagePayout.FromAccountNumber),
FromId = GetNetEntity(wagePayout.FromAccountNumber, mdFrom),
FromName = Name(wagePayout.FromAccountNumber, mdFrom),
FromAccount = wagePayout.FromAccountNumber.Comp.AccountNumber,
ToId = GetNetEntity(wagePayout.ToAccountNumber),
ToName = Name(wagePayout.ToAccountNumber),
ToId = GetNetEntity(wagePayout.ToAccountNumber, mdTp),
ToName = Name(wagePayout.ToAccountNumber, mdTp),
ToAccount = wagePayout.ToAccountNumber.Comp.AccountNumber,
Wage = wagePayout.PayoutAmount,
}
Expand All @@ -159,15 +163,18 @@ private void UpdateUserInterface(Entity<WageConsoleComponent> ent)

foreach (var wagePayout in _wageManager.PayoutsList)
{
if(!TryComp<MetaDataComponent>(wagePayout.FromAccountNumber, out var mdFrom) ||
!TryComp<MetaDataComponent>(wagePayout.ToAccountNumber, out var mdTp))
continue;
msg.Records.Add(new UpdateWageRow
{
Id = wagePayout.Id,

FromId = GetNetEntity(wagePayout.FromAccountNumber),
FromName = Name(wagePayout.FromAccountNumber),
FromId = GetNetEntity(wagePayout.FromAccountNumber, mdFrom),
FromName = Name(wagePayout.FromAccountNumber,mdFrom),
FromAccount = wagePayout.FromAccountNumber.Comp.AccountNumber,
ToId = GetNetEntity(wagePayout.ToAccountNumber),
ToName = Name(wagePayout.ToAccountNumber),
ToId = GetNetEntity(wagePayout.ToAccountNumber, mdTp),
ToName = Name(wagePayout.ToAccountNumber,mdTp),
ToAccount = wagePayout.ToAccountNumber.Comp.AccountNumber,
Wage = wagePayout.PayoutAmount,
});
Expand Down

0 comments on commit 0557b7c

Please sign in to comment.