From a9d76021bca46a723b7a50702b87fa1a6c0bb599 Mon Sep 17 00:00:00 2001 From: agavalda Date: Mon, 23 Dec 2024 21:52:46 +0100 Subject: [PATCH] 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 :) --- .../Commando/SptCommands/TraderCommand/TraderSptCommand.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/project/src/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.ts b/project/src/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.ts index 568246d3..4446c560 100644 --- a/project/src/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.ts +++ b/project/src/helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.ts @@ -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":