mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-25 08:24:36 +00:00
Merge branch 'v26'
This commit is contained in:
@@ -500,7 +500,7 @@
|
||||
},
|
||||
"win_modal": {
|
||||
"support_openfront": "Support OpenFront!",
|
||||
"territory_pattern": "Purchase a territory pattern to support OpenFront!",
|
||||
"territory_pattern": "Purchase a territory skin to go ad-free!",
|
||||
"died": "You died",
|
||||
"your_team": "Your team won!",
|
||||
"other_team": "{team} team has won!",
|
||||
|
||||
@@ -49,6 +49,7 @@ export class GutterAds extends LitElement {
|
||||
}
|
||||
|
||||
public hide(): void {
|
||||
this.isVisible = false;
|
||||
console.log("hiding GutterAds");
|
||||
this.destroyAds();
|
||||
this.requestUpdate();
|
||||
|
||||
@@ -350,6 +350,13 @@ class Client {
|
||||
"Sharing this ID will allow others to view your game history and stats.",
|
||||
);
|
||||
this.patternsModal.onUserMe(userMeResponse);
|
||||
const flares = (userMeResponse.player.flares ?? []).filter((flare) =>
|
||||
flare.startsWith("pattern:"),
|
||||
);
|
||||
if (flares.length > 0) {
|
||||
console.log("Hiding gutter ads because you have patterns");
|
||||
this.gutterAds.hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -496,7 +496,7 @@ export class Transport {
|
||||
type: "donate_gold",
|
||||
clientID: this.lobbyConfig.clientID,
|
||||
recipient: event.recipient.id(),
|
||||
gold: event.gold,
|
||||
gold: event.gold ? Number(event.gold) : null,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -278,7 +278,7 @@ export const EmbargoIntentSchema = BaseIntentSchema.extend({
|
||||
export const DonateGoldIntentSchema = BaseIntentSchema.extend({
|
||||
type: z.literal("donate_gold"),
|
||||
recipient: ID,
|
||||
gold: z.bigint().nullable(),
|
||||
gold: z.number().nullable(),
|
||||
});
|
||||
|
||||
export const DonateTroopIntentSchema = BaseIntentSchema.extend({
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
import { Execution, Game, Gold, Player, PlayerID } from "../game/Game";
|
||||
import { toInt } from "../Util";
|
||||
|
||||
export class DonateGoldExecution implements Execution {
|
||||
private recipient: Player;
|
||||
|
||||
private active = true;
|
||||
private gold: Gold;
|
||||
|
||||
constructor(
|
||||
private sender: Player,
|
||||
private recipientID: PlayerID,
|
||||
private gold: Gold | null,
|
||||
) {}
|
||||
goldNum: number | null,
|
||||
) {
|
||||
this.gold = toInt(goldNum ?? 0);
|
||||
}
|
||||
|
||||
init(mg: Game, ticks: number): void {
|
||||
if (!mg.hasPlayer(this.recipientID)) {
|
||||
|
||||
@@ -55,6 +55,11 @@ export class WarshipExecution implements Execution {
|
||||
this.warship.delete();
|
||||
return;
|
||||
}
|
||||
if (this.warship.owner().isDisconnected()) {
|
||||
this.warship.delete();
|
||||
return;
|
||||
}
|
||||
|
||||
const hasPort = this.warship.owner().unitCount(UnitType.Port) > 0;
|
||||
if (hasPort) {
|
||||
this.warship.modifyHealth(1);
|
||||
|
||||
@@ -79,8 +79,8 @@ export class MapPlaylist {
|
||||
|
||||
// Create the default public game config (from your GameManager)
|
||||
return {
|
||||
donateGold: false,
|
||||
donateTroops: false,
|
||||
donateGold: mode === GameMode.Team,
|
||||
donateTroops: mode === GameMode.Team,
|
||||
gameMap: map,
|
||||
maxPlayers: config.lobbyMaxPlayers(map, mode, playerTeams),
|
||||
gameType: GameType.Public,
|
||||
|
||||
@@ -41,6 +41,12 @@ export class PrivilegeCheckerImpl implements PrivilegeChecker {
|
||||
return { type: "forbidden", reason: "invalid color: " + e.message };
|
||||
}
|
||||
}
|
||||
if (refs.flag) {
|
||||
cosmetics.flag = cosmetics.flag = refs.flag.replace(
|
||||
/[^a-z0-9-_ ()]/gi,
|
||||
"",
|
||||
);
|
||||
}
|
||||
|
||||
return { type: "allowed", cosmetics };
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ describe("Donate gold to an ally", () => {
|
||||
donor.addGold(6000n);
|
||||
const donorGoldBefore = donor.gold();
|
||||
const recipientGoldBefore = recipient.gold();
|
||||
game.addExecution(new DonateGoldExecution(donor, recipientInfo.id, 5000n));
|
||||
game.addExecution(new DonateGoldExecution(donor, recipientInfo.id, 5000));
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
game.executeNextTick();
|
||||
@@ -242,7 +242,7 @@ describe("Donate Gold to a non ally", () => {
|
||||
const donorGoldBefore = donor.gold();
|
||||
const recipientGoldBefore = donor.gold();
|
||||
|
||||
game.addExecution(new DonateGoldExecution(donor, recipientInfo.id, 5000n));
|
||||
game.addExecution(new DonateGoldExecution(donor, recipientInfo.id, 5000));
|
||||
game.executeNextTick();
|
||||
|
||||
// Gold should not be donated since they are not allies
|
||||
|
||||
Reference in New Issue
Block a user