Merge branch 'v26'

This commit is contained in:
evanpelle
2025-10-28 14:10:27 -07:00
34 changed files with 249 additions and 74 deletions
+1
View File
@@ -545,6 +545,7 @@ export const ClientMessageSchema = z.discriminatedUnion("type", [
export const PlayerRecordSchema = PlayerSchema.extend({
persistentID: PersistentIdSchema.nullable(), // WARNING: PII
clanTag: z.string().optional(),
stats: PlayerStatsSchema,
});
export type PlayerRecord = z.infer<typeof PlayerRecordSchema>;
+14 -5
View File
@@ -289,17 +289,17 @@ export function createRandomName(
}
export const emojiTable = [
["😀", "😊", "🥰", "😇", "😎"],
["😀", "😊", "😇", "😎", "😈"],
["😞", "🥺", "😭", "😱", "😡"],
["😈", "🤡", "🖕", "🥱", "🤦‍♂️"],
["👋", "👏", "🤌", "💪", "🫡"],
["", "🥱", "🤦‍♂️", "🖕", "🤡"],
["👋", "👏", "👻", "💪", "🎃"],
["👍", "👎", "❓", "🐔", "🐀"],
["🤝", "🆘", "🕊️", "🏳️", ""],
["🆘", "🤝", "🕊️", "🏳️", "🛡️"],
["🔥", "💥", "💀", "☢️", "⚠️"],
["↖️", "⬆️", "↗️", "👑", "🥇"],
["⬅️", "🎯", "➡️", "🥈", "🥉"],
["↙️", "⬇️", "↘️", "❤️", "💔"],
["💰", "", "", "🏡", "🛡️"],
["💰", "🏭", "🚂", "", ""],
] as const;
// 2d to 1d array
export const flattenedEmojiTable = emojiTable.flat();
@@ -320,3 +320,12 @@ export function sigmoid(
): number {
return 1 / (1 + Math.exp(-decayRate * (value - midpoint)));
}
// Compute clan from name
export function getClanTag(name: string): string | null {
if (!name.includes("[") || !name.includes("]")) {
return null;
}
const clanMatch = name.match(/\[([a-zA-Z0-9]{2,5})\]/);
return clanMatch ? clanMatch[1].toUpperCase() : null;
}
+9 -9
View File
@@ -18,7 +18,7 @@ export class PastelTheme implements Theme {
private nationColorAllocator = new ColorAllocator(nationColors, nationColors);
private background = colord({ r: 60, g: 60, b: 60 });
private shore = colord({ r: 204, g: 203, b: 158 });
private shore = colord({ r: 223, g: 187, b: 132 });
private falloutColors = [
colord({ r: 120, g: 255, b: 71 }), // Original color
colord({ r: 130, g: 255, b: 85 }), // Slightly lighter
@@ -26,8 +26,8 @@ export class PastelTheme implements Theme {
colord({ r: 125, g: 255, b: 75 }), // Warmer tint
colord({ r: 115, g: 250, b: 68 }), // Cooler tint
];
private water = colord({ r: 70, g: 132, b: 180 });
private shorelineWater = colord({ r: 100, g: 143, b: 255 });
private water = colord({ r: 80, g: 76, b: 179 });
private shorelineWater = colord({ r: 100, g: 110, b: 255 });
/** Alternate View colors for self, green */
private _selfColor = colord({ r: 0, g: 255, b: 0 });
@@ -108,15 +108,15 @@ export class PastelTheme implements Theme {
}
case TerrainType.Plains:
return colord({
r: 190,
g: 220 - 2 * mag,
b: 138,
r: 216,
g: 205 - 2 * mag,
b: 127,
});
case TerrainType.Highland:
return colord({
r: 200 + 2 * mag,
g: 183 + 2 * mag,
b: 138 + 2 * mag,
r: 223 + 2 * mag,
g: 187 + 2 * mag,
b: 132 + 2 * mag,
});
case TerrainType.Mountain:
return colord({
+1 -1
View File
@@ -20,7 +20,7 @@ const EMOJI_ASSIST_ACCEPT = (["👍", "⛵", "🤝", "🎯"] as const).map(emoji
const EMOJI_RELATION_TOO_LOW = (["🥱", "🤦‍♂️"] as const).map(emojiId);
const EMOJI_TARGET_ME = (["🥺", "💀"] as const).map(emojiId);
const EMOJI_TARGET_ALLY = (["🕊️", "👎"] as const).map(emojiId);
export const EMOJI_HECKLE = (["🤡", "😡"] as const).map(emojiId);
export const EMOJI_HECKLE = (["👻", "🎃"] as const).map(emojiId);
export class BotBehavior {
private enemy: Player | null = null;
+2 -7
View File
@@ -1,5 +1,6 @@
import { Config } from "../configuration/Config";
import { AllPlayersStats, ClientID } from "../Schemas";
import { getClanTag } from "../Util";
import { GameMap, TileRef } from "./GameMap";
import {
GameUpdate,
@@ -407,13 +408,7 @@ export class PlayerInfo {
public readonly id: PlayerID,
public readonly nation?: Nation | null,
) {
// Compute clan from name
if (!name.includes("[") || !name.includes("]")) {
this.clan = null;
} else {
const clanMatch = name.match(/\[([a-zA-Z0-9]{2,5})\]/);
this.clan = clanMatch ? clanMatch[1].toUpperCase() : null;
}
this.clan = getClanTag(name);
}
}