mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-22 23:35:21 +00:00
fix: code rabit suggestions
This commit is contained in:
@@ -724,8 +724,20 @@ export class EventsDisplay extends LitElement implements Layer {
|
||||
|
||||
const unitView = this.game.unit(event.unitID);
|
||||
|
||||
// Format the message for NAVAL_INVASION_INBOUND to display formatted troop count
|
||||
let description = event.message;
|
||||
if (event.messageType === MessageType.NAVAL_INVASION_INBOUND && unitView) {
|
||||
// Replace raw troop count with formatted version
|
||||
// Message format: "Boat: {troops} {attackerName}"
|
||||
const formattedTroops = renderTroops(unitView.troops());
|
||||
description = event.message.replace(
|
||||
/Boat: \d+/,
|
||||
`Boat: ${formattedTroops}`,
|
||||
);
|
||||
}
|
||||
|
||||
this.addEvent({
|
||||
description: event.message,
|
||||
description: description,
|
||||
type: event.messageType,
|
||||
unsafeDescription: false,
|
||||
highlight: true,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { renderTroops } from "../../client/Utils";
|
||||
import {
|
||||
Execution,
|
||||
Game,
|
||||
@@ -145,7 +144,7 @@ export class TransportShipExecution implements Execution {
|
||||
mg.displayIncomingUnit(
|
||||
this.boat.id(),
|
||||
// TODO TranslateText
|
||||
`Boat: ${renderTroops(this.boat.troops())} ${this.attacker.displayName()}`,
|
||||
`Boat: ${this.boat.troops()} ${this.attacker.displayName()}`,
|
||||
MessageType.NAVAL_INVASION_INBOUND,
|
||||
this.targetID,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user