Fixed quick chat text injection (#1144)

## Description:
https://github.com/openfrontio/OpenFrontIO/issues/1035
Fixes #1035 
## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

.w.

---------

Co-authored-by: Scott Anderson <scottanderson@users.noreply.github.com>
Co-authored-by: evanpelle <evanpelle@gmail.com>
This commit is contained in:
Aotumuri
2025-06-14 01:21:22 +09:00
committed by GitHub
parent 9717c95c34
commit e68d48c3a8
10 changed files with 44 additions and 47 deletions
+1 -1
View File
@@ -122,7 +122,7 @@ export class Executor {
player,
intent.recipient,
intent.quickChatKey,
intent.variables ?? {},
intent.target,
);
case "mark_disconnected":
return new MarkDisconnectedExecution(player, intent.isDisconnected);
+5 -8
View File
@@ -10,7 +10,7 @@ export class QuickChatExecution implements Execution {
private sender: Player,
private recipientID: PlayerID,
private quickChatKey: string,
private variables: Record<string, string>,
private target: PlayerID | undefined,
) {}
init(mg: Game, ticks: number): void {
@@ -27,12 +27,12 @@ export class QuickChatExecution implements Execution {
}
tick(ticks: number): void {
const message = this.getMessageFromKey(this.quickChatKey, this.variables);
const message = this.getMessageFromKey(this.quickChatKey);
this.mg.displayChat(
message[1],
message[0],
this.variables,
this.target,
this.recipient.id(),
true,
this.sender.name(),
@@ -41,7 +41,7 @@ export class QuickChatExecution implements Execution {
this.mg.displayChat(
message[1],
message[0],
this.variables,
this.target,
this.sender.id(),
false,
this.recipient.name(),
@@ -66,10 +66,7 @@ export class QuickChatExecution implements Execution {
return false;
}
private getMessageFromKey(
fullKey: string,
vars: Record<string, string>,
): string[] {
private getMessageFromKey(fullKey: string): string[] {
const translated = fullKey.split(".");
return translated;
}