0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-12 15:50:42 -05:00

Allow to set reputation as decimal in TraderCommand (#994)

Since the reputation levels are expressed as decimals i found it weird
that you can only set integers. This PR changes the way the reputation
is set:
`spt trader prapor rep 44` won't set 44 to the reputation (which is way
higher than anyone can get) but 0.44, this allows to test loyalty levels
more granular:

![image](https://github.com/user-attachments/assets/4e706f63-2d25-4f4c-9501-e6379174dc16)

![image](https://github.com/user-attachments/assets/61edb0f7-fc0b-4e7c-869f-09a30efa50dc)

Updating the regex and then testing that only decimals are used for
`rep` and not for `spend` looked to messy.

PS: This is my first PR here :)
This commit is contained in:
agavalda 2024-12-23 21:52:46 +01:00 committed by GitHub
parent db5701fd65
commit a9d76021bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -56,7 +56,7 @@ export class TraderSptCommand implements ISptCommand {
const trader: string = result.groups.trader;
const command: string = result.groups.command;
const quantity: number = +result.groups.quantity;
let quantity: number = +result.groups.quantity;
const dbTrader = Object.values(this.databaseService.getTraders()).find(
(t) => t.base.nickname.toLocaleLowerCase() === trader.toLocaleLowerCase(),
@ -72,6 +72,7 @@ export class TraderSptCommand implements ISptCommand {
let profileChangeEventType: ProfileChangeEventType;
switch (command) {
case "rep":
quantity = quantity / 100;
profileChangeEventType = ProfileChangeEventType.TRADER_STANDING;
break;
case "spend":