mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-06 04:55:10 +00:00
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:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user