mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-04 22:12:06 +00:00
fb
This commit is contained in:
@@ -285,23 +285,23 @@ export class EventsDisplay extends LitElement implements Layer {
|
||||
|
||||
for (const alliance of myPlayer.alliances()) {
|
||||
if (
|
||||
alliance.expiresAt >
|
||||
alliance.expiresAt() >
|
||||
this.game.ticks() + this.game.config().allianceExtensionPromptOffset()
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
(this.alliancesCheckedAt.get(alliance.id) ?? 0) >=
|
||||
(this.alliancesCheckedAt.get(alliance.id()) ?? 0) >=
|
||||
this.game.ticks() - this.game.config().allianceExtensionPromptOffset()
|
||||
) {
|
||||
// We've already displayed a message for this alliance.
|
||||
continue;
|
||||
}
|
||||
|
||||
this.alliancesCheckedAt.set(alliance.id, this.game.ticks());
|
||||
this.alliancesCheckedAt.set(alliance.id(), this.game.ticks());
|
||||
|
||||
const other = this.game.player(alliance.other) as PlayerView;
|
||||
const other = this.game.player(alliance.other()!) as PlayerView;
|
||||
if (!other.isAlive()) continue;
|
||||
|
||||
this.addEvent({
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
import { GameUpdate, GameUpdateType, PlayerUpdate, UnitUpdate } from "../../generated/game-updates";
|
||||
import { Config } from "../configuration/Config";
|
||||
import { AllPlayersStats, ClientID } from "../Schemas";
|
||||
import { getClanTag } from "../Util";
|
||||
import { GameMap, TileRef } from "./GameMap";
|
||||
import {
|
||||
GameUpdate,
|
||||
GameUpdateType,
|
||||
PlayerUpdate,
|
||||
UnitUpdate,
|
||||
} from "./GameUpdates";
|
||||
import { RailNetwork } from "./RailNetwork";
|
||||
import { Stats } from "./Stats";
|
||||
import { UnitPredicate } from "./UnitGrid";
|
||||
@@ -188,7 +183,7 @@ export interface UnitInfo {
|
||||
experimental?: boolean;
|
||||
}
|
||||
|
||||
export enum UnitType {
|
||||
export enum UnitType {
|
||||
TransportShip = "Transport",
|
||||
Warship = "Warship",
|
||||
Shell = "Shell",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Builder } from "flatbuffers";
|
||||
import { renderNumber } from "../../client/Utils";
|
||||
import { Config } from "../configuration/Config";
|
||||
import { AllPlayersStats, ClientID, Winner } from "../Schemas";
|
||||
@@ -33,7 +34,7 @@ import {
|
||||
UnitType,
|
||||
} from "./Game";
|
||||
import { GameMap, TileRef, TileUpdate } from "./GameMap";
|
||||
import { GameUpdate, GameUpdateType } from "./GameUpdates";
|
||||
import { GameUpdateType } from "./GameUpdates";
|
||||
import { PlayerImpl } from "./PlayerImpl";
|
||||
import { RailNetwork } from "./RailNetwork";
|
||||
import { createRailNetwork } from "./RailNetworkImpl";
|
||||
@@ -85,6 +86,8 @@ export class GameImpl implements Game {
|
||||
// Used to assign unique IDs to each new alliance
|
||||
private nextAllianceID: number = 0;
|
||||
|
||||
private builder: Builder | null = null;
|
||||
|
||||
constructor(
|
||||
private _humans: PlayerInfo[],
|
||||
private _nations: Nation[],
|
||||
@@ -201,8 +204,10 @@ export class GameImpl implements Game {
|
||||
return this.miniGameMap;
|
||||
}
|
||||
|
||||
addUpdate(update: GameUpdate) {
|
||||
(this.updates[update.type] as GameUpdate[]).push(update);
|
||||
addUpdate(buildFn: (builder: Builder) => void) {
|
||||
if (this.builder) {
|
||||
buildFn(this.builder);
|
||||
}
|
||||
}
|
||||
|
||||
nextUnitID(): number {
|
||||
@@ -345,7 +350,8 @@ export class GameImpl implements Game {
|
||||
return this._ticks;
|
||||
}
|
||||
|
||||
executeNextTick(): GameUpdates {
|
||||
executeNextTick(builder: Builder): GameUpdates {
|
||||
this.builder = builder;
|
||||
this.updates = createGameUpdatesMap();
|
||||
this.execs.forEach((e) => {
|
||||
if (
|
||||
|
||||
@@ -2,12 +2,6 @@
|
||||
|
||||
namespace GameUpdates;
|
||||
|
||||
// Basic types
|
||||
table TileRef {
|
||||
x: int;
|
||||
y: int;
|
||||
}
|
||||
|
||||
table NameViewData {
|
||||
name: string;
|
||||
display_name: string;
|
||||
@@ -60,12 +54,6 @@ enum TrainType : byte {
|
||||
Freight = 1
|
||||
}
|
||||
|
||||
enum PlayerType : byte {
|
||||
Human = 0,
|
||||
Bot = 1,
|
||||
Spectator = 2
|
||||
}
|
||||
|
||||
enum MessageType : byte {
|
||||
Info = 0,
|
||||
Warning = 1,
|
||||
@@ -75,7 +63,7 @@ enum MessageType : byte {
|
||||
|
||||
// Update structures
|
||||
table TileUpdate {
|
||||
tile_ref: TileRef;
|
||||
tile_ref: double; // TileRef
|
||||
owner_id: int = -1;
|
||||
troops: int;
|
||||
gold: long;
|
||||
@@ -89,20 +77,20 @@ table TileUpdateWrapper {
|
||||
}
|
||||
|
||||
table UnitUpdate {
|
||||
unit_type: UnitType;
|
||||
unit_type: string; // enum UnitType
|
||||
troops: int;
|
||||
id: int;
|
||||
owner_id: int;
|
||||
last_owner_id: int = -1;
|
||||
pos: TileRef;
|
||||
last_pos: TileRef;
|
||||
pos: double; // TileRef
|
||||
last_pos: double; // TileRef
|
||||
is_active: bool;
|
||||
reached_target: bool;
|
||||
retreating: bool;
|
||||
targetable: bool;
|
||||
marked_for_deletion: int = -1;
|
||||
target_unit_id: int = -1;
|
||||
target_tile: TileRef;
|
||||
target_tile: double; // TileRef
|
||||
health: int = 100;
|
||||
under_construction: bool = false;
|
||||
missile_timer_queue: [int];
|
||||
@@ -129,7 +117,7 @@ table EmojiMessage {
|
||||
|
||||
table AllianceView {
|
||||
id: int;
|
||||
other: int;
|
||||
other: string;
|
||||
created_at: int;
|
||||
expires_at: int;
|
||||
has_extension_request: bool;
|
||||
@@ -143,7 +131,7 @@ table PlayerUpdate {
|
||||
id: int;
|
||||
team: int = -1;
|
||||
small_id: int;
|
||||
player_type: PlayerType;
|
||||
player_type: string; // enum PlayerType: Human, Bot, Spectator
|
||||
is_alive: bool;
|
||||
is_disconnected: bool;
|
||||
tiles_owned: int;
|
||||
@@ -201,7 +189,7 @@ table EmojiUpdate {
|
||||
|
||||
table DisplayMessageUpdate {
|
||||
message: string;
|
||||
message_type: MessageType;
|
||||
message_type: string; // enum MessageType: Info, Warning, Error, Success
|
||||
gold_amount: long = 0;
|
||||
player_id: int = -1;
|
||||
params_keys: [string];
|
||||
@@ -230,19 +218,19 @@ table HashUpdate {
|
||||
table UnitIncomingUpdate {
|
||||
unit_id: int;
|
||||
message: string;
|
||||
message_type: MessageType;
|
||||
message_type: string; // enum MessageType: Info, Warning, Error, Success
|
||||
player_id: int;
|
||||
}
|
||||
|
||||
table BonusEventUpdate {
|
||||
player: int;
|
||||
tile: TileRef;
|
||||
tile: long; // TileRef
|
||||
gold: int;
|
||||
troops: int;
|
||||
}
|
||||
|
||||
table RailTile {
|
||||
tile: TileRef;
|
||||
tile: double; // TileRef
|
||||
rail_type: RailType;
|
||||
}
|
||||
|
||||
@@ -292,7 +280,7 @@ union GameUpdateUnion {
|
||||
}
|
||||
|
||||
table GameUpdate {
|
||||
type: GameUpdateType;
|
||||
type: string; // enum GameUpdateType: Tile, Unit, Player, DisplayEvent, DisplayChatEvent, AllianceRequest, AllianceRequestReply, BrokeAlliance, AllianceExpired, AllianceExtension, TargetPlayer, Emoji, Win, Hash, UnitIncoming, BonusEvent, RailroadEvent, ConquestEvent, EmbargoEvent
|
||||
update: GameUpdateUnion;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,271 +0,0 @@
|
||||
import { AllPlayersStats, ClientID, Winner } from "../Schemas";
|
||||
import {
|
||||
EmojiMessage,
|
||||
GameUpdates,
|
||||
Gold,
|
||||
MessageType,
|
||||
NameViewData,
|
||||
PlayerID,
|
||||
PlayerType,
|
||||
Team,
|
||||
Tick,
|
||||
TrainType,
|
||||
UnitType,
|
||||
} from "./Game";
|
||||
import { TileRef, TileUpdate } from "./GameMap";
|
||||
|
||||
export interface GameUpdateViewData {
|
||||
tick: number;
|
||||
updates: GameUpdates;
|
||||
packedTileUpdates: BigUint64Array;
|
||||
playerNameViewData: Record<string, NameViewData>;
|
||||
tickExecutionDuration?: number;
|
||||
}
|
||||
|
||||
export interface ErrorUpdate {
|
||||
errMsg: string;
|
||||
stack?: string;
|
||||
}
|
||||
|
||||
export enum GameUpdateType {
|
||||
Tile,
|
||||
Unit,
|
||||
Player,
|
||||
DisplayEvent,
|
||||
DisplayChatEvent,
|
||||
AllianceRequest,
|
||||
AllianceRequestReply,
|
||||
BrokeAlliance,
|
||||
AllianceExpired,
|
||||
AllianceExtension,
|
||||
TargetPlayer,
|
||||
Emoji,
|
||||
Win,
|
||||
Hash,
|
||||
UnitIncoming,
|
||||
BonusEvent,
|
||||
RailroadEvent,
|
||||
ConquestEvent,
|
||||
EmbargoEvent,
|
||||
}
|
||||
|
||||
export type GameUpdate =
|
||||
| TileUpdateWrapper
|
||||
| UnitUpdate
|
||||
| PlayerUpdate
|
||||
| AllianceRequestUpdate
|
||||
| AllianceRequestReplyUpdate
|
||||
| BrokeAllianceUpdate
|
||||
| AllianceExpiredUpdate
|
||||
| DisplayMessageUpdate
|
||||
| DisplayChatMessageUpdate
|
||||
| TargetPlayerUpdate
|
||||
| EmojiUpdate
|
||||
| WinUpdate
|
||||
| HashUpdate
|
||||
| UnitIncomingUpdate
|
||||
| AllianceExtensionUpdate
|
||||
| BonusEventUpdate
|
||||
| RailroadUpdate
|
||||
| ConquestUpdate
|
||||
| EmbargoUpdate;
|
||||
|
||||
export interface BonusEventUpdate {
|
||||
type: GameUpdateType.BonusEvent;
|
||||
player: PlayerID;
|
||||
tile: TileRef;
|
||||
gold: number;
|
||||
troops: number;
|
||||
}
|
||||
|
||||
export enum RailType {
|
||||
VERTICAL,
|
||||
HORIZONTAL,
|
||||
TOP_LEFT,
|
||||
TOP_RIGHT,
|
||||
BOTTOM_LEFT,
|
||||
BOTTOM_RIGHT,
|
||||
}
|
||||
|
||||
export interface RailTile {
|
||||
tile: TileRef;
|
||||
railType: RailType;
|
||||
}
|
||||
|
||||
export interface RailroadUpdate {
|
||||
type: GameUpdateType.RailroadEvent;
|
||||
isActive: boolean;
|
||||
railTiles: RailTile[];
|
||||
}
|
||||
|
||||
export interface ConquestUpdate {
|
||||
type: GameUpdateType.ConquestEvent;
|
||||
conquerorId: PlayerID;
|
||||
conqueredId: PlayerID;
|
||||
gold: Gold;
|
||||
}
|
||||
|
||||
export interface TileUpdateWrapper {
|
||||
type: GameUpdateType.Tile;
|
||||
update: TileUpdate;
|
||||
}
|
||||
|
||||
export interface UnitUpdate {
|
||||
type: GameUpdateType.Unit;
|
||||
unitType: UnitType;
|
||||
troops: number;
|
||||
id: number;
|
||||
ownerID: number;
|
||||
lastOwnerID?: number;
|
||||
// TODO: make these tilerefs
|
||||
pos: TileRef;
|
||||
lastPos: TileRef;
|
||||
isActive: boolean;
|
||||
reachedTarget: boolean;
|
||||
retreating: boolean;
|
||||
targetable: boolean;
|
||||
markedForDeletion: number | false;
|
||||
targetUnitId?: number; // Only for trade ships
|
||||
targetTile?: TileRef; // Only for nukes
|
||||
health?: number;
|
||||
underConstruction?: boolean;
|
||||
missileTimerQueue: number[];
|
||||
level: number;
|
||||
hasTrainStation: boolean;
|
||||
trainType?: TrainType; // Only for trains
|
||||
loaded?: boolean; // Only for trains
|
||||
}
|
||||
|
||||
export interface AttackUpdate {
|
||||
attackerID: number;
|
||||
targetID: number;
|
||||
troops: number;
|
||||
id: string;
|
||||
retreating: boolean;
|
||||
}
|
||||
|
||||
export interface PlayerUpdate {
|
||||
type: GameUpdateType.Player;
|
||||
nameViewData?: NameViewData;
|
||||
clientID: ClientID | null;
|
||||
name: string;
|
||||
displayName: string;
|
||||
id: PlayerID;
|
||||
team?: Team;
|
||||
smallID: number;
|
||||
playerType: PlayerType;
|
||||
isAlive: boolean;
|
||||
isDisconnected: boolean;
|
||||
tilesOwned: number;
|
||||
gold: Gold;
|
||||
troops: number;
|
||||
allies: number[];
|
||||
embargoes: Set<PlayerID>;
|
||||
isTraitor: boolean;
|
||||
traitorRemainingTicks?: number;
|
||||
targets: number[];
|
||||
outgoingEmojis: EmojiMessage[];
|
||||
outgoingAttacks: AttackUpdate[];
|
||||
incomingAttacks: AttackUpdate[];
|
||||
outgoingAllianceRequests: PlayerID[];
|
||||
alliances: AllianceView[];
|
||||
hasSpawned: boolean;
|
||||
betrayals: number;
|
||||
lastDeleteUnitTick: Tick;
|
||||
}
|
||||
|
||||
export interface AllianceView {
|
||||
id: number;
|
||||
other: PlayerID;
|
||||
createdAt: Tick;
|
||||
expiresAt: Tick;
|
||||
hasExtensionRequest: boolean;
|
||||
}
|
||||
|
||||
export interface AllianceRequestUpdate {
|
||||
type: GameUpdateType.AllianceRequest;
|
||||
requestorID: number;
|
||||
recipientID: number;
|
||||
createdAt: Tick;
|
||||
}
|
||||
|
||||
export interface AllianceRequestReplyUpdate {
|
||||
type: GameUpdateType.AllianceRequestReply;
|
||||
request: AllianceRequestUpdate;
|
||||
accepted: boolean;
|
||||
}
|
||||
|
||||
export interface BrokeAllianceUpdate {
|
||||
type: GameUpdateType.BrokeAlliance;
|
||||
traitorID: number;
|
||||
betrayedID: number;
|
||||
}
|
||||
|
||||
export interface AllianceExpiredUpdate {
|
||||
type: GameUpdateType.AllianceExpired;
|
||||
player1ID: number;
|
||||
player2ID: number;
|
||||
}
|
||||
|
||||
export interface AllianceExtensionUpdate {
|
||||
type: GameUpdateType.AllianceExtension;
|
||||
playerID: number;
|
||||
allianceID: number;
|
||||
}
|
||||
|
||||
export interface TargetPlayerUpdate {
|
||||
type: GameUpdateType.TargetPlayer;
|
||||
playerID: number;
|
||||
targetID: number;
|
||||
}
|
||||
|
||||
export interface EmojiUpdate {
|
||||
type: GameUpdateType.Emoji;
|
||||
emoji: EmojiMessage;
|
||||
}
|
||||
|
||||
export interface DisplayMessageUpdate {
|
||||
type: GameUpdateType.DisplayEvent;
|
||||
message: string;
|
||||
messageType: MessageType;
|
||||
goldAmount?: bigint;
|
||||
playerID: number | null;
|
||||
params?: Record<string, string | number>;
|
||||
}
|
||||
|
||||
export type DisplayChatMessageUpdate = {
|
||||
type: GameUpdateType.DisplayChatEvent;
|
||||
key: string;
|
||||
category: string;
|
||||
target: string | undefined;
|
||||
playerID: number | null;
|
||||
isFrom: boolean;
|
||||
recipient: string;
|
||||
};
|
||||
|
||||
export interface WinUpdate {
|
||||
type: GameUpdateType.Win;
|
||||
allPlayersStats: AllPlayersStats;
|
||||
winner: Winner;
|
||||
}
|
||||
|
||||
export interface HashUpdate {
|
||||
type: GameUpdateType.Hash;
|
||||
tick: Tick;
|
||||
hash: number;
|
||||
}
|
||||
|
||||
export interface UnitIncomingUpdate {
|
||||
type: GameUpdateType.UnitIncoming;
|
||||
unitID: number;
|
||||
message: string;
|
||||
messageType: MessageType;
|
||||
playerID: number;
|
||||
}
|
||||
|
||||
export interface EmbargoUpdate {
|
||||
type: GameUpdateType.EmbargoEvent;
|
||||
event: "start" | "stop";
|
||||
playerID: number;
|
||||
embargoedID: number;
|
||||
}
|
||||
+27
-25
@@ -1,5 +1,12 @@
|
||||
import { Colord, colord } from "colord";
|
||||
import { base64url } from "jose";
|
||||
import {
|
||||
AllianceView,
|
||||
AttackUpdate,
|
||||
GameUpdateViewData,
|
||||
PlayerUpdate,
|
||||
} from "../../generated/game-updates";
|
||||
import { GameUpdateType } from "../../generated/game-updates/game-update-type";
|
||||
import { Config } from "../configuration/Config";
|
||||
import { ColorPalette } from "../CosmeticSchemas";
|
||||
import { PatternDecoder } from "../PatternDecoder";
|
||||
@@ -26,14 +33,6 @@ import {
|
||||
UnitType,
|
||||
} from "./Game";
|
||||
import { GameMap, TileRef, TileUpdate } from "./GameMap";
|
||||
import {
|
||||
AllianceView,
|
||||
AttackUpdate,
|
||||
GameUpdateType,
|
||||
GameUpdateViewData,
|
||||
PlayerUpdate,
|
||||
UnitUpdate,
|
||||
} from "./GameUpdates";
|
||||
import { TerrainMapData } from "./TerrainMapLoader";
|
||||
import { TerraNulliusImpl } from "./TerraNulliusImpl";
|
||||
import { UnitGrid, UnitPredicate } from "./UnitGrid";
|
||||
@@ -194,7 +193,7 @@ export class PlayerView {
|
||||
public nameData: NameViewData,
|
||||
public cosmetics: PlayerCosmetics,
|
||||
) {
|
||||
if (data.clientID === game.myClientID()) {
|
||||
if (data.clientId() === game.myClientID()) {
|
||||
this.anonymousName = this.data.name;
|
||||
} else {
|
||||
this.anonymousName = createRandomName(
|
||||
@@ -301,8 +300,8 @@ export class PlayerView {
|
||||
return this.game.worker.playerBorderTiles(this.id());
|
||||
}
|
||||
|
||||
outgoingAttacks(): AttackUpdate[] {
|
||||
return this.data.outgoingAttacks;
|
||||
*outgoingAttacks(): AttackUpdate[] {
|
||||
return this.data.outgoingAttacks();
|
||||
}
|
||||
|
||||
incomingAttacks(): AttackUpdate[] {
|
||||
@@ -327,25 +326,25 @@ export class PlayerView {
|
||||
}
|
||||
|
||||
smallID(): number {
|
||||
return this.data.smallID;
|
||||
return this.data.smallId();
|
||||
}
|
||||
|
||||
name(): string {
|
||||
return this.anonymousName !== null && userSettings.anonymousNames()
|
||||
? this.anonymousName
|
||||
: this.data.name;
|
||||
: this.data.name()!;
|
||||
}
|
||||
displayName(): string {
|
||||
return this.anonymousName !== null && userSettings.anonymousNames()
|
||||
? this.anonymousName
|
||||
: this.data.name;
|
||||
: this.data.name()!;
|
||||
}
|
||||
|
||||
clientID(): ClientID | null {
|
||||
return this.data.clientID;
|
||||
return this.data.clientId()!;
|
||||
}
|
||||
id(): PlayerID {
|
||||
return this.data.id;
|
||||
return this.data.id();
|
||||
}
|
||||
team(): Team | null {
|
||||
return this.data.team ?? null;
|
||||
@@ -360,7 +359,7 @@ export class PlayerView {
|
||||
return true;
|
||||
}
|
||||
numTilesOwned(): number {
|
||||
return this.data.tilesOwned;
|
||||
return this.data.tilesOwned();
|
||||
}
|
||||
allies(): PlayerView[] {
|
||||
return this.data.allies.map(
|
||||
@@ -373,11 +372,11 @@ export class PlayerView {
|
||||
);
|
||||
}
|
||||
gold(): Gold {
|
||||
return this.data.gold;
|
||||
return this.data.gold();
|
||||
}
|
||||
|
||||
troops(): number {
|
||||
return this.data.troops;
|
||||
return this.data.troops();
|
||||
}
|
||||
|
||||
totalUnitLevels(type: UnitType): number {
|
||||
@@ -407,8 +406,11 @@ export class PlayerView {
|
||||
return this.data.outgoingAllianceRequests.some((id) => other.id() === id);
|
||||
}
|
||||
|
||||
alliances(): AllianceView[] {
|
||||
return this.data.alliances;
|
||||
*alliances(): Generator<AllianceView> {
|
||||
const length = this.data.alliesLength();
|
||||
for (let i = 0; i < length; i++) {
|
||||
yield this.data.alliances(i)!;
|
||||
}
|
||||
}
|
||||
|
||||
hasEmbargoAgainst(other: PlayerView): boolean {
|
||||
@@ -442,14 +444,14 @@ export class PlayerView {
|
||||
}
|
||||
|
||||
hasSpawned(): boolean {
|
||||
return this.data.hasSpawned;
|
||||
return this.data.hasSpawned();
|
||||
}
|
||||
isDisconnected(): boolean {
|
||||
return this.data.isDisconnected;
|
||||
return this.data.isDisconnected();
|
||||
}
|
||||
|
||||
lastDeleteUnitTick(): Tick {
|
||||
return this.data.lastDeleteUnitTick;
|
||||
return this.data.lastDeleteUnitTick();
|
||||
}
|
||||
|
||||
deleteUnitCooldown(): number {
|
||||
@@ -657,7 +659,7 @@ export class GameView implements GameMap {
|
||||
|
||||
ticks(): Tick {
|
||||
if (this.lastUpdate === null) return 0;
|
||||
return this.lastUpdate.tick;
|
||||
return this.lastUpdate.tick();
|
||||
}
|
||||
inSpawnPhase(): boolean {
|
||||
return this.ticks() <= this._config.numSpawnPhaseTurns();
|
||||
|
||||
+187
-65
@@ -1,4 +1,6 @@
|
||||
import { Builder } from "flatbuffers";
|
||||
import { renderNumber, renderTroops } from "../../client/Utils";
|
||||
import { GameUpdates } from "../../generated/GameUpdates";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { ClientID } from "../Schemas";
|
||||
import {
|
||||
@@ -38,12 +40,7 @@ import {
|
||||
} from "./Game";
|
||||
import { GameImpl } from "./GameImpl";
|
||||
import { andFN, manhattanDistFN, TileRef } from "./GameMap";
|
||||
import {
|
||||
AllianceView,
|
||||
AttackUpdate,
|
||||
GameUpdateType,
|
||||
PlayerUpdate,
|
||||
} from "./GameUpdates";
|
||||
import { GameUpdateType } from "./GameUpdates";
|
||||
import {
|
||||
bestShoreDeploymentSource,
|
||||
canBuildTransportShip,
|
||||
@@ -119,66 +116,191 @@ export class PlayerImpl implements Player {
|
||||
|
||||
largestClusterBoundingBox: { min: Cell; max: Cell } | null;
|
||||
|
||||
toUpdate(): PlayerUpdate {
|
||||
const outgoingAllianceRequests = this.outgoingAllianceRequests().map((ar) =>
|
||||
ar.recipient().id(),
|
||||
);
|
||||
toUpdate(): (builder: Builder) => void {
|
||||
return (builder: Builder) => {
|
||||
const outgoingAllianceRequests = this.outgoingAllianceRequests().map(
|
||||
(ar) => ar.recipient().id(),
|
||||
);
|
||||
// Create all strings first
|
||||
const clientIDOffset = builder.createString(this.clientID());
|
||||
const nameOffset = builder.createString(this.name());
|
||||
const displayNameOffset = builder.createString(this.displayName());
|
||||
const playerTypeOffset = builder.createString(this.type());
|
||||
|
||||
return {
|
||||
type: GameUpdateType.Player,
|
||||
clientID: this.clientID(),
|
||||
name: this.name(),
|
||||
displayName: this.displayName(),
|
||||
id: this.id(),
|
||||
team: this.team() ?? undefined,
|
||||
smallID: this.smallID(),
|
||||
playerType: this.type(),
|
||||
isAlive: this.isAlive(),
|
||||
isDisconnected: this.isDisconnected(),
|
||||
tilesOwned: this.numTilesOwned(),
|
||||
gold: this._gold,
|
||||
troops: this.troops(),
|
||||
allies: this.alliances().map((a) => a.other(this).smallID()),
|
||||
embargoes: new Set([...this.embargoes.keys()].map((p) => p.toString())),
|
||||
isTraitor: this.isTraitor(),
|
||||
traitorRemainingTicks: this.getTraitorRemainingTicks(),
|
||||
targets: this.targets().map((p) => p.smallID()),
|
||||
outgoingEmojis: this.outgoingEmojis(),
|
||||
outgoingAttacks: this._outgoingAttacks.map((a) => {
|
||||
return {
|
||||
attackerID: a.attacker().smallID(),
|
||||
targetID: a.target().smallID(),
|
||||
troops: a.troops(),
|
||||
id: a.id(),
|
||||
retreating: a.retreating(),
|
||||
} satisfies AttackUpdate;
|
||||
}),
|
||||
incomingAttacks: this._incomingAttacks.map((a) => {
|
||||
return {
|
||||
attackerID: a.attacker().smallID(),
|
||||
targetID: a.target().smallID(),
|
||||
troops: a.troops(),
|
||||
id: a.id(),
|
||||
retreating: a.retreating(),
|
||||
} satisfies AttackUpdate;
|
||||
}),
|
||||
outgoingAllianceRequests: outgoingAllianceRequests,
|
||||
alliances: this.alliances().map(
|
||||
(a) =>
|
||||
({
|
||||
id: a.id(),
|
||||
other: a.other(this).id(),
|
||||
createdAt: a.createdAt(),
|
||||
expiresAt: a.expiresAt(),
|
||||
hasExtensionRequest:
|
||||
a.expiresAt() <=
|
||||
this.mg.ticks() +
|
||||
this.mg.config().allianceExtensionPromptOffset(),
|
||||
}) satisfies AllianceView,
|
||||
),
|
||||
hasSpawned: this.hasSpawned(),
|
||||
betrayals: this._betrayalCount,
|
||||
lastDeleteUnitTick: this.lastDeleteUnitTick,
|
||||
// Create NameViewData
|
||||
const nameViewDataNameOffset = builder.createString(this.name());
|
||||
const nameViewDataDisplayNameOffset = builder.createString(
|
||||
this.displayName(),
|
||||
);
|
||||
GameUpdates.NameViewData.startNameViewData(builder);
|
||||
GameUpdates.NameViewData.addName(builder, nameViewDataNameOffset);
|
||||
GameUpdates.NameViewData.addDisplayName(
|
||||
builder,
|
||||
nameViewDataDisplayNameOffset,
|
||||
);
|
||||
GameUpdates.NameViewData.addColor(builder, 0); // You'll need to provide the actual color value
|
||||
const nameViewDataOffset =
|
||||
GameUpdates.NameViewData.endNameViewData(builder);
|
||||
|
||||
// Create allies vector
|
||||
const allies = this.alliances().map((a) => a.other(this).smallID());
|
||||
const alliesOffset = GameUpdates.PlayerUpdate.createAlliesVector(
|
||||
builder,
|
||||
allies,
|
||||
);
|
||||
|
||||
// Create embargoes vector
|
||||
const embargoes = [...this.embargoes.keys()].map((p) =>
|
||||
parseInt(p.toString()),
|
||||
);
|
||||
const embargoesOffset = GameUpdates.PlayerUpdate.createEmbargoesVector(
|
||||
builder,
|
||||
embargoes,
|
||||
);
|
||||
|
||||
// Create targets vector
|
||||
const targets = this.targets().map((p) => p.smallID());
|
||||
const targetsOffset = GameUpdates.PlayerUpdate.createTargetsVector(
|
||||
builder,
|
||||
targets,
|
||||
);
|
||||
|
||||
// Create outgoing emojis
|
||||
const outgoingEmojisOffsets = this.outgoingEmojis().map((emoji) => {
|
||||
const emojiStrOffset = builder.createString(emoji.emoji);
|
||||
GameUpdates.EmojiMessage.startEmojiMessage(builder);
|
||||
GameUpdates.EmojiMessage.addPlayerId(builder, emoji.player_id);
|
||||
GameUpdates.EmojiMessage.addEmoji(builder, emojiStrOffset);
|
||||
GameUpdates.EmojiMessage.addTargetPlayerId(
|
||||
builder,
|
||||
emoji.target_player_id ?? -1,
|
||||
);
|
||||
GameUpdates.EmojiMessage.addTick(builder, emoji.tick);
|
||||
return GameUpdates.EmojiMessage.endEmojiMessage(builder);
|
||||
});
|
||||
const outgoingEmojisVectorOffset =
|
||||
GameUpdates.PlayerUpdate.createOutgoingEmojisVector(
|
||||
builder,
|
||||
outgoingEmojisOffsets,
|
||||
);
|
||||
|
||||
// Create outgoing attacks
|
||||
const outgoingAttacksOffsets = this._outgoingAttacks.map((a) => {
|
||||
const idOffset = builder.createString(a.id());
|
||||
GameUpdates.AttackUpdate.startAttackUpdate(builder);
|
||||
GameUpdates.AttackUpdate.addAttackerId(builder, a.attacker().smallID());
|
||||
GameUpdates.AttackUpdate.addTargetId(builder, a.target().smallID());
|
||||
GameUpdates.AttackUpdate.addTroops(builder, a.troops());
|
||||
GameUpdates.AttackUpdate.addId(builder, idOffset);
|
||||
GameUpdates.AttackUpdate.addRetreating(builder, a.retreating());
|
||||
return GameUpdates.AttackUpdate.endAttackUpdate(builder);
|
||||
});
|
||||
const outgoingAttacksVectorOffset =
|
||||
GameUpdates.PlayerUpdate.createOutgoingAttacksVector(
|
||||
builder,
|
||||
outgoingAttacksOffsets,
|
||||
);
|
||||
|
||||
// Create incoming attacks
|
||||
const incomingAttacksOffsets = this._incomingAttacks.map((a) => {
|
||||
const idOffset = builder.createString(a.id());
|
||||
GameUpdates.AttackUpdate.startAttackUpdate(builder);
|
||||
GameUpdates.AttackUpdate.addAttackerId(builder, a.attacker().smallID());
|
||||
GameUpdates.AttackUpdate.addTargetId(builder, a.target().smallID());
|
||||
GameUpdates.AttackUpdate.addTroops(builder, a.troops());
|
||||
GameUpdates.AttackUpdate.addId(builder, idOffset);
|
||||
GameUpdates.AttackUpdate.addRetreating(builder, a.retreating());
|
||||
return GameUpdates.AttackUpdate.endAttackUpdate(builder);
|
||||
});
|
||||
const incomingAttacksVectorOffset =
|
||||
GameUpdates.PlayerUpdate.createIncomingAttacksVector(
|
||||
builder,
|
||||
incomingAttacksOffsets,
|
||||
);
|
||||
|
||||
// Create outgoing alliance requests vector
|
||||
const outgoingAllianceRequestsOffset =
|
||||
GameUpdates.PlayerUpdate.createOutgoingAllianceRequestsVector(
|
||||
builder,
|
||||
outgoingAllianceRequests, // You need to provide this variable
|
||||
);
|
||||
|
||||
// Create alliances
|
||||
const alliancesOffsets = this.alliances().map((a) => {
|
||||
GameUpdates.AllianceView.startAllianceView(builder);
|
||||
GameUpdates.AllianceView.addId(builder, a.id());
|
||||
GameUpdates.AllianceView.addOther(builder, a.other(this).id());
|
||||
GameUpdates.AllianceView.addCreatedAt(builder, a.createdAt());
|
||||
GameUpdates.AllianceView.addExpiresAt(builder, a.expiresAt());
|
||||
GameUpdates.AllianceView.addHasExtensionRequest(
|
||||
builder,
|
||||
a.expiresAt() <=
|
||||
this.mg.ticks() + this.mg.config().allianceExtensionPromptOffset(),
|
||||
);
|
||||
return GameUpdates.AllianceView.endAllianceView(builder);
|
||||
});
|
||||
const alliancesVectorOffset =
|
||||
GameUpdates.PlayerUpdate.createAlliancesVector(
|
||||
builder,
|
||||
alliancesOffsets,
|
||||
);
|
||||
|
||||
// Build the PlayerUpdate
|
||||
GameUpdates.PlayerUpdate.startPlayerUpdate(builder);
|
||||
GameUpdates.PlayerUpdate.addNameViewData(builder, nameViewDataOffset);
|
||||
GameUpdates.PlayerUpdate.addClientId(builder, clientIDOffset);
|
||||
GameUpdates.PlayerUpdate.addName(builder, nameOffset);
|
||||
GameUpdates.PlayerUpdate.addDisplayName(builder, displayNameOffset);
|
||||
GameUpdates.PlayerUpdate.addId(builder, this.id());
|
||||
|
||||
const team = this.team();
|
||||
if (team !== null && team !== undefined) {
|
||||
GameUpdates.PlayerUpdate.addTeam(builder, team);
|
||||
}
|
||||
|
||||
GameUpdates.PlayerUpdate.addSmallId(builder, this.smallID());
|
||||
GameUpdates.PlayerUpdate.addPlayerType(builder, playerTypeOffset);
|
||||
GameUpdates.PlayerUpdate.addIsAlive(builder, this.isAlive());
|
||||
GameUpdates.PlayerUpdate.addIsDisconnected(
|
||||
builder,
|
||||
this.isDisconnected(),
|
||||
);
|
||||
GameUpdates.PlayerUpdate.addTilesOwned(builder, this.numTilesOwned());
|
||||
GameUpdates.PlayerUpdate.addGold(builder, this._gold);
|
||||
GameUpdates.PlayerUpdate.addTroops(builder, this.troops());
|
||||
GameUpdates.PlayerUpdate.addAllies(builder, alliesOffset);
|
||||
GameUpdates.PlayerUpdate.addEmbargoes(builder, embargoesOffset);
|
||||
GameUpdates.PlayerUpdate.addIsTraitor(builder, this.isTraitor());
|
||||
GameUpdates.PlayerUpdate.addTraitorRemainingTicks(
|
||||
builder,
|
||||
this.getTraitorRemainingTicks(),
|
||||
);
|
||||
GameUpdates.PlayerUpdate.addTargets(builder, targetsOffset);
|
||||
GameUpdates.PlayerUpdate.addOutgoingEmojis(
|
||||
builder,
|
||||
outgoingEmojisVectorOffset,
|
||||
);
|
||||
GameUpdates.PlayerUpdate.addOutgoingAttacks(
|
||||
builder,
|
||||
outgoingAttacksVectorOffset,
|
||||
);
|
||||
GameUpdates.PlayerUpdate.addIncomingAttacks(
|
||||
builder,
|
||||
incomingAttacksVectorOffset,
|
||||
);
|
||||
GameUpdates.PlayerUpdate.addOutgoingAllianceRequests(
|
||||
builder,
|
||||
outgoingAllianceRequestsOffset,
|
||||
);
|
||||
GameUpdates.PlayerUpdate.addAlliances(builder, alliancesVectorOffset);
|
||||
GameUpdates.PlayerUpdate.addHasSpawned(builder, this.hasSpawned());
|
||||
GameUpdates.PlayerUpdate.addBetrayals(builder, this._betrayalCount);
|
||||
GameUpdates.PlayerUpdate.addLastDeleteUnitTick(
|
||||
builder,
|
||||
this.lastDeleteUnitTick,
|
||||
);
|
||||
|
||||
return GameUpdates.PlayerUpdate.endPlayerUpdate(builder);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import {
|
||||
GameUpdateType,
|
||||
RailTileT,
|
||||
RailType,
|
||||
} from "../../generated/game-updates";
|
||||
import { Game } from "./Game";
|
||||
import { TileRef } from "./GameMap";
|
||||
import { GameUpdateType, RailTile, RailType } from "./GameUpdates";
|
||||
import { TrainStation } from "./TrainStation";
|
||||
|
||||
export class Railroad {
|
||||
@@ -11,10 +15,9 @@ export class Railroad {
|
||||
) {}
|
||||
|
||||
delete(game: Game) {
|
||||
const railTiles: RailTile[] = this.tiles.map((tile) => ({
|
||||
tile,
|
||||
railType: RailType.VERTICAL,
|
||||
}));
|
||||
const railTiles: RailTileT[] = this.tiles.map(
|
||||
(tile) => new RailTileT(tile, RailType.VERTICAL),
|
||||
);
|
||||
game.addUpdate({
|
||||
type: GameUpdateType.RailroadEvent,
|
||||
isActive: false,
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import {
|
||||
GameUpdateType,
|
||||
RailTileT,
|
||||
RailType,
|
||||
} from "../../generated/game-updates";
|
||||
import { TrainExecution } from "../execution/TrainExecution";
|
||||
import { GraphAdapter } from "../pathfinding/SerialAStar";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { Game, Player, Unit, UnitType } from "./Game";
|
||||
import { TileRef } from "./GameMap";
|
||||
import { GameUpdateType, RailTile, RailType } from "./GameUpdates";
|
||||
import { Railroad } from "./Railroad";
|
||||
|
||||
/**
|
||||
@@ -113,10 +117,9 @@ export class TrainStation {
|
||||
(r) => r.from === station || r.to === station,
|
||||
);
|
||||
if (toRemove) {
|
||||
const railTiles: RailTile[] = toRemove.tiles.map((tile) => ({
|
||||
tile,
|
||||
railType: RailType.VERTICAL,
|
||||
}));
|
||||
const railTiles: RailTileT[] = toRemove.tiles.map(
|
||||
(tile) => new RailTileT(tile, RailType.VERTICAL),
|
||||
);
|
||||
this.mg.addUpdate({
|
||||
type: GameUpdateType.RailroadEvent,
|
||||
isActive: false,
|
||||
|
||||
+45
-25
@@ -1,3 +1,5 @@
|
||||
import { Builder } from "flatbuffers";
|
||||
import { UnitUpdate } from "../../generated/game-updates";
|
||||
import { simpleHash, toInt, withinInt } from "../Util";
|
||||
import {
|
||||
AllUnitParams,
|
||||
@@ -12,7 +14,6 @@ import {
|
||||
} from "./Game";
|
||||
import { GameImpl } from "./GameImpl";
|
||||
import { TileRef } from "./GameMap";
|
||||
import { GameUpdateType, UnitUpdate } from "./GameUpdates";
|
||||
import { PlayerImpl } from "./PlayerImpl";
|
||||
|
||||
export class UnitImpl implements Unit {
|
||||
@@ -116,31 +117,50 @@ export class UnitImpl implements Unit {
|
||||
id() {
|
||||
return this._id;
|
||||
}
|
||||
toUpdate(): (builder: Builder) => void {
|
||||
return (builder: Builder) => {
|
||||
// Create vectors (arrays)
|
||||
const missileTimerOffset = UnitUpdate.createMissileTimerQueueVector(
|
||||
builder,
|
||||
this._missileTimerQueue,
|
||||
);
|
||||
|
||||
toUpdate(): UnitUpdate {
|
||||
return {
|
||||
type: GameUpdateType.Unit,
|
||||
unitType: this._type,
|
||||
id: this._id,
|
||||
troops: this._troops,
|
||||
ownerID: this._owner.smallID(),
|
||||
lastOwnerID: this._lastOwner?.smallID(),
|
||||
isActive: this._active,
|
||||
reachedTarget: this._reachedTarget,
|
||||
retreating: this._retreating,
|
||||
pos: this._tile,
|
||||
markedForDeletion: this._deletionAt ?? false,
|
||||
targetable: this._targetable,
|
||||
lastPos: this._lastTile,
|
||||
health: this.hasHealth() ? Number(this._health) : undefined,
|
||||
underConstruction: this._underConstruction,
|
||||
targetUnitId: this._targetUnit?.id() ?? undefined,
|
||||
targetTile: this.targetTile() ?? undefined,
|
||||
missileTimerQueue: this._missileTimerQueue,
|
||||
level: this.level(),
|
||||
hasTrainStation: this._hasTrainStation,
|
||||
trainType: this._trainType,
|
||||
loaded: this._loaded,
|
||||
// Create the table
|
||||
UnitUpdate.startUnitUpdate(builder);
|
||||
UnitUpdate.addUnitType(builder, builder.createString(this._type));
|
||||
UnitUpdate.addId(builder, this._id);
|
||||
UnitUpdate.addTroops(builder, this._troops);
|
||||
UnitUpdate.addOwnerId(builder, this._owner.smallID());
|
||||
if (this._lastOwner) {
|
||||
UnitUpdate.addLastOwnerId(builder, this._lastOwner.smallID());
|
||||
}
|
||||
UnitUpdate.addIsActive(builder, this._active);
|
||||
UnitUpdate.addReachedTarget(builder, this._reachedTarget);
|
||||
UnitUpdate.addRetreating(builder, this._retreating);
|
||||
UnitUpdate.addPos(builder, this._tile); // Just pass the bigint directly
|
||||
UnitUpdate.addLastPos(builder, this._lastTile);
|
||||
UnitUpdate.addMarkedForDeletion(builder, this._deletionAt ?? -1);
|
||||
UnitUpdate.addTargetable(builder, this._targetable);
|
||||
if (this.hasHealth()) {
|
||||
UnitUpdate.addHealth(builder, Number(this._health));
|
||||
}
|
||||
UnitUpdate.addUnderConstruction(builder, this._underConstruction);
|
||||
if (this._targetUnit) {
|
||||
UnitUpdate.addTargetUnitId(builder, this._targetUnit.id());
|
||||
}
|
||||
const targetTile = this.targetTile();
|
||||
if (targetTile !== undefined) {
|
||||
UnitUpdate.addTargetTile(builder, targetTile);
|
||||
}
|
||||
UnitUpdate.addMissileTimerQueue(builder, missileTimerOffset);
|
||||
UnitUpdate.addLevel(builder, this.level());
|
||||
UnitUpdate.addHasTrainStation(builder, this._hasTrainStation);
|
||||
if (this._trainType !== undefined) {
|
||||
UnitUpdate.addTrainType(builder, builder.createString(this._trainType));
|
||||
}
|
||||
if (this._loaded !== undefined) {
|
||||
UnitUpdate.addLoaded(builder, this._loaded);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import version from "../../../resources/version.txt";
|
||||
import { ErrorUpdate, GameUpdateViewData } from "../../generated/game-updates";
|
||||
import { createGameRunner, GameRunner } from "../GameRunner";
|
||||
import { FetchGameMapLoader } from "../game/FetchGameMapLoader";
|
||||
import { ErrorUpdate, GameUpdateViewData } from "../game/GameUpdates";
|
||||
import {
|
||||
AttackAveragePositionResultMessage,
|
||||
InitializedMessage,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { ErrorUpdate } from "../../generated/game-updates/error-update";
|
||||
import { GameUpdateViewData } from "../../generated/game-updates/game-update-view-data";
|
||||
import {
|
||||
Cell,
|
||||
PlayerActions,
|
||||
@@ -6,7 +8,6 @@ import {
|
||||
PlayerProfile,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { ErrorUpdate, GameUpdateViewData } from "../game/GameUpdates";
|
||||
import { ClientID, GameStartInfo, Turn } from "../Schemas";
|
||||
import { generateID } from "../Util";
|
||||
import { WorkerMessage } from "./WorkerMessages";
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
PlayerProfile,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { GameUpdateViewData } from "../game/GameUpdates";
|
||||
import { GameUpdateViewData } from "../../generated/game-updates/game-update-view-data";
|
||||
import { ClientID, GameStartInfo, Turn } from "../Schemas";
|
||||
|
||||
export type WorkerMessageType =
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
export * as GameUpdates from "./game-updates.js";
|
||||
export * as GameUpdates from './game-updates.js';
|
||||
|
||||
@@ -2,39 +2,37 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
export { AllianceExpiredUpdate } from "./game-updates/alliance-expired-update.js";
|
||||
export { AllianceExtensionUpdate } from "./game-updates/alliance-extension-update.js";
|
||||
export { AllianceRequestReplyUpdate } from "./game-updates/alliance-request-reply-update.js";
|
||||
export { AllianceRequestUpdate } from "./game-updates/alliance-request-update.js";
|
||||
export { AllianceView } from "./game-updates/alliance-view.js";
|
||||
export { AttackUpdate } from "./game-updates/attack-update.js";
|
||||
export { BonusEventUpdate } from "./game-updates/bonus-event-update.js";
|
||||
export { BrokeAllianceUpdate } from "./game-updates/broke-alliance-update.js";
|
||||
export { ConquestUpdate } from "./game-updates/conquest-update.js";
|
||||
export { DisplayChatMessageUpdate } from "./game-updates/display-chat-message-update.js";
|
||||
export { DisplayMessageUpdate } from "./game-updates/display-message-update.js";
|
||||
export { EmbargoUpdate } from "./game-updates/embargo-update.js";
|
||||
export { EmojiMessage } from "./game-updates/emoji-message.js";
|
||||
export { EmojiUpdate } from "./game-updates/emoji-update.js";
|
||||
export { ErrorUpdate } from "./game-updates/error-update.js";
|
||||
export { GameUpdateType } from "./game-updates/game-update-type.js";
|
||||
export { GameUpdateUnion } from "./game-updates/game-update-union.js";
|
||||
export { GameUpdateViewData } from "./game-updates/game-update-view-data.js";
|
||||
export { GameUpdate } from "./game-updates/game-update.js";
|
||||
export { HashUpdate } from "./game-updates/hash-update.js";
|
||||
export { MessageType } from "./game-updates/message-type.js";
|
||||
export { NameViewData } from "./game-updates/name-view-data.js";
|
||||
export { PlayerType } from "./game-updates/player-type.js";
|
||||
export { PlayerUpdate } from "./game-updates/player-update.js";
|
||||
export { RailTile } from "./game-updates/rail-tile.js";
|
||||
export { RailType } from "./game-updates/rail-type.js";
|
||||
export { RailroadUpdate } from "./game-updates/railroad-update.js";
|
||||
export { TargetPlayerUpdate } from "./game-updates/target-player-update.js";
|
||||
export { TileRef } from "./game-updates/tile-ref.js";
|
||||
export { TileUpdateWrapper } from "./game-updates/tile-update-wrapper.js";
|
||||
export { TileUpdate } from "./game-updates/tile-update.js";
|
||||
export { TrainType } from "./game-updates/train-type.js";
|
||||
export { UnitIncomingUpdate } from "./game-updates/unit-incoming-update.js";
|
||||
export { UnitType } from "./game-updates/unit-type.js";
|
||||
export { UnitUpdate } from "./game-updates/unit-update.js";
|
||||
export { WinUpdate } from "./game-updates/win-update.js";
|
||||
export { AllianceExpiredUpdate, AllianceExpiredUpdateT } from './game-updates/alliance-expired-update.js';
|
||||
export { AllianceExtensionUpdate, AllianceExtensionUpdateT } from './game-updates/alliance-extension-update.js';
|
||||
export { AllianceRequestReplyUpdate, AllianceRequestReplyUpdateT } from './game-updates/alliance-request-reply-update.js';
|
||||
export { AllianceRequestUpdate, AllianceRequestUpdateT } from './game-updates/alliance-request-update.js';
|
||||
export { AllianceView, AllianceViewT } from './game-updates/alliance-view.js';
|
||||
export { AttackUpdate, AttackUpdateT } from './game-updates/attack-update.js';
|
||||
export { BonusEventUpdate, BonusEventUpdateT } from './game-updates/bonus-event-update.js';
|
||||
export { BrokeAllianceUpdate, BrokeAllianceUpdateT } from './game-updates/broke-alliance-update.js';
|
||||
export { ConquestUpdate, ConquestUpdateT } from './game-updates/conquest-update.js';
|
||||
export { DisplayChatMessageUpdate, DisplayChatMessageUpdateT } from './game-updates/display-chat-message-update.js';
|
||||
export { DisplayMessageUpdate, DisplayMessageUpdateT } from './game-updates/display-message-update.js';
|
||||
export { EmbargoUpdate, EmbargoUpdateT } from './game-updates/embargo-update.js';
|
||||
export { EmojiMessage, EmojiMessageT } from './game-updates/emoji-message.js';
|
||||
export { EmojiUpdate, EmojiUpdateT } from './game-updates/emoji-update.js';
|
||||
export { ErrorUpdate, ErrorUpdateT } from './game-updates/error-update.js';
|
||||
export { GameUpdate, GameUpdateT } from './game-updates/game-update.js';
|
||||
export { GameUpdateType } from './game-updates/game-update-type.js';
|
||||
export { GameUpdateUnion } from './game-updates/game-update-union.js';
|
||||
export { GameUpdateViewData, GameUpdateViewDataT } from './game-updates/game-update-view-data.js';
|
||||
export { HashUpdate, HashUpdateT } from './game-updates/hash-update.js';
|
||||
export { MessageType } from './game-updates/message-type.js';
|
||||
export { NameViewData, NameViewDataT } from './game-updates/name-view-data.js';
|
||||
export { PlayerUpdate, PlayerUpdateT } from './game-updates/player-update.js';
|
||||
export { RailTile, RailTileT } from './game-updates/rail-tile.js';
|
||||
export { RailType } from './game-updates/rail-type.js';
|
||||
export { RailroadUpdate, RailroadUpdateT } from './game-updates/railroad-update.js';
|
||||
export { TargetPlayerUpdate, TargetPlayerUpdateT } from './game-updates/target-player-update.js';
|
||||
export { TileUpdate, TileUpdateT } from './game-updates/tile-update.js';
|
||||
export { TileUpdateWrapper, TileUpdateWrapperT } from './game-updates/tile-update-wrapper.js';
|
||||
export { TrainType } from './game-updates/train-type.js';
|
||||
export { UnitIncomingUpdate, UnitIncomingUpdateT } from './game-updates/unit-incoming-update.js';
|
||||
export { UnitType } from './game-updates/unit-type.js';
|
||||
export { UnitUpdate, UnitUpdateT } from './game-updates/unit-update.js';
|
||||
export { WinUpdate, WinUpdateT } from './game-updates/win-update.js';
|
||||
|
||||
@@ -2,75 +2,87 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class AllianceExpiredUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
|
||||
export class AllianceExpiredUpdate implements flatbuffers.IUnpackableObject<AllianceExpiredUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): AllianceExpiredUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsAllianceExpiredUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: AllianceExpiredUpdate,
|
||||
): AllianceExpiredUpdate {
|
||||
return (obj || new AllianceExpiredUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsAllianceExpiredUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: AllianceExpiredUpdate,
|
||||
): AllianceExpiredUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new AllianceExpiredUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
player1Id(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
player2Id(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startAllianceExpiredUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addPlayer1Id(builder: flatbuffers.Builder, player1Id: number) {
|
||||
builder.addFieldInt32(0, player1Id, 0);
|
||||
}
|
||||
|
||||
static addPlayer2Id(builder: flatbuffers.Builder, player2Id: number) {
|
||||
builder.addFieldInt32(1, player2Id, 0);
|
||||
}
|
||||
|
||||
static endAllianceExpiredUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createAllianceExpiredUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
player1Id: number,
|
||||
player2Id: number,
|
||||
): flatbuffers.Offset {
|
||||
AllianceExpiredUpdate.startAllianceExpiredUpdate(builder);
|
||||
AllianceExpiredUpdate.addPlayer1Id(builder, player1Id);
|
||||
AllianceExpiredUpdate.addPlayer2Id(builder, player2Id);
|
||||
return AllianceExpiredUpdate.endAllianceExpiredUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):AllianceExpiredUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsAllianceExpiredUpdate(bb:flatbuffers.ByteBuffer, obj?:AllianceExpiredUpdate):AllianceExpiredUpdate {
|
||||
return (obj || new AllianceExpiredUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsAllianceExpiredUpdate(bb:flatbuffers.ByteBuffer, obj?:AllianceExpiredUpdate):AllianceExpiredUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new AllianceExpiredUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
player1Id():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
player2Id():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startAllianceExpiredUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addPlayer1Id(builder:flatbuffers.Builder, player1Id:number) {
|
||||
builder.addFieldInt32(0, player1Id, 0);
|
||||
}
|
||||
|
||||
static addPlayer2Id(builder:flatbuffers.Builder, player2Id:number) {
|
||||
builder.addFieldInt32(1, player2Id, 0);
|
||||
}
|
||||
|
||||
static endAllianceExpiredUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createAllianceExpiredUpdate(builder:flatbuffers.Builder, player1Id:number, player2Id:number):flatbuffers.Offset {
|
||||
AllianceExpiredUpdate.startAllianceExpiredUpdate(builder);
|
||||
AllianceExpiredUpdate.addPlayer1Id(builder, player1Id);
|
||||
AllianceExpiredUpdate.addPlayer2Id(builder, player2Id);
|
||||
return AllianceExpiredUpdate.endAllianceExpiredUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): AllianceExpiredUpdateT {
|
||||
return new AllianceExpiredUpdateT(
|
||||
this.player1Id(),
|
||||
this.player2Id()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: AllianceExpiredUpdateT): void {
|
||||
_o.player1Id = this.player1Id();
|
||||
_o.player2Id = this.player2Id();
|
||||
}
|
||||
}
|
||||
|
||||
export class AllianceExpiredUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public player1Id: number = 0,
|
||||
public player2Id: number = 0
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return AllianceExpiredUpdate.createAllianceExpiredUpdate(builder,
|
||||
this.player1Id,
|
||||
this.player2Id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,75 +2,87 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class AllianceExtensionUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
|
||||
export class AllianceExtensionUpdate implements flatbuffers.IUnpackableObject<AllianceExtensionUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): AllianceExtensionUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsAllianceExtensionUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: AllianceExtensionUpdate,
|
||||
): AllianceExtensionUpdate {
|
||||
return (obj || new AllianceExtensionUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsAllianceExtensionUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: AllianceExtensionUpdate,
|
||||
): AllianceExtensionUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new AllianceExtensionUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
playerId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
allianceId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startAllianceExtensionUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addPlayerId(builder: flatbuffers.Builder, playerId: number) {
|
||||
builder.addFieldInt32(0, playerId, 0);
|
||||
}
|
||||
|
||||
static addAllianceId(builder: flatbuffers.Builder, allianceId: number) {
|
||||
builder.addFieldInt32(1, allianceId, 0);
|
||||
}
|
||||
|
||||
static endAllianceExtensionUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createAllianceExtensionUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
playerId: number,
|
||||
allianceId: number,
|
||||
): flatbuffers.Offset {
|
||||
AllianceExtensionUpdate.startAllianceExtensionUpdate(builder);
|
||||
AllianceExtensionUpdate.addPlayerId(builder, playerId);
|
||||
AllianceExtensionUpdate.addAllianceId(builder, allianceId);
|
||||
return AllianceExtensionUpdate.endAllianceExtensionUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):AllianceExtensionUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsAllianceExtensionUpdate(bb:flatbuffers.ByteBuffer, obj?:AllianceExtensionUpdate):AllianceExtensionUpdate {
|
||||
return (obj || new AllianceExtensionUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsAllianceExtensionUpdate(bb:flatbuffers.ByteBuffer, obj?:AllianceExtensionUpdate):AllianceExtensionUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new AllianceExtensionUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
playerId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
allianceId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startAllianceExtensionUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addPlayerId(builder:flatbuffers.Builder, playerId:number) {
|
||||
builder.addFieldInt32(0, playerId, 0);
|
||||
}
|
||||
|
||||
static addAllianceId(builder:flatbuffers.Builder, allianceId:number) {
|
||||
builder.addFieldInt32(1, allianceId, 0);
|
||||
}
|
||||
|
||||
static endAllianceExtensionUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createAllianceExtensionUpdate(builder:flatbuffers.Builder, playerId:number, allianceId:number):flatbuffers.Offset {
|
||||
AllianceExtensionUpdate.startAllianceExtensionUpdate(builder);
|
||||
AllianceExtensionUpdate.addPlayerId(builder, playerId);
|
||||
AllianceExtensionUpdate.addAllianceId(builder, allianceId);
|
||||
return AllianceExtensionUpdate.endAllianceExtensionUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): AllianceExtensionUpdateT {
|
||||
return new AllianceExtensionUpdateT(
|
||||
this.playerId(),
|
||||
this.allianceId()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: AllianceExtensionUpdateT): void {
|
||||
_o.playerId = this.playerId();
|
||||
_o.allianceId = this.allianceId();
|
||||
}
|
||||
}
|
||||
|
||||
export class AllianceExtensionUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public playerId: number = 0,
|
||||
public allianceId: number = 0
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return AllianceExtensionUpdate.createAllianceExtensionUpdate(builder,
|
||||
this.playerId,
|
||||
this.allianceId
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,85 +2,90 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { AllianceRequestUpdate } from "../game-updates/alliance-request-update.js";
|
||||
import { AllianceRequestUpdate, AllianceRequestUpdateT } from '../game-updates/alliance-request-update.js';
|
||||
|
||||
export class AllianceRequestReplyUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
export class AllianceRequestReplyUpdate implements flatbuffers.IUnpackableObject<AllianceRequestReplyUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): AllianceRequestReplyUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsAllianceRequestReplyUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: AllianceRequestReplyUpdate,
|
||||
): AllianceRequestReplyUpdate {
|
||||
return (obj || new AllianceRequestReplyUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsAllianceRequestReplyUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: AllianceRequestReplyUpdate,
|
||||
): AllianceRequestReplyUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new AllianceRequestReplyUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
request(obj?: AllianceRequestUpdate): AllianceRequestUpdate | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset
|
||||
? (obj || new AllianceRequestUpdate()).__init(
|
||||
this.bb!.__indirect(this.bb_pos + offset),
|
||||
this.bb!,
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
||||
accepted(): boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
static startAllianceRequestReplyUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addRequest(
|
||||
builder: flatbuffers.Builder,
|
||||
requestOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(0, requestOffset, 0);
|
||||
}
|
||||
|
||||
static addAccepted(builder: flatbuffers.Builder, accepted: boolean) {
|
||||
builder.addFieldInt8(1, +accepted, +false);
|
||||
}
|
||||
|
||||
static endAllianceRequestReplyUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createAllianceRequestReplyUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
requestOffset: flatbuffers.Offset,
|
||||
accepted: boolean,
|
||||
): flatbuffers.Offset {
|
||||
AllianceRequestReplyUpdate.startAllianceRequestReplyUpdate(builder);
|
||||
AllianceRequestReplyUpdate.addRequest(builder, requestOffset);
|
||||
AllianceRequestReplyUpdate.addAccepted(builder, accepted);
|
||||
return AllianceRequestReplyUpdate.endAllianceRequestReplyUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):AllianceRequestReplyUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsAllianceRequestReplyUpdate(bb:flatbuffers.ByteBuffer, obj?:AllianceRequestReplyUpdate):AllianceRequestReplyUpdate {
|
||||
return (obj || new AllianceRequestReplyUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsAllianceRequestReplyUpdate(bb:flatbuffers.ByteBuffer, obj?:AllianceRequestReplyUpdate):AllianceRequestReplyUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new AllianceRequestReplyUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
request(obj?:AllianceRequestUpdate):AllianceRequestUpdate|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? (obj || new AllianceRequestUpdate()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
|
||||
}
|
||||
|
||||
accepted():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
static startAllianceRequestReplyUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addRequest(builder:flatbuffers.Builder, requestOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, requestOffset, 0);
|
||||
}
|
||||
|
||||
static addAccepted(builder:flatbuffers.Builder, accepted:boolean) {
|
||||
builder.addFieldInt8(1, +accepted, +false);
|
||||
}
|
||||
|
||||
static endAllianceRequestReplyUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createAllianceRequestReplyUpdate(builder:flatbuffers.Builder, requestOffset:flatbuffers.Offset, accepted:boolean):flatbuffers.Offset {
|
||||
AllianceRequestReplyUpdate.startAllianceRequestReplyUpdate(builder);
|
||||
AllianceRequestReplyUpdate.addRequest(builder, requestOffset);
|
||||
AllianceRequestReplyUpdate.addAccepted(builder, accepted);
|
||||
return AllianceRequestReplyUpdate.endAllianceRequestReplyUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): AllianceRequestReplyUpdateT {
|
||||
return new AllianceRequestReplyUpdateT(
|
||||
(this.request() !== null ? this.request()!.unpack() : null),
|
||||
this.accepted()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: AllianceRequestReplyUpdateT): void {
|
||||
_o.request = (this.request() !== null ? this.request()!.unpack() : null);
|
||||
_o.accepted = this.accepted();
|
||||
}
|
||||
}
|
||||
|
||||
export class AllianceRequestReplyUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public request: AllianceRequestUpdateT|null = null,
|
||||
public accepted: boolean = false
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const request = (this.request !== null ? this.request!.pack(builder) : 0);
|
||||
|
||||
return AllianceRequestReplyUpdate.createAllianceRequestReplyUpdate(builder,
|
||||
request,
|
||||
this.accepted
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,86 +2,101 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class AllianceRequestUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
|
||||
export class AllianceRequestUpdate implements flatbuffers.IUnpackableObject<AllianceRequestUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): AllianceRequestUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsAllianceRequestUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: AllianceRequestUpdate,
|
||||
): AllianceRequestUpdate {
|
||||
return (obj || new AllianceRequestUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsAllianceRequestUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: AllianceRequestUpdate,
|
||||
): AllianceRequestUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new AllianceRequestUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
requestorId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
recipientId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
createdAt(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startAllianceRequestUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(3);
|
||||
}
|
||||
|
||||
static addRequestorId(builder: flatbuffers.Builder, requestorId: number) {
|
||||
builder.addFieldInt32(0, requestorId, 0);
|
||||
}
|
||||
|
||||
static addRecipientId(builder: flatbuffers.Builder, recipientId: number) {
|
||||
builder.addFieldInt32(1, recipientId, 0);
|
||||
}
|
||||
|
||||
static addCreatedAt(builder: flatbuffers.Builder, createdAt: number) {
|
||||
builder.addFieldInt32(2, createdAt, 0);
|
||||
}
|
||||
|
||||
static endAllianceRequestUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createAllianceRequestUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
requestorId: number,
|
||||
recipientId: number,
|
||||
createdAt: number,
|
||||
): flatbuffers.Offset {
|
||||
AllianceRequestUpdate.startAllianceRequestUpdate(builder);
|
||||
AllianceRequestUpdate.addRequestorId(builder, requestorId);
|
||||
AllianceRequestUpdate.addRecipientId(builder, recipientId);
|
||||
AllianceRequestUpdate.addCreatedAt(builder, createdAt);
|
||||
return AllianceRequestUpdate.endAllianceRequestUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):AllianceRequestUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsAllianceRequestUpdate(bb:flatbuffers.ByteBuffer, obj?:AllianceRequestUpdate):AllianceRequestUpdate {
|
||||
return (obj || new AllianceRequestUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsAllianceRequestUpdate(bb:flatbuffers.ByteBuffer, obj?:AllianceRequestUpdate):AllianceRequestUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new AllianceRequestUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
requestorId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
recipientId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
createdAt():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startAllianceRequestUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(3);
|
||||
}
|
||||
|
||||
static addRequestorId(builder:flatbuffers.Builder, requestorId:number) {
|
||||
builder.addFieldInt32(0, requestorId, 0);
|
||||
}
|
||||
|
||||
static addRecipientId(builder:flatbuffers.Builder, recipientId:number) {
|
||||
builder.addFieldInt32(1, recipientId, 0);
|
||||
}
|
||||
|
||||
static addCreatedAt(builder:flatbuffers.Builder, createdAt:number) {
|
||||
builder.addFieldInt32(2, createdAt, 0);
|
||||
}
|
||||
|
||||
static endAllianceRequestUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createAllianceRequestUpdate(builder:flatbuffers.Builder, requestorId:number, recipientId:number, createdAt:number):flatbuffers.Offset {
|
||||
AllianceRequestUpdate.startAllianceRequestUpdate(builder);
|
||||
AllianceRequestUpdate.addRequestorId(builder, requestorId);
|
||||
AllianceRequestUpdate.addRecipientId(builder, recipientId);
|
||||
AllianceRequestUpdate.addCreatedAt(builder, createdAt);
|
||||
return AllianceRequestUpdate.endAllianceRequestUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): AllianceRequestUpdateT {
|
||||
return new AllianceRequestUpdateT(
|
||||
this.requestorId(),
|
||||
this.recipientId(),
|
||||
this.createdAt()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: AllianceRequestUpdateT): void {
|
||||
_o.requestorId = this.requestorId();
|
||||
_o.recipientId = this.recipientId();
|
||||
_o.createdAt = this.createdAt();
|
||||
}
|
||||
}
|
||||
|
||||
export class AllianceRequestUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public requestorId: number = 0,
|
||||
public recipientId: number = 0,
|
||||
public createdAt: number = 0
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return AllianceRequestUpdate.createAllianceRequestUpdate(builder,
|
||||
this.requestorId,
|
||||
this.recipientId,
|
||||
this.createdAt
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,109 +2,133 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class AllianceView {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
|
||||
export class AllianceView implements flatbuffers.IUnpackableObject<AllianceViewT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): AllianceView {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsAllianceView(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: AllianceView,
|
||||
): AllianceView {
|
||||
return (obj || new AllianceView()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsAllianceView(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: AllianceView,
|
||||
): AllianceView {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new AllianceView()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
id(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
other(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
createdAt(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
expiresAt(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
hasExtensionRequest(): boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
static startAllianceView(builder: flatbuffers.Builder) {
|
||||
builder.startObject(5);
|
||||
}
|
||||
|
||||
static addId(builder: flatbuffers.Builder, id: number) {
|
||||
builder.addFieldInt32(0, id, 0);
|
||||
}
|
||||
|
||||
static addOther(builder: flatbuffers.Builder, other: number) {
|
||||
builder.addFieldInt32(1, other, 0);
|
||||
}
|
||||
|
||||
static addCreatedAt(builder: flatbuffers.Builder, createdAt: number) {
|
||||
builder.addFieldInt32(2, createdAt, 0);
|
||||
}
|
||||
|
||||
static addExpiresAt(builder: flatbuffers.Builder, expiresAt: number) {
|
||||
builder.addFieldInt32(3, expiresAt, 0);
|
||||
}
|
||||
|
||||
static addHasExtensionRequest(
|
||||
builder: flatbuffers.Builder,
|
||||
hasExtensionRequest: boolean,
|
||||
) {
|
||||
builder.addFieldInt8(4, +hasExtensionRequest, +false);
|
||||
}
|
||||
|
||||
static endAllianceView(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createAllianceView(
|
||||
builder: flatbuffers.Builder,
|
||||
id: number,
|
||||
other: number,
|
||||
createdAt: number,
|
||||
expiresAt: number,
|
||||
hasExtensionRequest: boolean,
|
||||
): flatbuffers.Offset {
|
||||
AllianceView.startAllianceView(builder);
|
||||
AllianceView.addId(builder, id);
|
||||
AllianceView.addOther(builder, other);
|
||||
AllianceView.addCreatedAt(builder, createdAt);
|
||||
AllianceView.addExpiresAt(builder, expiresAt);
|
||||
AllianceView.addHasExtensionRequest(builder, hasExtensionRequest);
|
||||
return AllianceView.endAllianceView(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):AllianceView {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsAllianceView(bb:flatbuffers.ByteBuffer, obj?:AllianceView):AllianceView {
|
||||
return (obj || new AllianceView()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsAllianceView(bb:flatbuffers.ByteBuffer, obj?:AllianceView):AllianceView {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new AllianceView()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
id():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
other():string|null
|
||||
other(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
other(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
createdAt():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
expiresAt():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
hasExtensionRequest():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
static startAllianceView(builder:flatbuffers.Builder) {
|
||||
builder.startObject(5);
|
||||
}
|
||||
|
||||
static addId(builder:flatbuffers.Builder, id:number) {
|
||||
builder.addFieldInt32(0, id, 0);
|
||||
}
|
||||
|
||||
static addOther(builder:flatbuffers.Builder, otherOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(1, otherOffset, 0);
|
||||
}
|
||||
|
||||
static addCreatedAt(builder:flatbuffers.Builder, createdAt:number) {
|
||||
builder.addFieldInt32(2, createdAt, 0);
|
||||
}
|
||||
|
||||
static addExpiresAt(builder:flatbuffers.Builder, expiresAt:number) {
|
||||
builder.addFieldInt32(3, expiresAt, 0);
|
||||
}
|
||||
|
||||
static addHasExtensionRequest(builder:flatbuffers.Builder, hasExtensionRequest:boolean) {
|
||||
builder.addFieldInt8(4, +hasExtensionRequest, +false);
|
||||
}
|
||||
|
||||
static endAllianceView(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createAllianceView(builder:flatbuffers.Builder, id:number, otherOffset:flatbuffers.Offset, createdAt:number, expiresAt:number, hasExtensionRequest:boolean):flatbuffers.Offset {
|
||||
AllianceView.startAllianceView(builder);
|
||||
AllianceView.addId(builder, id);
|
||||
AllianceView.addOther(builder, otherOffset);
|
||||
AllianceView.addCreatedAt(builder, createdAt);
|
||||
AllianceView.addExpiresAt(builder, expiresAt);
|
||||
AllianceView.addHasExtensionRequest(builder, hasExtensionRequest);
|
||||
return AllianceView.endAllianceView(builder);
|
||||
}
|
||||
|
||||
unpack(): AllianceViewT {
|
||||
return new AllianceViewT(
|
||||
this.id(),
|
||||
this.other(),
|
||||
this.createdAt(),
|
||||
this.expiresAt(),
|
||||
this.hasExtensionRequest()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: AllianceViewT): void {
|
||||
_o.id = this.id();
|
||||
_o.other = this.other();
|
||||
_o.createdAt = this.createdAt();
|
||||
_o.expiresAt = this.expiresAt();
|
||||
_o.hasExtensionRequest = this.hasExtensionRequest();
|
||||
}
|
||||
}
|
||||
|
||||
export class AllianceViewT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public id: number = 0,
|
||||
public other: string|Uint8Array|null = null,
|
||||
public createdAt: number = 0,
|
||||
public expiresAt: number = 0,
|
||||
public hasExtensionRequest: boolean = false
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const other = (this.other !== null ? builder.createString(this.other!) : 0);
|
||||
|
||||
return AllianceView.createAllianceView(builder,
|
||||
this.id,
|
||||
other,
|
||||
this.createdAt,
|
||||
this.expiresAt,
|
||||
this.hasExtensionRequest
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,110 +2,133 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class AttackUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
|
||||
export class AttackUpdate implements flatbuffers.IUnpackableObject<AttackUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): AttackUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsAttackUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: AttackUpdate,
|
||||
): AttackUpdate {
|
||||
return (obj || new AttackUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsAttackUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: AttackUpdate,
|
||||
): AttackUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new AttackUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
attackerId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
targetId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
troops(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
id(): string | null;
|
||||
id(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
id(optionalEncoding?: any): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset
|
||||
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
||||
: null;
|
||||
}
|
||||
|
||||
retreating(): boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
static startAttackUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(5);
|
||||
}
|
||||
|
||||
static addAttackerId(builder: flatbuffers.Builder, attackerId: number) {
|
||||
builder.addFieldInt32(0, attackerId, 0);
|
||||
}
|
||||
|
||||
static addTargetId(builder: flatbuffers.Builder, targetId: number) {
|
||||
builder.addFieldInt32(1, targetId, 0);
|
||||
}
|
||||
|
||||
static addTroops(builder: flatbuffers.Builder, troops: number) {
|
||||
builder.addFieldInt32(2, troops, 0);
|
||||
}
|
||||
|
||||
static addId(builder: flatbuffers.Builder, idOffset: flatbuffers.Offset) {
|
||||
builder.addFieldOffset(3, idOffset, 0);
|
||||
}
|
||||
|
||||
static addRetreating(builder: flatbuffers.Builder, retreating: boolean) {
|
||||
builder.addFieldInt8(4, +retreating, +false);
|
||||
}
|
||||
|
||||
static endAttackUpdate(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createAttackUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
attackerId: number,
|
||||
targetId: number,
|
||||
troops: number,
|
||||
idOffset: flatbuffers.Offset,
|
||||
retreating: boolean,
|
||||
): flatbuffers.Offset {
|
||||
AttackUpdate.startAttackUpdate(builder);
|
||||
AttackUpdate.addAttackerId(builder, attackerId);
|
||||
AttackUpdate.addTargetId(builder, targetId);
|
||||
AttackUpdate.addTroops(builder, troops);
|
||||
AttackUpdate.addId(builder, idOffset);
|
||||
AttackUpdate.addRetreating(builder, retreating);
|
||||
return AttackUpdate.endAttackUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):AttackUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsAttackUpdate(bb:flatbuffers.ByteBuffer, obj?:AttackUpdate):AttackUpdate {
|
||||
return (obj || new AttackUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsAttackUpdate(bb:flatbuffers.ByteBuffer, obj?:AttackUpdate):AttackUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new AttackUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
attackerId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
targetId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
troops():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
id():string|null
|
||||
id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
id(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
retreating():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
static startAttackUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(5);
|
||||
}
|
||||
|
||||
static addAttackerId(builder:flatbuffers.Builder, attackerId:number) {
|
||||
builder.addFieldInt32(0, attackerId, 0);
|
||||
}
|
||||
|
||||
static addTargetId(builder:flatbuffers.Builder, targetId:number) {
|
||||
builder.addFieldInt32(1, targetId, 0);
|
||||
}
|
||||
|
||||
static addTroops(builder:flatbuffers.Builder, troops:number) {
|
||||
builder.addFieldInt32(2, troops, 0);
|
||||
}
|
||||
|
||||
static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(3, idOffset, 0);
|
||||
}
|
||||
|
||||
static addRetreating(builder:flatbuffers.Builder, retreating:boolean) {
|
||||
builder.addFieldInt8(4, +retreating, +false);
|
||||
}
|
||||
|
||||
static endAttackUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createAttackUpdate(builder:flatbuffers.Builder, attackerId:number, targetId:number, troops:number, idOffset:flatbuffers.Offset, retreating:boolean):flatbuffers.Offset {
|
||||
AttackUpdate.startAttackUpdate(builder);
|
||||
AttackUpdate.addAttackerId(builder, attackerId);
|
||||
AttackUpdate.addTargetId(builder, targetId);
|
||||
AttackUpdate.addTroops(builder, troops);
|
||||
AttackUpdate.addId(builder, idOffset);
|
||||
AttackUpdate.addRetreating(builder, retreating);
|
||||
return AttackUpdate.endAttackUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): AttackUpdateT {
|
||||
return new AttackUpdateT(
|
||||
this.attackerId(),
|
||||
this.targetId(),
|
||||
this.troops(),
|
||||
this.id(),
|
||||
this.retreating()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: AttackUpdateT): void {
|
||||
_o.attackerId = this.attackerId();
|
||||
_o.targetId = this.targetId();
|
||||
_o.troops = this.troops();
|
||||
_o.id = this.id();
|
||||
_o.retreating = this.retreating();
|
||||
}
|
||||
}
|
||||
|
||||
export class AttackUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public attackerId: number = 0,
|
||||
public targetId: number = 0,
|
||||
public troops: number = 0,
|
||||
public id: string|Uint8Array|null = null,
|
||||
public retreating: boolean = false
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const id = (this.id !== null ? builder.createString(this.id!) : 0);
|
||||
|
||||
return AttackUpdate.createAttackUpdate(builder,
|
||||
this.attackerId,
|
||||
this.targetId,
|
||||
this.troops,
|
||||
id,
|
||||
this.retreating
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,87 +2,115 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { TileRef } from "../game-updates/tile-ref.js";
|
||||
|
||||
export class BonusEventUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
export class BonusEventUpdate implements flatbuffers.IUnpackableObject<BonusEventUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): BonusEventUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsBonusEventUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: BonusEventUpdate,
|
||||
): BonusEventUpdate {
|
||||
return (obj || new BonusEventUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsBonusEventUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: BonusEventUpdate,
|
||||
): BonusEventUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new BonusEventUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
player(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
tile(obj?: TileRef): TileRef | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset
|
||||
? (obj || new TileRef()).__init(
|
||||
this.bb!.__indirect(this.bb_pos + offset),
|
||||
this.bb!,
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
||||
gold(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
troops(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startBonusEventUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(4);
|
||||
}
|
||||
|
||||
static addPlayer(builder: flatbuffers.Builder, player: number) {
|
||||
builder.addFieldInt32(0, player, 0);
|
||||
}
|
||||
|
||||
static addTile(builder: flatbuffers.Builder, tileOffset: flatbuffers.Offset) {
|
||||
builder.addFieldOffset(1, tileOffset, 0);
|
||||
}
|
||||
|
||||
static addGold(builder: flatbuffers.Builder, gold: number) {
|
||||
builder.addFieldInt32(2, gold, 0);
|
||||
}
|
||||
|
||||
static addTroops(builder: flatbuffers.Builder, troops: number) {
|
||||
builder.addFieldInt32(3, troops, 0);
|
||||
}
|
||||
|
||||
static endBonusEventUpdate(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):BonusEventUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsBonusEventUpdate(bb:flatbuffers.ByteBuffer, obj?:BonusEventUpdate):BonusEventUpdate {
|
||||
return (obj || new BonusEventUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsBonusEventUpdate(bb:flatbuffers.ByteBuffer, obj?:BonusEventUpdate):BonusEventUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new BonusEventUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
player():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
tile():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
gold():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
troops():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startBonusEventUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(4);
|
||||
}
|
||||
|
||||
static addPlayer(builder:flatbuffers.Builder, player:number) {
|
||||
builder.addFieldInt32(0, player, 0);
|
||||
}
|
||||
|
||||
static addTile(builder:flatbuffers.Builder, tile:bigint) {
|
||||
builder.addFieldInt64(1, tile, BigInt('0'));
|
||||
}
|
||||
|
||||
static addGold(builder:flatbuffers.Builder, gold:number) {
|
||||
builder.addFieldInt32(2, gold, 0);
|
||||
}
|
||||
|
||||
static addTroops(builder:flatbuffers.Builder, troops:number) {
|
||||
builder.addFieldInt32(3, troops, 0);
|
||||
}
|
||||
|
||||
static endBonusEventUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createBonusEventUpdate(builder:flatbuffers.Builder, player:number, tile:bigint, gold:number, troops:number):flatbuffers.Offset {
|
||||
BonusEventUpdate.startBonusEventUpdate(builder);
|
||||
BonusEventUpdate.addPlayer(builder, player);
|
||||
BonusEventUpdate.addTile(builder, tile);
|
||||
BonusEventUpdate.addGold(builder, gold);
|
||||
BonusEventUpdate.addTroops(builder, troops);
|
||||
return BonusEventUpdate.endBonusEventUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): BonusEventUpdateT {
|
||||
return new BonusEventUpdateT(
|
||||
this.player(),
|
||||
this.tile(),
|
||||
this.gold(),
|
||||
this.troops()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: BonusEventUpdateT): void {
|
||||
_o.player = this.player();
|
||||
_o.tile = this.tile();
|
||||
_o.gold = this.gold();
|
||||
_o.troops = this.troops();
|
||||
}
|
||||
}
|
||||
|
||||
export class BonusEventUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public player: number = 0,
|
||||
public tile: bigint = BigInt('0'),
|
||||
public gold: number = 0,
|
||||
public troops: number = 0
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return BonusEventUpdate.createBonusEventUpdate(builder,
|
||||
this.player,
|
||||
this.tile,
|
||||
this.gold,
|
||||
this.troops
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,75 +2,87 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class BrokeAllianceUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
|
||||
export class BrokeAllianceUpdate implements flatbuffers.IUnpackableObject<BrokeAllianceUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): BrokeAllianceUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsBrokeAllianceUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: BrokeAllianceUpdate,
|
||||
): BrokeAllianceUpdate {
|
||||
return (obj || new BrokeAllianceUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsBrokeAllianceUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: BrokeAllianceUpdate,
|
||||
): BrokeAllianceUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new BrokeAllianceUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
traitorId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
betrayedId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startBrokeAllianceUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addTraitorId(builder: flatbuffers.Builder, traitorId: number) {
|
||||
builder.addFieldInt32(0, traitorId, 0);
|
||||
}
|
||||
|
||||
static addBetrayedId(builder: flatbuffers.Builder, betrayedId: number) {
|
||||
builder.addFieldInt32(1, betrayedId, 0);
|
||||
}
|
||||
|
||||
static endBrokeAllianceUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createBrokeAllianceUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
traitorId: number,
|
||||
betrayedId: number,
|
||||
): flatbuffers.Offset {
|
||||
BrokeAllianceUpdate.startBrokeAllianceUpdate(builder);
|
||||
BrokeAllianceUpdate.addTraitorId(builder, traitorId);
|
||||
BrokeAllianceUpdate.addBetrayedId(builder, betrayedId);
|
||||
return BrokeAllianceUpdate.endBrokeAllianceUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):BrokeAllianceUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsBrokeAllianceUpdate(bb:flatbuffers.ByteBuffer, obj?:BrokeAllianceUpdate):BrokeAllianceUpdate {
|
||||
return (obj || new BrokeAllianceUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsBrokeAllianceUpdate(bb:flatbuffers.ByteBuffer, obj?:BrokeAllianceUpdate):BrokeAllianceUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new BrokeAllianceUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
traitorId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
betrayedId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startBrokeAllianceUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addTraitorId(builder:flatbuffers.Builder, traitorId:number) {
|
||||
builder.addFieldInt32(0, traitorId, 0);
|
||||
}
|
||||
|
||||
static addBetrayedId(builder:flatbuffers.Builder, betrayedId:number) {
|
||||
builder.addFieldInt32(1, betrayedId, 0);
|
||||
}
|
||||
|
||||
static endBrokeAllianceUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createBrokeAllianceUpdate(builder:flatbuffers.Builder, traitorId:number, betrayedId:number):flatbuffers.Offset {
|
||||
BrokeAllianceUpdate.startBrokeAllianceUpdate(builder);
|
||||
BrokeAllianceUpdate.addTraitorId(builder, traitorId);
|
||||
BrokeAllianceUpdate.addBetrayedId(builder, betrayedId);
|
||||
return BrokeAllianceUpdate.endBrokeAllianceUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): BrokeAllianceUpdateT {
|
||||
return new BrokeAllianceUpdateT(
|
||||
this.traitorId(),
|
||||
this.betrayedId()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: BrokeAllianceUpdateT): void {
|
||||
_o.traitorId = this.traitorId();
|
||||
_o.betrayedId = this.betrayedId();
|
||||
}
|
||||
}
|
||||
|
||||
export class BrokeAllianceUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public traitorId: number = 0,
|
||||
public betrayedId: number = 0
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return BrokeAllianceUpdate.createBrokeAllianceUpdate(builder,
|
||||
this.traitorId,
|
||||
this.betrayedId
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,84 +2,101 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class ConquestUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
|
||||
export class ConquestUpdate implements flatbuffers.IUnpackableObject<ConquestUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): ConquestUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsConquestUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: ConquestUpdate,
|
||||
): ConquestUpdate {
|
||||
return (obj || new ConquestUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsConquestUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: ConquestUpdate,
|
||||
): ConquestUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new ConquestUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
conquerorId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
conqueredId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
gold(): bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt("0");
|
||||
}
|
||||
|
||||
static startConquestUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(3);
|
||||
}
|
||||
|
||||
static addConquerorId(builder: flatbuffers.Builder, conquerorId: number) {
|
||||
builder.addFieldInt32(0, conquerorId, 0);
|
||||
}
|
||||
|
||||
static addConqueredId(builder: flatbuffers.Builder, conqueredId: number) {
|
||||
builder.addFieldInt32(1, conqueredId, 0);
|
||||
}
|
||||
|
||||
static addGold(builder: flatbuffers.Builder, gold: bigint) {
|
||||
builder.addFieldInt64(2, gold, BigInt("0"));
|
||||
}
|
||||
|
||||
static endConquestUpdate(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createConquestUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
conquerorId: number,
|
||||
conqueredId: number,
|
||||
gold: bigint,
|
||||
): flatbuffers.Offset {
|
||||
ConquestUpdate.startConquestUpdate(builder);
|
||||
ConquestUpdate.addConquerorId(builder, conquerorId);
|
||||
ConquestUpdate.addConqueredId(builder, conqueredId);
|
||||
ConquestUpdate.addGold(builder, gold);
|
||||
return ConquestUpdate.endConquestUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):ConquestUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsConquestUpdate(bb:flatbuffers.ByteBuffer, obj?:ConquestUpdate):ConquestUpdate {
|
||||
return (obj || new ConquestUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsConquestUpdate(bb:flatbuffers.ByteBuffer, obj?:ConquestUpdate):ConquestUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new ConquestUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
conquerorId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
conqueredId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
gold():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
static startConquestUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(3);
|
||||
}
|
||||
|
||||
static addConquerorId(builder:flatbuffers.Builder, conquerorId:number) {
|
||||
builder.addFieldInt32(0, conquerorId, 0);
|
||||
}
|
||||
|
||||
static addConqueredId(builder:flatbuffers.Builder, conqueredId:number) {
|
||||
builder.addFieldInt32(1, conqueredId, 0);
|
||||
}
|
||||
|
||||
static addGold(builder:flatbuffers.Builder, gold:bigint) {
|
||||
builder.addFieldInt64(2, gold, BigInt('0'));
|
||||
}
|
||||
|
||||
static endConquestUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createConquestUpdate(builder:flatbuffers.Builder, conquerorId:number, conqueredId:number, gold:bigint):flatbuffers.Offset {
|
||||
ConquestUpdate.startConquestUpdate(builder);
|
||||
ConquestUpdate.addConquerorId(builder, conquerorId);
|
||||
ConquestUpdate.addConqueredId(builder, conqueredId);
|
||||
ConquestUpdate.addGold(builder, gold);
|
||||
return ConquestUpdate.endConquestUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): ConquestUpdateT {
|
||||
return new ConquestUpdateT(
|
||||
this.conquerorId(),
|
||||
this.conqueredId(),
|
||||
this.gold()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: ConquestUpdateT): void {
|
||||
_o.conquerorId = this.conquerorId();
|
||||
_o.conqueredId = this.conqueredId();
|
||||
_o.gold = this.gold();
|
||||
}
|
||||
}
|
||||
|
||||
export class ConquestUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public conquerorId: number = 0,
|
||||
public conqueredId: number = 0,
|
||||
public gold: bigint = BigInt('0')
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return ConquestUpdate.createConquestUpdate(builder,
|
||||
this.conquerorId,
|
||||
this.conqueredId,
|
||||
this.gold
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,144 +2,156 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class DisplayChatMessageUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
|
||||
export class DisplayChatMessageUpdate implements flatbuffers.IUnpackableObject<DisplayChatMessageUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): DisplayChatMessageUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsDisplayChatMessageUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: DisplayChatMessageUpdate,
|
||||
): DisplayChatMessageUpdate {
|
||||
return (obj || new DisplayChatMessageUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsDisplayChatMessageUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: DisplayChatMessageUpdate,
|
||||
): DisplayChatMessageUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new DisplayChatMessageUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
key(): string | null;
|
||||
key(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
key(optionalEncoding?: any): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset
|
||||
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
||||
: null;
|
||||
}
|
||||
|
||||
category(): string | null;
|
||||
category(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
category(optionalEncoding?: any): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset
|
||||
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
||||
: null;
|
||||
}
|
||||
|
||||
target(): string | null;
|
||||
target(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
target(optionalEncoding?: any): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset
|
||||
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
||||
: null;
|
||||
}
|
||||
|
||||
playerId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
|
||||
}
|
||||
|
||||
isFrom(): boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
recipient(): string | null;
|
||||
recipient(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
recipient(optionalEncoding?: any): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 14);
|
||||
return offset
|
||||
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
||||
: null;
|
||||
}
|
||||
|
||||
static startDisplayChatMessageUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(6);
|
||||
}
|
||||
|
||||
static addKey(builder: flatbuffers.Builder, keyOffset: flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, keyOffset, 0);
|
||||
}
|
||||
|
||||
static addCategory(
|
||||
builder: flatbuffers.Builder,
|
||||
categoryOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(1, categoryOffset, 0);
|
||||
}
|
||||
|
||||
static addTarget(
|
||||
builder: flatbuffers.Builder,
|
||||
targetOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(2, targetOffset, 0);
|
||||
}
|
||||
|
||||
static addPlayerId(builder: flatbuffers.Builder, playerId: number) {
|
||||
builder.addFieldInt32(3, playerId, -1);
|
||||
}
|
||||
|
||||
static addIsFrom(builder: flatbuffers.Builder, isFrom: boolean) {
|
||||
builder.addFieldInt8(4, +isFrom, +false);
|
||||
}
|
||||
|
||||
static addRecipient(
|
||||
builder: flatbuffers.Builder,
|
||||
recipientOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(5, recipientOffset, 0);
|
||||
}
|
||||
|
||||
static endDisplayChatMessageUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createDisplayChatMessageUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
keyOffset: flatbuffers.Offset,
|
||||
categoryOffset: flatbuffers.Offset,
|
||||
targetOffset: flatbuffers.Offset,
|
||||
playerId: number,
|
||||
isFrom: boolean,
|
||||
recipientOffset: flatbuffers.Offset,
|
||||
): flatbuffers.Offset {
|
||||
DisplayChatMessageUpdate.startDisplayChatMessageUpdate(builder);
|
||||
DisplayChatMessageUpdate.addKey(builder, keyOffset);
|
||||
DisplayChatMessageUpdate.addCategory(builder, categoryOffset);
|
||||
DisplayChatMessageUpdate.addTarget(builder, targetOffset);
|
||||
DisplayChatMessageUpdate.addPlayerId(builder, playerId);
|
||||
DisplayChatMessageUpdate.addIsFrom(builder, isFrom);
|
||||
DisplayChatMessageUpdate.addRecipient(builder, recipientOffset);
|
||||
return DisplayChatMessageUpdate.endDisplayChatMessageUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):DisplayChatMessageUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsDisplayChatMessageUpdate(bb:flatbuffers.ByteBuffer, obj?:DisplayChatMessageUpdate):DisplayChatMessageUpdate {
|
||||
return (obj || new DisplayChatMessageUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsDisplayChatMessageUpdate(bb:flatbuffers.ByteBuffer, obj?:DisplayChatMessageUpdate):DisplayChatMessageUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new DisplayChatMessageUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
key():string|null
|
||||
key(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
key(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
category():string|null
|
||||
category(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
category(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
target():string|null
|
||||
target(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
target(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
playerId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
|
||||
}
|
||||
|
||||
isFrom():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
recipient():string|null
|
||||
recipient(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
recipient(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 14);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
static startDisplayChatMessageUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(6);
|
||||
}
|
||||
|
||||
static addKey(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, keyOffset, 0);
|
||||
}
|
||||
|
||||
static addCategory(builder:flatbuffers.Builder, categoryOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(1, categoryOffset, 0);
|
||||
}
|
||||
|
||||
static addTarget(builder:flatbuffers.Builder, targetOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(2, targetOffset, 0);
|
||||
}
|
||||
|
||||
static addPlayerId(builder:flatbuffers.Builder, playerId:number) {
|
||||
builder.addFieldInt32(3, playerId, -1);
|
||||
}
|
||||
|
||||
static addIsFrom(builder:flatbuffers.Builder, isFrom:boolean) {
|
||||
builder.addFieldInt8(4, +isFrom, +false);
|
||||
}
|
||||
|
||||
static addRecipient(builder:flatbuffers.Builder, recipientOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(5, recipientOffset, 0);
|
||||
}
|
||||
|
||||
static endDisplayChatMessageUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createDisplayChatMessageUpdate(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset, categoryOffset:flatbuffers.Offset, targetOffset:flatbuffers.Offset, playerId:number, isFrom:boolean, recipientOffset:flatbuffers.Offset):flatbuffers.Offset {
|
||||
DisplayChatMessageUpdate.startDisplayChatMessageUpdate(builder);
|
||||
DisplayChatMessageUpdate.addKey(builder, keyOffset);
|
||||
DisplayChatMessageUpdate.addCategory(builder, categoryOffset);
|
||||
DisplayChatMessageUpdate.addTarget(builder, targetOffset);
|
||||
DisplayChatMessageUpdate.addPlayerId(builder, playerId);
|
||||
DisplayChatMessageUpdate.addIsFrom(builder, isFrom);
|
||||
DisplayChatMessageUpdate.addRecipient(builder, recipientOffset);
|
||||
return DisplayChatMessageUpdate.endDisplayChatMessageUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): DisplayChatMessageUpdateT {
|
||||
return new DisplayChatMessageUpdateT(
|
||||
this.key(),
|
||||
this.category(),
|
||||
this.target(),
|
||||
this.playerId(),
|
||||
this.isFrom(),
|
||||
this.recipient()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: DisplayChatMessageUpdateT): void {
|
||||
_o.key = this.key();
|
||||
_o.category = this.category();
|
||||
_o.target = this.target();
|
||||
_o.playerId = this.playerId();
|
||||
_o.isFrom = this.isFrom();
|
||||
_o.recipient = this.recipient();
|
||||
}
|
||||
}
|
||||
|
||||
export class DisplayChatMessageUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public key: string|Uint8Array|null = null,
|
||||
public category: string|Uint8Array|null = null,
|
||||
public target: string|Uint8Array|null = null,
|
||||
public playerId: number = -1,
|
||||
public isFrom: boolean = false,
|
||||
public recipient: string|Uint8Array|null = null
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const key = (this.key !== null ? builder.createString(this.key!) : 0);
|
||||
const category = (this.category !== null ? builder.createString(this.category!) : 0);
|
||||
const target = (this.target !== null ? builder.createString(this.target!) : 0);
|
||||
const recipient = (this.recipient !== null ? builder.createString(this.recipient!) : 0);
|
||||
|
||||
return DisplayChatMessageUpdate.createDisplayChatMessageUpdate(builder,
|
||||
key,
|
||||
category,
|
||||
target,
|
||||
this.playerId,
|
||||
this.isFrom,
|
||||
recipient
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,206 +2,190 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { MessageType } from "../game-updates/message-type.js";
|
||||
|
||||
export class DisplayMessageUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
export class DisplayMessageUpdate implements flatbuffers.IUnpackableObject<DisplayMessageUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): DisplayMessageUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsDisplayMessageUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: DisplayMessageUpdate,
|
||||
): DisplayMessageUpdate {
|
||||
return (obj || new DisplayMessageUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsDisplayMessageUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: DisplayMessageUpdate,
|
||||
): DisplayMessageUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new DisplayMessageUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
message(): string | null;
|
||||
message(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
message(optionalEncoding?: any): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset
|
||||
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
||||
: null;
|
||||
}
|
||||
|
||||
messageType(): MessageType {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt8(this.bb_pos + offset) : MessageType.Info;
|
||||
}
|
||||
|
||||
goldAmount(): bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt("0");
|
||||
}
|
||||
|
||||
playerId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
|
||||
}
|
||||
|
||||
paramsKeys(index: number): string;
|
||||
paramsKeys(
|
||||
index: number,
|
||||
optionalEncoding: flatbuffers.Encoding,
|
||||
): string | Uint8Array;
|
||||
paramsKeys(
|
||||
index: number,
|
||||
optionalEncoding?: any,
|
||||
): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset
|
||||
? this.bb!.__string(
|
||||
this.bb!.__vector(this.bb_pos + offset) + index * 4,
|
||||
optionalEncoding,
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
||||
paramsKeysLength(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
paramsValues(index: number): string;
|
||||
paramsValues(
|
||||
index: number,
|
||||
optionalEncoding: flatbuffers.Encoding,
|
||||
): string | Uint8Array;
|
||||
paramsValues(
|
||||
index: number,
|
||||
optionalEncoding?: any,
|
||||
): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 14);
|
||||
return offset
|
||||
? this.bb!.__string(
|
||||
this.bb!.__vector(this.bb_pos + offset) + index * 4,
|
||||
optionalEncoding,
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
||||
paramsValuesLength(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 14);
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startDisplayMessageUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(6);
|
||||
}
|
||||
|
||||
static addMessage(
|
||||
builder: flatbuffers.Builder,
|
||||
messageOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(0, messageOffset, 0);
|
||||
}
|
||||
|
||||
static addMessageType(
|
||||
builder: flatbuffers.Builder,
|
||||
messageType: MessageType,
|
||||
) {
|
||||
builder.addFieldInt8(1, messageType, MessageType.Info);
|
||||
}
|
||||
|
||||
static addGoldAmount(builder: flatbuffers.Builder, goldAmount: bigint) {
|
||||
builder.addFieldInt64(2, goldAmount, BigInt("0"));
|
||||
}
|
||||
|
||||
static addPlayerId(builder: flatbuffers.Builder, playerId: number) {
|
||||
builder.addFieldInt32(3, playerId, -1);
|
||||
}
|
||||
|
||||
static addParamsKeys(
|
||||
builder: flatbuffers.Builder,
|
||||
paramsKeysOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(4, paramsKeysOffset, 0);
|
||||
}
|
||||
|
||||
static createParamsKeysVector(
|
||||
builder: flatbuffers.Builder,
|
||||
data: flatbuffers.Offset[],
|
||||
): flatbuffers.Offset {
|
||||
builder.startVector(4, data.length, 4);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addOffset(data[i]!);
|
||||
}
|
||||
return builder.endVector();
|
||||
}
|
||||
|
||||
static startParamsKeysVector(builder: flatbuffers.Builder, numElems: number) {
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
|
||||
static addParamsValues(
|
||||
builder: flatbuffers.Builder,
|
||||
paramsValuesOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(5, paramsValuesOffset, 0);
|
||||
}
|
||||
|
||||
static createParamsValuesVector(
|
||||
builder: flatbuffers.Builder,
|
||||
data: flatbuffers.Offset[],
|
||||
): flatbuffers.Offset {
|
||||
builder.startVector(4, data.length, 4);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addOffset(data[i]!);
|
||||
}
|
||||
return builder.endVector();
|
||||
}
|
||||
|
||||
static startParamsValuesVector(
|
||||
builder: flatbuffers.Builder,
|
||||
numElems: number,
|
||||
) {
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
|
||||
static endDisplayMessageUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createDisplayMessageUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
messageOffset: flatbuffers.Offset,
|
||||
messageType: MessageType,
|
||||
goldAmount: bigint,
|
||||
playerId: number,
|
||||
paramsKeysOffset: flatbuffers.Offset,
|
||||
paramsValuesOffset: flatbuffers.Offset,
|
||||
): flatbuffers.Offset {
|
||||
DisplayMessageUpdate.startDisplayMessageUpdate(builder);
|
||||
DisplayMessageUpdate.addMessage(builder, messageOffset);
|
||||
DisplayMessageUpdate.addMessageType(builder, messageType);
|
||||
DisplayMessageUpdate.addGoldAmount(builder, goldAmount);
|
||||
DisplayMessageUpdate.addPlayerId(builder, playerId);
|
||||
DisplayMessageUpdate.addParamsKeys(builder, paramsKeysOffset);
|
||||
DisplayMessageUpdate.addParamsValues(builder, paramsValuesOffset);
|
||||
return DisplayMessageUpdate.endDisplayMessageUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):DisplayMessageUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsDisplayMessageUpdate(bb:flatbuffers.ByteBuffer, obj?:DisplayMessageUpdate):DisplayMessageUpdate {
|
||||
return (obj || new DisplayMessageUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsDisplayMessageUpdate(bb:flatbuffers.ByteBuffer, obj?:DisplayMessageUpdate):DisplayMessageUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new DisplayMessageUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
message():string|null
|
||||
message(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
message(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
messageType():string|null
|
||||
messageType(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
messageType(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
goldAmount():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
playerId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
|
||||
}
|
||||
|
||||
paramsKeys(index: number):string
|
||||
paramsKeys(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
|
||||
paramsKeys(index: number,optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
paramsKeysLength():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
paramsValues(index: number):string
|
||||
paramsValues(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
|
||||
paramsValues(index: number,optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 14);
|
||||
return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
paramsValuesLength():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 14);
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startDisplayMessageUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(6);
|
||||
}
|
||||
|
||||
static addMessage(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, messageOffset, 0);
|
||||
}
|
||||
|
||||
static addMessageType(builder:flatbuffers.Builder, messageTypeOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(1, messageTypeOffset, 0);
|
||||
}
|
||||
|
||||
static addGoldAmount(builder:flatbuffers.Builder, goldAmount:bigint) {
|
||||
builder.addFieldInt64(2, goldAmount, BigInt('0'));
|
||||
}
|
||||
|
||||
static addPlayerId(builder:flatbuffers.Builder, playerId:number) {
|
||||
builder.addFieldInt32(3, playerId, -1);
|
||||
}
|
||||
|
||||
static addParamsKeys(builder:flatbuffers.Builder, paramsKeysOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(4, paramsKeysOffset, 0);
|
||||
}
|
||||
|
||||
static createParamsKeysVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
|
||||
builder.startVector(4, data.length, 4);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addOffset(data[i]!);
|
||||
}
|
||||
return builder.endVector();
|
||||
}
|
||||
|
||||
static startParamsKeysVector(builder:flatbuffers.Builder, numElems:number) {
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
|
||||
static addParamsValues(builder:flatbuffers.Builder, paramsValuesOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(5, paramsValuesOffset, 0);
|
||||
}
|
||||
|
||||
static createParamsValuesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
|
||||
builder.startVector(4, data.length, 4);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addOffset(data[i]!);
|
||||
}
|
||||
return builder.endVector();
|
||||
}
|
||||
|
||||
static startParamsValuesVector(builder:flatbuffers.Builder, numElems:number) {
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
|
||||
static endDisplayMessageUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createDisplayMessageUpdate(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset, messageTypeOffset:flatbuffers.Offset, goldAmount:bigint, playerId:number, paramsKeysOffset:flatbuffers.Offset, paramsValuesOffset:flatbuffers.Offset):flatbuffers.Offset {
|
||||
DisplayMessageUpdate.startDisplayMessageUpdate(builder);
|
||||
DisplayMessageUpdate.addMessage(builder, messageOffset);
|
||||
DisplayMessageUpdate.addMessageType(builder, messageTypeOffset);
|
||||
DisplayMessageUpdate.addGoldAmount(builder, goldAmount);
|
||||
DisplayMessageUpdate.addPlayerId(builder, playerId);
|
||||
DisplayMessageUpdate.addParamsKeys(builder, paramsKeysOffset);
|
||||
DisplayMessageUpdate.addParamsValues(builder, paramsValuesOffset);
|
||||
return DisplayMessageUpdate.endDisplayMessageUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): DisplayMessageUpdateT {
|
||||
return new DisplayMessageUpdateT(
|
||||
this.message(),
|
||||
this.messageType(),
|
||||
this.goldAmount(),
|
||||
this.playerId(),
|
||||
this.bb!.createScalarList<string>(this.paramsKeys.bind(this), this.paramsKeysLength()),
|
||||
this.bb!.createScalarList<string>(this.paramsValues.bind(this), this.paramsValuesLength())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: DisplayMessageUpdateT): void {
|
||||
_o.message = this.message();
|
||||
_o.messageType = this.messageType();
|
||||
_o.goldAmount = this.goldAmount();
|
||||
_o.playerId = this.playerId();
|
||||
_o.paramsKeys = this.bb!.createScalarList<string>(this.paramsKeys.bind(this), this.paramsKeysLength());
|
||||
_o.paramsValues = this.bb!.createScalarList<string>(this.paramsValues.bind(this), this.paramsValuesLength());
|
||||
}
|
||||
}
|
||||
|
||||
export class DisplayMessageUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public message: string|Uint8Array|null = null,
|
||||
public messageType: string|Uint8Array|null = null,
|
||||
public goldAmount: bigint = BigInt('0'),
|
||||
public playerId: number = -1,
|
||||
public paramsKeys: (string)[] = [],
|
||||
public paramsValues: (string)[] = []
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const message = (this.message !== null ? builder.createString(this.message!) : 0);
|
||||
const messageType = (this.messageType !== null ? builder.createString(this.messageType!) : 0);
|
||||
const paramsKeys = DisplayMessageUpdate.createParamsKeysVector(builder, builder.createObjectOffsetList(this.paramsKeys));
|
||||
const paramsValues = DisplayMessageUpdate.createParamsValuesVector(builder, builder.createObjectOffsetList(this.paramsValues));
|
||||
|
||||
return DisplayMessageUpdate.createDisplayMessageUpdate(builder,
|
||||
message,
|
||||
messageType,
|
||||
this.goldAmount,
|
||||
this.playerId,
|
||||
paramsKeys,
|
||||
paramsValues
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,91 +2,105 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class EmbargoUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
|
||||
export class EmbargoUpdate implements flatbuffers.IUnpackableObject<EmbargoUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): EmbargoUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsEmbargoUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: EmbargoUpdate,
|
||||
): EmbargoUpdate {
|
||||
return (obj || new EmbargoUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsEmbargoUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: EmbargoUpdate,
|
||||
): EmbargoUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new EmbargoUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
event(): string | null;
|
||||
event(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
event(optionalEncoding?: any): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset
|
||||
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
||||
: null;
|
||||
}
|
||||
|
||||
playerId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
embargoedId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startEmbargoUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(3);
|
||||
}
|
||||
|
||||
static addEvent(
|
||||
builder: flatbuffers.Builder,
|
||||
eventOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(0, eventOffset, 0);
|
||||
}
|
||||
|
||||
static addPlayerId(builder: flatbuffers.Builder, playerId: number) {
|
||||
builder.addFieldInt32(1, playerId, 0);
|
||||
}
|
||||
|
||||
static addEmbargoedId(builder: flatbuffers.Builder, embargoedId: number) {
|
||||
builder.addFieldInt32(2, embargoedId, 0);
|
||||
}
|
||||
|
||||
static endEmbargoUpdate(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createEmbargoUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
eventOffset: flatbuffers.Offset,
|
||||
playerId: number,
|
||||
embargoedId: number,
|
||||
): flatbuffers.Offset {
|
||||
EmbargoUpdate.startEmbargoUpdate(builder);
|
||||
EmbargoUpdate.addEvent(builder, eventOffset);
|
||||
EmbargoUpdate.addPlayerId(builder, playerId);
|
||||
EmbargoUpdate.addEmbargoedId(builder, embargoedId);
|
||||
return EmbargoUpdate.endEmbargoUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):EmbargoUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsEmbargoUpdate(bb:flatbuffers.ByteBuffer, obj?:EmbargoUpdate):EmbargoUpdate {
|
||||
return (obj || new EmbargoUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsEmbargoUpdate(bb:flatbuffers.ByteBuffer, obj?:EmbargoUpdate):EmbargoUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new EmbargoUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
event():string|null
|
||||
event(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
event(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
playerId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
embargoedId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startEmbargoUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(3);
|
||||
}
|
||||
|
||||
static addEvent(builder:flatbuffers.Builder, eventOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, eventOffset, 0);
|
||||
}
|
||||
|
||||
static addPlayerId(builder:flatbuffers.Builder, playerId:number) {
|
||||
builder.addFieldInt32(1, playerId, 0);
|
||||
}
|
||||
|
||||
static addEmbargoedId(builder:flatbuffers.Builder, embargoedId:number) {
|
||||
builder.addFieldInt32(2, embargoedId, 0);
|
||||
}
|
||||
|
||||
static endEmbargoUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createEmbargoUpdate(builder:flatbuffers.Builder, eventOffset:flatbuffers.Offset, playerId:number, embargoedId:number):flatbuffers.Offset {
|
||||
EmbargoUpdate.startEmbargoUpdate(builder);
|
||||
EmbargoUpdate.addEvent(builder, eventOffset);
|
||||
EmbargoUpdate.addPlayerId(builder, playerId);
|
||||
EmbargoUpdate.addEmbargoedId(builder, embargoedId);
|
||||
return EmbargoUpdate.endEmbargoUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): EmbargoUpdateT {
|
||||
return new EmbargoUpdateT(
|
||||
this.event(),
|
||||
this.playerId(),
|
||||
this.embargoedId()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: EmbargoUpdateT): void {
|
||||
_o.event = this.event();
|
||||
_o.playerId = this.playerId();
|
||||
_o.embargoedId = this.embargoedId();
|
||||
}
|
||||
}
|
||||
|
||||
export class EmbargoUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public event: string|Uint8Array|null = null,
|
||||
public playerId: number = 0,
|
||||
public embargoedId: number = 0
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const event = (this.event !== null ? builder.createString(this.event!) : 0);
|
||||
|
||||
return EmbargoUpdate.createEmbargoUpdate(builder,
|
||||
event,
|
||||
this.playerId,
|
||||
this.embargoedId
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,105 +2,119 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class EmojiMessage {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
|
||||
export class EmojiMessage implements flatbuffers.IUnpackableObject<EmojiMessageT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): EmojiMessage {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsEmojiMessage(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: EmojiMessage,
|
||||
): EmojiMessage {
|
||||
return (obj || new EmojiMessage()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsEmojiMessage(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: EmojiMessage,
|
||||
): EmojiMessage {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new EmojiMessage()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
playerId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
emoji(): string | null;
|
||||
emoji(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
emoji(optionalEncoding?: any): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset
|
||||
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
||||
: null;
|
||||
}
|
||||
|
||||
targetPlayerId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
|
||||
}
|
||||
|
||||
tick(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startEmojiMessage(builder: flatbuffers.Builder) {
|
||||
builder.startObject(4);
|
||||
}
|
||||
|
||||
static addPlayerId(builder: flatbuffers.Builder, playerId: number) {
|
||||
builder.addFieldInt32(0, playerId, 0);
|
||||
}
|
||||
|
||||
static addEmoji(
|
||||
builder: flatbuffers.Builder,
|
||||
emojiOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(1, emojiOffset, 0);
|
||||
}
|
||||
|
||||
static addTargetPlayerId(
|
||||
builder: flatbuffers.Builder,
|
||||
targetPlayerId: number,
|
||||
) {
|
||||
builder.addFieldInt32(2, targetPlayerId, -1);
|
||||
}
|
||||
|
||||
static addTick(builder: flatbuffers.Builder, tick: number) {
|
||||
builder.addFieldInt32(3, tick, 0);
|
||||
}
|
||||
|
||||
static endEmojiMessage(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createEmojiMessage(
|
||||
builder: flatbuffers.Builder,
|
||||
playerId: number,
|
||||
emojiOffset: flatbuffers.Offset,
|
||||
targetPlayerId: number,
|
||||
tick: number,
|
||||
): flatbuffers.Offset {
|
||||
EmojiMessage.startEmojiMessage(builder);
|
||||
EmojiMessage.addPlayerId(builder, playerId);
|
||||
EmojiMessage.addEmoji(builder, emojiOffset);
|
||||
EmojiMessage.addTargetPlayerId(builder, targetPlayerId);
|
||||
EmojiMessage.addTick(builder, tick);
|
||||
return EmojiMessage.endEmojiMessage(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):EmojiMessage {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsEmojiMessage(bb:flatbuffers.ByteBuffer, obj?:EmojiMessage):EmojiMessage {
|
||||
return (obj || new EmojiMessage()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsEmojiMessage(bb:flatbuffers.ByteBuffer, obj?:EmojiMessage):EmojiMessage {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new EmojiMessage()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
playerId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
emoji():string|null
|
||||
emoji(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
emoji(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
targetPlayerId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
|
||||
}
|
||||
|
||||
tick():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startEmojiMessage(builder:flatbuffers.Builder) {
|
||||
builder.startObject(4);
|
||||
}
|
||||
|
||||
static addPlayerId(builder:flatbuffers.Builder, playerId:number) {
|
||||
builder.addFieldInt32(0, playerId, 0);
|
||||
}
|
||||
|
||||
static addEmoji(builder:flatbuffers.Builder, emojiOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(1, emojiOffset, 0);
|
||||
}
|
||||
|
||||
static addTargetPlayerId(builder:flatbuffers.Builder, targetPlayerId:number) {
|
||||
builder.addFieldInt32(2, targetPlayerId, -1);
|
||||
}
|
||||
|
||||
static addTick(builder:flatbuffers.Builder, tick:number) {
|
||||
builder.addFieldInt32(3, tick, 0);
|
||||
}
|
||||
|
||||
static endEmojiMessage(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createEmojiMessage(builder:flatbuffers.Builder, playerId:number, emojiOffset:flatbuffers.Offset, targetPlayerId:number, tick:number):flatbuffers.Offset {
|
||||
EmojiMessage.startEmojiMessage(builder);
|
||||
EmojiMessage.addPlayerId(builder, playerId);
|
||||
EmojiMessage.addEmoji(builder, emojiOffset);
|
||||
EmojiMessage.addTargetPlayerId(builder, targetPlayerId);
|
||||
EmojiMessage.addTick(builder, tick);
|
||||
return EmojiMessage.endEmojiMessage(builder);
|
||||
}
|
||||
|
||||
unpack(): EmojiMessageT {
|
||||
return new EmojiMessageT(
|
||||
this.playerId(),
|
||||
this.emoji(),
|
||||
this.targetPlayerId(),
|
||||
this.tick()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: EmojiMessageT): void {
|
||||
_o.playerId = this.playerId();
|
||||
_o.emoji = this.emoji();
|
||||
_o.targetPlayerId = this.targetPlayerId();
|
||||
_o.tick = this.tick();
|
||||
}
|
||||
}
|
||||
|
||||
export class EmojiMessageT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public playerId: number = 0,
|
||||
public emoji: string|Uint8Array|null = null,
|
||||
public targetPlayerId: number = -1,
|
||||
public tick: number = 0
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const emoji = (this.emoji !== null ? builder.createString(this.emoji!) : 0);
|
||||
|
||||
return EmojiMessage.createEmojiMessage(builder,
|
||||
this.playerId,
|
||||
emoji,
|
||||
this.targetPlayerId,
|
||||
this.tick
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,72 +2,76 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { EmojiMessage } from "../game-updates/emoji-message.js";
|
||||
import { EmojiMessage, EmojiMessageT } from '../game-updates/emoji-message.js';
|
||||
|
||||
export class EmojiUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
export class EmojiUpdate implements flatbuffers.IUnpackableObject<EmojiUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): EmojiUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsEmojiUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: EmojiUpdate,
|
||||
): EmojiUpdate {
|
||||
return (obj || new EmojiUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsEmojiUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: EmojiUpdate,
|
||||
): EmojiUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new EmojiUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
emoji(obj?: EmojiMessage): EmojiMessage | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset
|
||||
? (obj || new EmojiMessage()).__init(
|
||||
this.bb!.__indirect(this.bb_pos + offset),
|
||||
this.bb!,
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
||||
static startEmojiUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(1);
|
||||
}
|
||||
|
||||
static addEmoji(
|
||||
builder: flatbuffers.Builder,
|
||||
emojiOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(0, emojiOffset, 0);
|
||||
}
|
||||
|
||||
static endEmojiUpdate(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createEmojiUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
emojiOffset: flatbuffers.Offset,
|
||||
): flatbuffers.Offset {
|
||||
EmojiUpdate.startEmojiUpdate(builder);
|
||||
EmojiUpdate.addEmoji(builder, emojiOffset);
|
||||
return EmojiUpdate.endEmojiUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):EmojiUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsEmojiUpdate(bb:flatbuffers.ByteBuffer, obj?:EmojiUpdate):EmojiUpdate {
|
||||
return (obj || new EmojiUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsEmojiUpdate(bb:flatbuffers.ByteBuffer, obj?:EmojiUpdate):EmojiUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new EmojiUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
emoji(obj?:EmojiMessage):EmojiMessage|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? (obj || new EmojiMessage()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
|
||||
}
|
||||
|
||||
static startEmojiUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(1);
|
||||
}
|
||||
|
||||
static addEmoji(builder:flatbuffers.Builder, emojiOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, emojiOffset, 0);
|
||||
}
|
||||
|
||||
static endEmojiUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createEmojiUpdate(builder:flatbuffers.Builder, emojiOffset:flatbuffers.Offset):flatbuffers.Offset {
|
||||
EmojiUpdate.startEmojiUpdate(builder);
|
||||
EmojiUpdate.addEmoji(builder, emojiOffset);
|
||||
return EmojiUpdate.endEmojiUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): EmojiUpdateT {
|
||||
return new EmojiUpdateT(
|
||||
(this.emoji() !== null ? this.emoji()!.unpack() : null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: EmojiUpdateT): void {
|
||||
_o.emoji = (this.emoji() !== null ? this.emoji()!.unpack() : null);
|
||||
}
|
||||
}
|
||||
|
||||
export class EmojiUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public emoji: EmojiMessageT|null = null
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const emoji = (this.emoji !== null ? this.emoji!.pack(builder) : 0);
|
||||
|
||||
return EmojiUpdate.createEmojiUpdate(builder,
|
||||
emoji
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,87 +2,94 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class ErrorUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
|
||||
export class ErrorUpdate implements flatbuffers.IUnpackableObject<ErrorUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): ErrorUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsErrorUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: ErrorUpdate,
|
||||
): ErrorUpdate {
|
||||
return (obj || new ErrorUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsErrorUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: ErrorUpdate,
|
||||
): ErrorUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new ErrorUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
errMsg(): string | null;
|
||||
errMsg(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
errMsg(optionalEncoding?: any): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset
|
||||
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
||||
: null;
|
||||
}
|
||||
|
||||
stack(): string | null;
|
||||
stack(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
stack(optionalEncoding?: any): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset
|
||||
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
||||
: null;
|
||||
}
|
||||
|
||||
static startErrorUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addErrMsg(
|
||||
builder: flatbuffers.Builder,
|
||||
errMsgOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(0, errMsgOffset, 0);
|
||||
}
|
||||
|
||||
static addStack(
|
||||
builder: flatbuffers.Builder,
|
||||
stackOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(1, stackOffset, 0);
|
||||
}
|
||||
|
||||
static endErrorUpdate(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createErrorUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
errMsgOffset: flatbuffers.Offset,
|
||||
stackOffset: flatbuffers.Offset,
|
||||
): flatbuffers.Offset {
|
||||
ErrorUpdate.startErrorUpdate(builder);
|
||||
ErrorUpdate.addErrMsg(builder, errMsgOffset);
|
||||
ErrorUpdate.addStack(builder, stackOffset);
|
||||
return ErrorUpdate.endErrorUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):ErrorUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsErrorUpdate(bb:flatbuffers.ByteBuffer, obj?:ErrorUpdate):ErrorUpdate {
|
||||
return (obj || new ErrorUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsErrorUpdate(bb:flatbuffers.ByteBuffer, obj?:ErrorUpdate):ErrorUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new ErrorUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
errMsg():string|null
|
||||
errMsg(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
errMsg(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
stack():string|null
|
||||
stack(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
stack(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
static startErrorUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addErrMsg(builder:flatbuffers.Builder, errMsgOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, errMsgOffset, 0);
|
||||
}
|
||||
|
||||
static addStack(builder:flatbuffers.Builder, stackOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(1, stackOffset, 0);
|
||||
}
|
||||
|
||||
static endErrorUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createErrorUpdate(builder:flatbuffers.Builder, errMsgOffset:flatbuffers.Offset, stackOffset:flatbuffers.Offset):flatbuffers.Offset {
|
||||
ErrorUpdate.startErrorUpdate(builder);
|
||||
ErrorUpdate.addErrMsg(builder, errMsgOffset);
|
||||
ErrorUpdate.addStack(builder, stackOffset);
|
||||
return ErrorUpdate.endErrorUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): ErrorUpdateT {
|
||||
return new ErrorUpdateT(
|
||||
this.errMsg(),
|
||||
this.stack()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: ErrorUpdateT): void {
|
||||
_o.errMsg = this.errMsg();
|
||||
_o.stack = this.stack();
|
||||
}
|
||||
}
|
||||
|
||||
export class ErrorUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public errMsg: string|Uint8Array|null = null,
|
||||
public stack: string|Uint8Array|null = null
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const errMsg = (this.errMsg !== null ? builder.createString(this.errMsg!) : 0);
|
||||
const stack = (this.stack !== null ? builder.createString(this.stack!) : 0);
|
||||
|
||||
return ErrorUpdate.createErrorUpdate(builder,
|
||||
errMsg,
|
||||
stack
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,5 +21,5 @@ export enum GameUpdateType {
|
||||
BonusEvent = 15,
|
||||
RailroadEvent = 16,
|
||||
ConquestEvent = 17,
|
||||
EmbargoEvent = 18,
|
||||
EmbargoEvent = 18
|
||||
}
|
||||
|
||||
@@ -2,25 +2,26 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import { AllianceExpiredUpdate } from "../game-updates/alliance-expired-update.js";
|
||||
import { AllianceExtensionUpdate } from "../game-updates/alliance-extension-update.js";
|
||||
import { AllianceRequestReplyUpdate } from "../game-updates/alliance-request-reply-update.js";
|
||||
import { AllianceRequestUpdate } from "../game-updates/alliance-request-update.js";
|
||||
import { BonusEventUpdate } from "../game-updates/bonus-event-update.js";
|
||||
import { BrokeAllianceUpdate } from "../game-updates/broke-alliance-update.js";
|
||||
import { ConquestUpdate } from "../game-updates/conquest-update.js";
|
||||
import { DisplayChatMessageUpdate } from "../game-updates/display-chat-message-update.js";
|
||||
import { DisplayMessageUpdate } from "../game-updates/display-message-update.js";
|
||||
import { EmbargoUpdate } from "../game-updates/embargo-update.js";
|
||||
import { EmojiUpdate } from "../game-updates/emoji-update.js";
|
||||
import { HashUpdate } from "../game-updates/hash-update.js";
|
||||
import { PlayerUpdate } from "../game-updates/player-update.js";
|
||||
import { RailroadUpdate } from "../game-updates/railroad-update.js";
|
||||
import { TargetPlayerUpdate } from "../game-updates/target-player-update.js";
|
||||
import { TileUpdateWrapper } from "../game-updates/tile-update-wrapper.js";
|
||||
import { UnitIncomingUpdate } from "../game-updates/unit-incoming-update.js";
|
||||
import { UnitUpdate } from "../game-updates/unit-update.js";
|
||||
import { WinUpdate } from "../game-updates/win-update.js";
|
||||
import { AllianceExpiredUpdate, AllianceExpiredUpdateT } from '../game-updates/alliance-expired-update.js';
|
||||
import { AllianceExtensionUpdate, AllianceExtensionUpdateT } from '../game-updates/alliance-extension-update.js';
|
||||
import { AllianceRequestReplyUpdate, AllianceRequestReplyUpdateT } from '../game-updates/alliance-request-reply-update.js';
|
||||
import { AllianceRequestUpdate, AllianceRequestUpdateT } from '../game-updates/alliance-request-update.js';
|
||||
import { BonusEventUpdate, BonusEventUpdateT } from '../game-updates/bonus-event-update.js';
|
||||
import { BrokeAllianceUpdate, BrokeAllianceUpdateT } from '../game-updates/broke-alliance-update.js';
|
||||
import { ConquestUpdate, ConquestUpdateT } from '../game-updates/conquest-update.js';
|
||||
import { DisplayChatMessageUpdate, DisplayChatMessageUpdateT } from '../game-updates/display-chat-message-update.js';
|
||||
import { DisplayMessageUpdate, DisplayMessageUpdateT } from '../game-updates/display-message-update.js';
|
||||
import { EmbargoUpdate, EmbargoUpdateT } from '../game-updates/embargo-update.js';
|
||||
import { EmojiUpdate, EmojiUpdateT } from '../game-updates/emoji-update.js';
|
||||
import { HashUpdate, HashUpdateT } from '../game-updates/hash-update.js';
|
||||
import { PlayerUpdate, PlayerUpdateT } from '../game-updates/player-update.js';
|
||||
import { RailroadUpdate, RailroadUpdateT } from '../game-updates/railroad-update.js';
|
||||
import { TargetPlayerUpdate, TargetPlayerUpdateT } from '../game-updates/target-player-update.js';
|
||||
import { TileUpdateWrapper, TileUpdateWrapperT } from '../game-updates/tile-update-wrapper.js';
|
||||
import { UnitIncomingUpdate, UnitIncomingUpdateT } from '../game-updates/unit-incoming-update.js';
|
||||
import { UnitUpdate, UnitUpdateT } from '../game-updates/unit-update.js';
|
||||
import { WinUpdate, WinUpdateT } from '../game-updates/win-update.js';
|
||||
|
||||
|
||||
export enum GameUpdateUnion {
|
||||
NONE = 0,
|
||||
@@ -42,253 +43,64 @@ export enum GameUpdateUnion {
|
||||
BonusEventUpdate = 16,
|
||||
RailroadUpdate = 17,
|
||||
ConquestUpdate = 18,
|
||||
EmbargoUpdate = 19,
|
||||
EmbargoUpdate = 19
|
||||
}
|
||||
|
||||
export function unionToGameUpdateUnion(
|
||||
type: GameUpdateUnion,
|
||||
accessor: (
|
||||
obj:
|
||||
| AllianceExpiredUpdate
|
||||
| AllianceExtensionUpdate
|
||||
| AllianceRequestReplyUpdate
|
||||
| AllianceRequestUpdate
|
||||
| BonusEventUpdate
|
||||
| BrokeAllianceUpdate
|
||||
| ConquestUpdate
|
||||
| DisplayChatMessageUpdate
|
||||
| DisplayMessageUpdate
|
||||
| EmbargoUpdate
|
||||
| EmojiUpdate
|
||||
| HashUpdate
|
||||
| PlayerUpdate
|
||||
| RailroadUpdate
|
||||
| TargetPlayerUpdate
|
||||
| TileUpdateWrapper
|
||||
| UnitIncomingUpdate
|
||||
| UnitUpdate
|
||||
| WinUpdate,
|
||||
) =>
|
||||
| AllianceExpiredUpdate
|
||||
| AllianceExtensionUpdate
|
||||
| AllianceRequestReplyUpdate
|
||||
| AllianceRequestUpdate
|
||||
| BonusEventUpdate
|
||||
| BrokeAllianceUpdate
|
||||
| ConquestUpdate
|
||||
| DisplayChatMessageUpdate
|
||||
| DisplayMessageUpdate
|
||||
| EmbargoUpdate
|
||||
| EmojiUpdate
|
||||
| HashUpdate
|
||||
| PlayerUpdate
|
||||
| RailroadUpdate
|
||||
| TargetPlayerUpdate
|
||||
| TileUpdateWrapper
|
||||
| UnitIncomingUpdate
|
||||
| UnitUpdate
|
||||
| WinUpdate
|
||||
| null,
|
||||
):
|
||||
| AllianceExpiredUpdate
|
||||
| AllianceExtensionUpdate
|
||||
| AllianceRequestReplyUpdate
|
||||
| AllianceRequestUpdate
|
||||
| BonusEventUpdate
|
||||
| BrokeAllianceUpdate
|
||||
| ConquestUpdate
|
||||
| DisplayChatMessageUpdate
|
||||
| DisplayMessageUpdate
|
||||
| EmbargoUpdate
|
||||
| EmojiUpdate
|
||||
| HashUpdate
|
||||
| PlayerUpdate
|
||||
| RailroadUpdate
|
||||
| TargetPlayerUpdate
|
||||
| TileUpdateWrapper
|
||||
| UnitIncomingUpdate
|
||||
| UnitUpdate
|
||||
| WinUpdate
|
||||
| null {
|
||||
switch (GameUpdateUnion[type]) {
|
||||
case "NONE":
|
||||
return null;
|
||||
case "TileUpdateWrapper":
|
||||
return accessor(new TileUpdateWrapper())! as TileUpdateWrapper;
|
||||
case "UnitUpdate":
|
||||
return accessor(new UnitUpdate())! as UnitUpdate;
|
||||
case "PlayerUpdate":
|
||||
return accessor(new PlayerUpdate())! as PlayerUpdate;
|
||||
case "AllianceRequestUpdate":
|
||||
return accessor(new AllianceRequestUpdate())! as AllianceRequestUpdate;
|
||||
case "AllianceRequestReplyUpdate":
|
||||
return accessor(
|
||||
new AllianceRequestReplyUpdate(),
|
||||
)! as AllianceRequestReplyUpdate;
|
||||
case "BrokeAllianceUpdate":
|
||||
return accessor(new BrokeAllianceUpdate())! as BrokeAllianceUpdate;
|
||||
case "AllianceExpiredUpdate":
|
||||
return accessor(new AllianceExpiredUpdate())! as AllianceExpiredUpdate;
|
||||
case "DisplayMessageUpdate":
|
||||
return accessor(new DisplayMessageUpdate())! as DisplayMessageUpdate;
|
||||
case "DisplayChatMessageUpdate":
|
||||
return accessor(
|
||||
new DisplayChatMessageUpdate(),
|
||||
)! as DisplayChatMessageUpdate;
|
||||
case "TargetPlayerUpdate":
|
||||
return accessor(new TargetPlayerUpdate())! as TargetPlayerUpdate;
|
||||
case "EmojiUpdate":
|
||||
return accessor(new EmojiUpdate())! as EmojiUpdate;
|
||||
case "WinUpdate":
|
||||
return accessor(new WinUpdate())! as WinUpdate;
|
||||
case "HashUpdate":
|
||||
return accessor(new HashUpdate())! as HashUpdate;
|
||||
case "UnitIncomingUpdate":
|
||||
return accessor(new UnitIncomingUpdate())! as UnitIncomingUpdate;
|
||||
case "AllianceExtensionUpdate":
|
||||
return accessor(
|
||||
new AllianceExtensionUpdate(),
|
||||
)! as AllianceExtensionUpdate;
|
||||
case "BonusEventUpdate":
|
||||
return accessor(new BonusEventUpdate())! as BonusEventUpdate;
|
||||
case "RailroadUpdate":
|
||||
return accessor(new RailroadUpdate())! as RailroadUpdate;
|
||||
case "ConquestUpdate":
|
||||
return accessor(new ConquestUpdate())! as ConquestUpdate;
|
||||
case "EmbargoUpdate":
|
||||
return accessor(new EmbargoUpdate())! as EmbargoUpdate;
|
||||
default:
|
||||
return null;
|
||||
accessor: (obj:AllianceExpiredUpdate|AllianceExtensionUpdate|AllianceRequestReplyUpdate|AllianceRequestUpdate|BonusEventUpdate|BrokeAllianceUpdate|ConquestUpdate|DisplayChatMessageUpdate|DisplayMessageUpdate|EmbargoUpdate|EmojiUpdate|HashUpdate|PlayerUpdate|RailroadUpdate|TargetPlayerUpdate|TileUpdateWrapper|UnitIncomingUpdate|UnitUpdate|WinUpdate) => AllianceExpiredUpdate|AllianceExtensionUpdate|AllianceRequestReplyUpdate|AllianceRequestUpdate|BonusEventUpdate|BrokeAllianceUpdate|ConquestUpdate|DisplayChatMessageUpdate|DisplayMessageUpdate|EmbargoUpdate|EmojiUpdate|HashUpdate|PlayerUpdate|RailroadUpdate|TargetPlayerUpdate|TileUpdateWrapper|UnitIncomingUpdate|UnitUpdate|WinUpdate|null
|
||||
): AllianceExpiredUpdate|AllianceExtensionUpdate|AllianceRequestReplyUpdate|AllianceRequestUpdate|BonusEventUpdate|BrokeAllianceUpdate|ConquestUpdate|DisplayChatMessageUpdate|DisplayMessageUpdate|EmbargoUpdate|EmojiUpdate|HashUpdate|PlayerUpdate|RailroadUpdate|TargetPlayerUpdate|TileUpdateWrapper|UnitIncomingUpdate|UnitUpdate|WinUpdate|null {
|
||||
switch(GameUpdateUnion[type]) {
|
||||
case 'NONE': return null;
|
||||
case 'TileUpdateWrapper': return accessor(new TileUpdateWrapper())! as TileUpdateWrapper;
|
||||
case 'UnitUpdate': return accessor(new UnitUpdate())! as UnitUpdate;
|
||||
case 'PlayerUpdate': return accessor(new PlayerUpdate())! as PlayerUpdate;
|
||||
case 'AllianceRequestUpdate': return accessor(new AllianceRequestUpdate())! as AllianceRequestUpdate;
|
||||
case 'AllianceRequestReplyUpdate': return accessor(new AllianceRequestReplyUpdate())! as AllianceRequestReplyUpdate;
|
||||
case 'BrokeAllianceUpdate': return accessor(new BrokeAllianceUpdate())! as BrokeAllianceUpdate;
|
||||
case 'AllianceExpiredUpdate': return accessor(new AllianceExpiredUpdate())! as AllianceExpiredUpdate;
|
||||
case 'DisplayMessageUpdate': return accessor(new DisplayMessageUpdate())! as DisplayMessageUpdate;
|
||||
case 'DisplayChatMessageUpdate': return accessor(new DisplayChatMessageUpdate())! as DisplayChatMessageUpdate;
|
||||
case 'TargetPlayerUpdate': return accessor(new TargetPlayerUpdate())! as TargetPlayerUpdate;
|
||||
case 'EmojiUpdate': return accessor(new EmojiUpdate())! as EmojiUpdate;
|
||||
case 'WinUpdate': return accessor(new WinUpdate())! as WinUpdate;
|
||||
case 'HashUpdate': return accessor(new HashUpdate())! as HashUpdate;
|
||||
case 'UnitIncomingUpdate': return accessor(new UnitIncomingUpdate())! as UnitIncomingUpdate;
|
||||
case 'AllianceExtensionUpdate': return accessor(new AllianceExtensionUpdate())! as AllianceExtensionUpdate;
|
||||
case 'BonusEventUpdate': return accessor(new BonusEventUpdate())! as BonusEventUpdate;
|
||||
case 'RailroadUpdate': return accessor(new RailroadUpdate())! as RailroadUpdate;
|
||||
case 'ConquestUpdate': return accessor(new ConquestUpdate())! as ConquestUpdate;
|
||||
case 'EmbargoUpdate': return accessor(new EmbargoUpdate())! as EmbargoUpdate;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function unionListToGameUpdateUnion(
|
||||
type: GameUpdateUnion,
|
||||
accessor: (
|
||||
index: number,
|
||||
obj:
|
||||
| AllianceExpiredUpdate
|
||||
| AllianceExtensionUpdate
|
||||
| AllianceRequestReplyUpdate
|
||||
| AllianceRequestUpdate
|
||||
| BonusEventUpdate
|
||||
| BrokeAllianceUpdate
|
||||
| ConquestUpdate
|
||||
| DisplayChatMessageUpdate
|
||||
| DisplayMessageUpdate
|
||||
| EmbargoUpdate
|
||||
| EmojiUpdate
|
||||
| HashUpdate
|
||||
| PlayerUpdate
|
||||
| RailroadUpdate
|
||||
| TargetPlayerUpdate
|
||||
| TileUpdateWrapper
|
||||
| UnitIncomingUpdate
|
||||
| UnitUpdate
|
||||
| WinUpdate,
|
||||
) =>
|
||||
| AllianceExpiredUpdate
|
||||
| AllianceExtensionUpdate
|
||||
| AllianceRequestReplyUpdate
|
||||
| AllianceRequestUpdate
|
||||
| BonusEventUpdate
|
||||
| BrokeAllianceUpdate
|
||||
| ConquestUpdate
|
||||
| DisplayChatMessageUpdate
|
||||
| DisplayMessageUpdate
|
||||
| EmbargoUpdate
|
||||
| EmojiUpdate
|
||||
| HashUpdate
|
||||
| PlayerUpdate
|
||||
| RailroadUpdate
|
||||
| TargetPlayerUpdate
|
||||
| TileUpdateWrapper
|
||||
| UnitIncomingUpdate
|
||||
| UnitUpdate
|
||||
| WinUpdate
|
||||
| null,
|
||||
index: number,
|
||||
):
|
||||
| AllianceExpiredUpdate
|
||||
| AllianceExtensionUpdate
|
||||
| AllianceRequestReplyUpdate
|
||||
| AllianceRequestUpdate
|
||||
| BonusEventUpdate
|
||||
| BrokeAllianceUpdate
|
||||
| ConquestUpdate
|
||||
| DisplayChatMessageUpdate
|
||||
| DisplayMessageUpdate
|
||||
| EmbargoUpdate
|
||||
| EmojiUpdate
|
||||
| HashUpdate
|
||||
| PlayerUpdate
|
||||
| RailroadUpdate
|
||||
| TargetPlayerUpdate
|
||||
| TileUpdateWrapper
|
||||
| UnitIncomingUpdate
|
||||
| UnitUpdate
|
||||
| WinUpdate
|
||||
| null {
|
||||
switch (GameUpdateUnion[type]) {
|
||||
case "NONE":
|
||||
return null;
|
||||
case "TileUpdateWrapper":
|
||||
return accessor(index, new TileUpdateWrapper())! as TileUpdateWrapper;
|
||||
case "UnitUpdate":
|
||||
return accessor(index, new UnitUpdate())! as UnitUpdate;
|
||||
case "PlayerUpdate":
|
||||
return accessor(index, new PlayerUpdate())! as PlayerUpdate;
|
||||
case "AllianceRequestUpdate":
|
||||
return accessor(
|
||||
index,
|
||||
new AllianceRequestUpdate(),
|
||||
)! as AllianceRequestUpdate;
|
||||
case "AllianceRequestReplyUpdate":
|
||||
return accessor(
|
||||
index,
|
||||
new AllianceRequestReplyUpdate(),
|
||||
)! as AllianceRequestReplyUpdate;
|
||||
case "BrokeAllianceUpdate":
|
||||
return accessor(index, new BrokeAllianceUpdate())! as BrokeAllianceUpdate;
|
||||
case "AllianceExpiredUpdate":
|
||||
return accessor(
|
||||
index,
|
||||
new AllianceExpiredUpdate(),
|
||||
)! as AllianceExpiredUpdate;
|
||||
case "DisplayMessageUpdate":
|
||||
return accessor(
|
||||
index,
|
||||
new DisplayMessageUpdate(),
|
||||
)! as DisplayMessageUpdate;
|
||||
case "DisplayChatMessageUpdate":
|
||||
return accessor(
|
||||
index,
|
||||
new DisplayChatMessageUpdate(),
|
||||
)! as DisplayChatMessageUpdate;
|
||||
case "TargetPlayerUpdate":
|
||||
return accessor(index, new TargetPlayerUpdate())! as TargetPlayerUpdate;
|
||||
case "EmojiUpdate":
|
||||
return accessor(index, new EmojiUpdate())! as EmojiUpdate;
|
||||
case "WinUpdate":
|
||||
return accessor(index, new WinUpdate())! as WinUpdate;
|
||||
case "HashUpdate":
|
||||
return accessor(index, new HashUpdate())! as HashUpdate;
|
||||
case "UnitIncomingUpdate":
|
||||
return accessor(index, new UnitIncomingUpdate())! as UnitIncomingUpdate;
|
||||
case "AllianceExtensionUpdate":
|
||||
return accessor(
|
||||
index,
|
||||
new AllianceExtensionUpdate(),
|
||||
)! as AllianceExtensionUpdate;
|
||||
case "BonusEventUpdate":
|
||||
return accessor(index, new BonusEventUpdate())! as BonusEventUpdate;
|
||||
case "RailroadUpdate":
|
||||
return accessor(index, new RailroadUpdate())! as RailroadUpdate;
|
||||
case "ConquestUpdate":
|
||||
return accessor(index, new ConquestUpdate())! as ConquestUpdate;
|
||||
case "EmbargoUpdate":
|
||||
return accessor(index, new EmbargoUpdate())! as EmbargoUpdate;
|
||||
default:
|
||||
return null;
|
||||
type: GameUpdateUnion,
|
||||
accessor: (index: number, obj:AllianceExpiredUpdate|AllianceExtensionUpdate|AllianceRequestReplyUpdate|AllianceRequestUpdate|BonusEventUpdate|BrokeAllianceUpdate|ConquestUpdate|DisplayChatMessageUpdate|DisplayMessageUpdate|EmbargoUpdate|EmojiUpdate|HashUpdate|PlayerUpdate|RailroadUpdate|TargetPlayerUpdate|TileUpdateWrapper|UnitIncomingUpdate|UnitUpdate|WinUpdate) => AllianceExpiredUpdate|AllianceExtensionUpdate|AllianceRequestReplyUpdate|AllianceRequestUpdate|BonusEventUpdate|BrokeAllianceUpdate|ConquestUpdate|DisplayChatMessageUpdate|DisplayMessageUpdate|EmbargoUpdate|EmojiUpdate|HashUpdate|PlayerUpdate|RailroadUpdate|TargetPlayerUpdate|TileUpdateWrapper|UnitIncomingUpdate|UnitUpdate|WinUpdate|null,
|
||||
index: number
|
||||
): AllianceExpiredUpdate|AllianceExtensionUpdate|AllianceRequestReplyUpdate|AllianceRequestUpdate|BonusEventUpdate|BrokeAllianceUpdate|ConquestUpdate|DisplayChatMessageUpdate|DisplayMessageUpdate|EmbargoUpdate|EmojiUpdate|HashUpdate|PlayerUpdate|RailroadUpdate|TargetPlayerUpdate|TileUpdateWrapper|UnitIncomingUpdate|UnitUpdate|WinUpdate|null {
|
||||
switch(GameUpdateUnion[type]) {
|
||||
case 'NONE': return null;
|
||||
case 'TileUpdateWrapper': return accessor(index, new TileUpdateWrapper())! as TileUpdateWrapper;
|
||||
case 'UnitUpdate': return accessor(index, new UnitUpdate())! as UnitUpdate;
|
||||
case 'PlayerUpdate': return accessor(index, new PlayerUpdate())! as PlayerUpdate;
|
||||
case 'AllianceRequestUpdate': return accessor(index, new AllianceRequestUpdate())! as AllianceRequestUpdate;
|
||||
case 'AllianceRequestReplyUpdate': return accessor(index, new AllianceRequestReplyUpdate())! as AllianceRequestReplyUpdate;
|
||||
case 'BrokeAllianceUpdate': return accessor(index, new BrokeAllianceUpdate())! as BrokeAllianceUpdate;
|
||||
case 'AllianceExpiredUpdate': return accessor(index, new AllianceExpiredUpdate())! as AllianceExpiredUpdate;
|
||||
case 'DisplayMessageUpdate': return accessor(index, new DisplayMessageUpdate())! as DisplayMessageUpdate;
|
||||
case 'DisplayChatMessageUpdate': return accessor(index, new DisplayChatMessageUpdate())! as DisplayChatMessageUpdate;
|
||||
case 'TargetPlayerUpdate': return accessor(index, new TargetPlayerUpdate())! as TargetPlayerUpdate;
|
||||
case 'EmojiUpdate': return accessor(index, new EmojiUpdate())! as EmojiUpdate;
|
||||
case 'WinUpdate': return accessor(index, new WinUpdate())! as WinUpdate;
|
||||
case 'HashUpdate': return accessor(index, new HashUpdate())! as HashUpdate;
|
||||
case 'UnitIncomingUpdate': return accessor(index, new UnitIncomingUpdate())! as UnitIncomingUpdate;
|
||||
case 'AllianceExtensionUpdate': return accessor(index, new AllianceExtensionUpdate())! as AllianceExtensionUpdate;
|
||||
case 'BonusEventUpdate': return accessor(index, new BonusEventUpdate())! as BonusEventUpdate;
|
||||
case 'RailroadUpdate': return accessor(index, new RailroadUpdate())! as RailroadUpdate;
|
||||
case 'ConquestUpdate': return accessor(index, new ConquestUpdate())! as ConquestUpdate;
|
||||
case 'EmbargoUpdate': return accessor(index, new EmbargoUpdate())! as EmbargoUpdate;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,278 +2,228 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { GameUpdate } from "../game-updates/game-update.js";
|
||||
import { NameViewData } from "../game-updates/name-view-data.js";
|
||||
import { GameUpdate, GameUpdateT } from '../game-updates/game-update.js';
|
||||
import { NameViewData, NameViewDataT } from '../game-updates/name-view-data.js';
|
||||
|
||||
export class GameUpdateViewData {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
export class GameUpdateViewData implements flatbuffers.IUnpackableObject<GameUpdateViewDataT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): GameUpdateViewData {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsGameUpdateViewData(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: GameUpdateViewData,
|
||||
): GameUpdateViewData {
|
||||
return (obj || new GameUpdateViewData()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsGameUpdateViewData(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: GameUpdateViewData,
|
||||
): GameUpdateViewData {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new GameUpdateViewData()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
tick(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
updates(index: number, obj?: GameUpdate): GameUpdate | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset
|
||||
? (obj || new GameUpdate()).__init(
|
||||
this.bb!.__indirect(
|
||||
this.bb!.__vector(this.bb_pos + offset) + index * 4,
|
||||
),
|
||||
this.bb!,
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
||||
updatesLength(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
packedTileUpdates(index: number): bigint | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset
|
||||
? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8)
|
||||
: BigInt(0);
|
||||
}
|
||||
|
||||
packedTileUpdatesLength(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
playerNameViewDataKeys(index: number): string;
|
||||
playerNameViewDataKeys(
|
||||
index: number,
|
||||
optionalEncoding: flatbuffers.Encoding,
|
||||
): string | Uint8Array;
|
||||
playerNameViewDataKeys(
|
||||
index: number,
|
||||
optionalEncoding?: any,
|
||||
): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset
|
||||
? this.bb!.__string(
|
||||
this.bb!.__vector(this.bb_pos + offset) + index * 4,
|
||||
optionalEncoding,
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
||||
playerNameViewDataKeysLength(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
playerNameViewDataValues(
|
||||
index: number,
|
||||
obj?: NameViewData,
|
||||
): NameViewData | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset
|
||||
? (obj || new NameViewData()).__init(
|
||||
this.bb!.__indirect(
|
||||
this.bb!.__vector(this.bb_pos + offset) + index * 4,
|
||||
),
|
||||
this.bb!,
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
||||
playerNameViewDataValuesLength(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
tickExecutionDuration(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 14);
|
||||
return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
|
||||
}
|
||||
|
||||
static startGameUpdateViewData(builder: flatbuffers.Builder) {
|
||||
builder.startObject(6);
|
||||
}
|
||||
|
||||
static addTick(builder: flatbuffers.Builder, tick: number) {
|
||||
builder.addFieldInt32(0, tick, 0);
|
||||
}
|
||||
|
||||
static addUpdates(
|
||||
builder: flatbuffers.Builder,
|
||||
updatesOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(1, updatesOffset, 0);
|
||||
}
|
||||
|
||||
static createUpdatesVector(
|
||||
builder: flatbuffers.Builder,
|
||||
data: flatbuffers.Offset[],
|
||||
): flatbuffers.Offset {
|
||||
builder.startVector(4, data.length, 4);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addOffset(data[i]!);
|
||||
}
|
||||
return builder.endVector();
|
||||
}
|
||||
|
||||
static startUpdatesVector(builder: flatbuffers.Builder, numElems: number) {
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
|
||||
static addPackedTileUpdates(
|
||||
builder: flatbuffers.Builder,
|
||||
packedTileUpdatesOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(2, packedTileUpdatesOffset, 0);
|
||||
}
|
||||
|
||||
static createPackedTileUpdatesVector(
|
||||
builder: flatbuffers.Builder,
|
||||
data: bigint[],
|
||||
): flatbuffers.Offset {
|
||||
builder.startVector(8, data.length, 8);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addInt64(data[i]!);
|
||||
}
|
||||
return builder.endVector();
|
||||
}
|
||||
|
||||
static startPackedTileUpdatesVector(
|
||||
builder: flatbuffers.Builder,
|
||||
numElems: number,
|
||||
) {
|
||||
builder.startVector(8, numElems, 8);
|
||||
}
|
||||
|
||||
static addPlayerNameViewDataKeys(
|
||||
builder: flatbuffers.Builder,
|
||||
playerNameViewDataKeysOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(3, playerNameViewDataKeysOffset, 0);
|
||||
}
|
||||
|
||||
static createPlayerNameViewDataKeysVector(
|
||||
builder: flatbuffers.Builder,
|
||||
data: flatbuffers.Offset[],
|
||||
): flatbuffers.Offset {
|
||||
builder.startVector(4, data.length, 4);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addOffset(data[i]!);
|
||||
}
|
||||
return builder.endVector();
|
||||
}
|
||||
|
||||
static startPlayerNameViewDataKeysVector(
|
||||
builder: flatbuffers.Builder,
|
||||
numElems: number,
|
||||
) {
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
|
||||
static addPlayerNameViewDataValues(
|
||||
builder: flatbuffers.Builder,
|
||||
playerNameViewDataValuesOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(4, playerNameViewDataValuesOffset, 0);
|
||||
}
|
||||
|
||||
static createPlayerNameViewDataValuesVector(
|
||||
builder: flatbuffers.Builder,
|
||||
data: flatbuffers.Offset[],
|
||||
): flatbuffers.Offset {
|
||||
builder.startVector(4, data.length, 4);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addOffset(data[i]!);
|
||||
}
|
||||
return builder.endVector();
|
||||
}
|
||||
|
||||
static startPlayerNameViewDataValuesVector(
|
||||
builder: flatbuffers.Builder,
|
||||
numElems: number,
|
||||
) {
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
|
||||
static addTickExecutionDuration(
|
||||
builder: flatbuffers.Builder,
|
||||
tickExecutionDuration: number,
|
||||
) {
|
||||
builder.addFieldFloat32(5, tickExecutionDuration, 0.0);
|
||||
}
|
||||
|
||||
static endGameUpdateViewData(
|
||||
builder: flatbuffers.Builder,
|
||||
): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static finishGameUpdateViewDataBuffer(
|
||||
builder: flatbuffers.Builder,
|
||||
offset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.finish(offset);
|
||||
}
|
||||
|
||||
static finishSizePrefixedGameUpdateViewDataBuffer(
|
||||
builder: flatbuffers.Builder,
|
||||
offset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.finish(offset, undefined, true);
|
||||
}
|
||||
|
||||
static createGameUpdateViewData(
|
||||
builder: flatbuffers.Builder,
|
||||
tick: number,
|
||||
updatesOffset: flatbuffers.Offset,
|
||||
packedTileUpdatesOffset: flatbuffers.Offset,
|
||||
playerNameViewDataKeysOffset: flatbuffers.Offset,
|
||||
playerNameViewDataValuesOffset: flatbuffers.Offset,
|
||||
tickExecutionDuration: number,
|
||||
): flatbuffers.Offset {
|
||||
GameUpdateViewData.startGameUpdateViewData(builder);
|
||||
GameUpdateViewData.addTick(builder, tick);
|
||||
GameUpdateViewData.addUpdates(builder, updatesOffset);
|
||||
GameUpdateViewData.addPackedTileUpdates(builder, packedTileUpdatesOffset);
|
||||
GameUpdateViewData.addPlayerNameViewDataKeys(
|
||||
builder,
|
||||
playerNameViewDataKeysOffset,
|
||||
);
|
||||
GameUpdateViewData.addPlayerNameViewDataValues(
|
||||
builder,
|
||||
playerNameViewDataValuesOffset,
|
||||
);
|
||||
GameUpdateViewData.addTickExecutionDuration(builder, tickExecutionDuration);
|
||||
return GameUpdateViewData.endGameUpdateViewData(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):GameUpdateViewData {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsGameUpdateViewData(bb:flatbuffers.ByteBuffer, obj?:GameUpdateViewData):GameUpdateViewData {
|
||||
return (obj || new GameUpdateViewData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsGameUpdateViewData(bb:flatbuffers.ByteBuffer, obj?:GameUpdateViewData):GameUpdateViewData {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new GameUpdateViewData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
tick():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
updates(index: number, obj?:GameUpdate):GameUpdate|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? (obj || new GameUpdate()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
|
||||
}
|
||||
|
||||
updatesLength():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
packedTileUpdates(index: number):bigint|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
|
||||
}
|
||||
|
||||
packedTileUpdatesLength():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
playerNameViewDataKeys(index: number):string
|
||||
playerNameViewDataKeys(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
|
||||
playerNameViewDataKeys(index: number,optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
playerNameViewDataKeysLength():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
playerNameViewDataValues(index: number, obj?:NameViewData):NameViewData|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? (obj || new NameViewData()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
|
||||
}
|
||||
|
||||
playerNameViewDataValuesLength():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
tickExecutionDuration():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 14);
|
||||
return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
|
||||
}
|
||||
|
||||
static startGameUpdateViewData(builder:flatbuffers.Builder) {
|
||||
builder.startObject(6);
|
||||
}
|
||||
|
||||
static addTick(builder:flatbuffers.Builder, tick:number) {
|
||||
builder.addFieldInt32(0, tick, 0);
|
||||
}
|
||||
|
||||
static addUpdates(builder:flatbuffers.Builder, updatesOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(1, updatesOffset, 0);
|
||||
}
|
||||
|
||||
static createUpdatesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
|
||||
builder.startVector(4, data.length, 4);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addOffset(data[i]!);
|
||||
}
|
||||
return builder.endVector();
|
||||
}
|
||||
|
||||
static startUpdatesVector(builder:flatbuffers.Builder, numElems:number) {
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
|
||||
static addPackedTileUpdates(builder:flatbuffers.Builder, packedTileUpdatesOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(2, packedTileUpdatesOffset, 0);
|
||||
}
|
||||
|
||||
static createPackedTileUpdatesVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset {
|
||||
builder.startVector(8, data.length, 8);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addInt64(data[i]!);
|
||||
}
|
||||
return builder.endVector();
|
||||
}
|
||||
|
||||
static startPackedTileUpdatesVector(builder:flatbuffers.Builder, numElems:number) {
|
||||
builder.startVector(8, numElems, 8);
|
||||
}
|
||||
|
||||
static addPlayerNameViewDataKeys(builder:flatbuffers.Builder, playerNameViewDataKeysOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(3, playerNameViewDataKeysOffset, 0);
|
||||
}
|
||||
|
||||
static createPlayerNameViewDataKeysVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
|
||||
builder.startVector(4, data.length, 4);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addOffset(data[i]!);
|
||||
}
|
||||
return builder.endVector();
|
||||
}
|
||||
|
||||
static startPlayerNameViewDataKeysVector(builder:flatbuffers.Builder, numElems:number) {
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
|
||||
static addPlayerNameViewDataValues(builder:flatbuffers.Builder, playerNameViewDataValuesOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(4, playerNameViewDataValuesOffset, 0);
|
||||
}
|
||||
|
||||
static createPlayerNameViewDataValuesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
|
||||
builder.startVector(4, data.length, 4);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addOffset(data[i]!);
|
||||
}
|
||||
return builder.endVector();
|
||||
}
|
||||
|
||||
static startPlayerNameViewDataValuesVector(builder:flatbuffers.Builder, numElems:number) {
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
|
||||
static addTickExecutionDuration(builder:flatbuffers.Builder, tickExecutionDuration:number) {
|
||||
builder.addFieldFloat32(5, tickExecutionDuration, 0.0);
|
||||
}
|
||||
|
||||
static endGameUpdateViewData(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static finishGameUpdateViewDataBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
|
||||
builder.finish(offset);
|
||||
}
|
||||
|
||||
static finishSizePrefixedGameUpdateViewDataBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
|
||||
builder.finish(offset, undefined, true);
|
||||
}
|
||||
|
||||
static createGameUpdateViewData(builder:flatbuffers.Builder, tick:number, updatesOffset:flatbuffers.Offset, packedTileUpdatesOffset:flatbuffers.Offset, playerNameViewDataKeysOffset:flatbuffers.Offset, playerNameViewDataValuesOffset:flatbuffers.Offset, tickExecutionDuration:number):flatbuffers.Offset {
|
||||
GameUpdateViewData.startGameUpdateViewData(builder);
|
||||
GameUpdateViewData.addTick(builder, tick);
|
||||
GameUpdateViewData.addUpdates(builder, updatesOffset);
|
||||
GameUpdateViewData.addPackedTileUpdates(builder, packedTileUpdatesOffset);
|
||||
GameUpdateViewData.addPlayerNameViewDataKeys(builder, playerNameViewDataKeysOffset);
|
||||
GameUpdateViewData.addPlayerNameViewDataValues(builder, playerNameViewDataValuesOffset);
|
||||
GameUpdateViewData.addTickExecutionDuration(builder, tickExecutionDuration);
|
||||
return GameUpdateViewData.endGameUpdateViewData(builder);
|
||||
}
|
||||
|
||||
unpack(): GameUpdateViewDataT {
|
||||
return new GameUpdateViewDataT(
|
||||
this.tick(),
|
||||
this.bb!.createObjList<GameUpdate, GameUpdateT>(this.updates.bind(this), this.updatesLength()),
|
||||
this.bb!.createScalarList<bigint>(this.packedTileUpdates.bind(this), this.packedTileUpdatesLength()),
|
||||
this.bb!.createScalarList<string>(this.playerNameViewDataKeys.bind(this), this.playerNameViewDataKeysLength()),
|
||||
this.bb!.createObjList<NameViewData, NameViewDataT>(this.playerNameViewDataValues.bind(this), this.playerNameViewDataValuesLength()),
|
||||
this.tickExecutionDuration()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: GameUpdateViewDataT): void {
|
||||
_o.tick = this.tick();
|
||||
_o.updates = this.bb!.createObjList<GameUpdate, GameUpdateT>(this.updates.bind(this), this.updatesLength());
|
||||
_o.packedTileUpdates = this.bb!.createScalarList<bigint>(this.packedTileUpdates.bind(this), this.packedTileUpdatesLength());
|
||||
_o.playerNameViewDataKeys = this.bb!.createScalarList<string>(this.playerNameViewDataKeys.bind(this), this.playerNameViewDataKeysLength());
|
||||
_o.playerNameViewDataValues = this.bb!.createObjList<NameViewData, NameViewDataT>(this.playerNameViewDataValues.bind(this), this.playerNameViewDataValuesLength());
|
||||
_o.tickExecutionDuration = this.tickExecutionDuration();
|
||||
}
|
||||
}
|
||||
|
||||
export class GameUpdateViewDataT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public tick: number = 0,
|
||||
public updates: (GameUpdateT)[] = [],
|
||||
public packedTileUpdates: (bigint)[] = [],
|
||||
public playerNameViewDataKeys: (string)[] = [],
|
||||
public playerNameViewDataValues: (NameViewDataT)[] = [],
|
||||
public tickExecutionDuration: number = 0.0
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const updates = GameUpdateViewData.createUpdatesVector(builder, builder.createObjectOffsetList(this.updates));
|
||||
const packedTileUpdates = GameUpdateViewData.createPackedTileUpdatesVector(builder, this.packedTileUpdates);
|
||||
const playerNameViewDataKeys = GameUpdateViewData.createPlayerNameViewDataKeysVector(builder, builder.createObjectOffsetList(this.playerNameViewDataKeys));
|
||||
const playerNameViewDataValues = GameUpdateViewData.createPlayerNameViewDataValuesVector(builder, builder.createObjectOffsetList(this.playerNameViewDataValues));
|
||||
|
||||
return GameUpdateViewData.createGameUpdateViewData(builder,
|
||||
this.tick,
|
||||
updates,
|
||||
packedTileUpdates,
|
||||
playerNameViewDataKeys,
|
||||
playerNameViewDataValues,
|
||||
this.tickExecutionDuration
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,97 +2,134 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { GameUpdateType } from "../game-updates/game-update-type.js";
|
||||
import { GameUpdateUnion } from "../game-updates/game-update-union.js";
|
||||
import { AllianceExpiredUpdate, AllianceExpiredUpdateT } from '../game-updates/alliance-expired-update.js';
|
||||
import { AllianceExtensionUpdate, AllianceExtensionUpdateT } from '../game-updates/alliance-extension-update.js';
|
||||
import { AllianceRequestReplyUpdate, AllianceRequestReplyUpdateT } from '../game-updates/alliance-request-reply-update.js';
|
||||
import { AllianceRequestUpdate, AllianceRequestUpdateT } from '../game-updates/alliance-request-update.js';
|
||||
import { BonusEventUpdate, BonusEventUpdateT } from '../game-updates/bonus-event-update.js';
|
||||
import { BrokeAllianceUpdate, BrokeAllianceUpdateT } from '../game-updates/broke-alliance-update.js';
|
||||
import { ConquestUpdate, ConquestUpdateT } from '../game-updates/conquest-update.js';
|
||||
import { DisplayChatMessageUpdate, DisplayChatMessageUpdateT } from '../game-updates/display-chat-message-update.js';
|
||||
import { DisplayMessageUpdate, DisplayMessageUpdateT } from '../game-updates/display-message-update.js';
|
||||
import { EmbargoUpdate, EmbargoUpdateT } from '../game-updates/embargo-update.js';
|
||||
import { EmojiUpdate, EmojiUpdateT } from '../game-updates/emoji-update.js';
|
||||
import { GameUpdateUnion, unionToGameUpdateUnion, unionListToGameUpdateUnion } from '../game-updates/game-update-union.js';
|
||||
import { HashUpdate, HashUpdateT } from '../game-updates/hash-update.js';
|
||||
import { PlayerUpdate, PlayerUpdateT } from '../game-updates/player-update.js';
|
||||
import { RailroadUpdate, RailroadUpdateT } from '../game-updates/railroad-update.js';
|
||||
import { TargetPlayerUpdate, TargetPlayerUpdateT } from '../game-updates/target-player-update.js';
|
||||
import { TileUpdateWrapper, TileUpdateWrapperT } from '../game-updates/tile-update-wrapper.js';
|
||||
import { UnitIncomingUpdate, UnitIncomingUpdateT } from '../game-updates/unit-incoming-update.js';
|
||||
import { UnitUpdate, UnitUpdateT } from '../game-updates/unit-update.js';
|
||||
import { WinUpdate, WinUpdateT } from '../game-updates/win-update.js';
|
||||
|
||||
export class GameUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
export class GameUpdate implements flatbuffers.IUnpackableObject<GameUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): GameUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsGameUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: GameUpdate,
|
||||
): GameUpdate {
|
||||
return (obj || new GameUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsGameUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: GameUpdate,
|
||||
): GameUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new GameUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
type(): GameUpdateType {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset
|
||||
? this.bb!.readInt8(this.bb_pos + offset)
|
||||
: GameUpdateType.Tile;
|
||||
}
|
||||
|
||||
updateType(): GameUpdateUnion {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset
|
||||
? this.bb!.readUint8(this.bb_pos + offset)
|
||||
: GameUpdateUnion.NONE;
|
||||
}
|
||||
|
||||
update<T extends flatbuffers.Table>(obj: any): any | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;
|
||||
}
|
||||
|
||||
static startGameUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(3);
|
||||
}
|
||||
|
||||
static addType(builder: flatbuffers.Builder, type: GameUpdateType) {
|
||||
builder.addFieldInt8(0, type, GameUpdateType.Tile);
|
||||
}
|
||||
|
||||
static addUpdateType(
|
||||
builder: flatbuffers.Builder,
|
||||
updateType: GameUpdateUnion,
|
||||
) {
|
||||
builder.addFieldInt8(1, updateType, GameUpdateUnion.NONE);
|
||||
}
|
||||
|
||||
static addUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
updateOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(2, updateOffset, 0);
|
||||
}
|
||||
|
||||
static endGameUpdate(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createGameUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
type: GameUpdateType,
|
||||
updateType: GameUpdateUnion,
|
||||
updateOffset: flatbuffers.Offset,
|
||||
): flatbuffers.Offset {
|
||||
GameUpdate.startGameUpdate(builder);
|
||||
GameUpdate.addType(builder, type);
|
||||
GameUpdate.addUpdateType(builder, updateType);
|
||||
GameUpdate.addUpdate(builder, updateOffset);
|
||||
return GameUpdate.endGameUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):GameUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsGameUpdate(bb:flatbuffers.ByteBuffer, obj?:GameUpdate):GameUpdate {
|
||||
return (obj || new GameUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsGameUpdate(bb:flatbuffers.ByteBuffer, obj?:GameUpdate):GameUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new GameUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
type():string|null
|
||||
type(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
type(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
updateType():GameUpdateUnion {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readUint8(this.bb_pos + offset) : GameUpdateUnion.NONE;
|
||||
}
|
||||
|
||||
update<T extends flatbuffers.Table>(obj:any):any|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;
|
||||
}
|
||||
|
||||
static startGameUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(3);
|
||||
}
|
||||
|
||||
static addType(builder:flatbuffers.Builder, typeOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, typeOffset, 0);
|
||||
}
|
||||
|
||||
static addUpdateType(builder:flatbuffers.Builder, updateType:GameUpdateUnion) {
|
||||
builder.addFieldInt8(1, updateType, GameUpdateUnion.NONE);
|
||||
}
|
||||
|
||||
static addUpdate(builder:flatbuffers.Builder, updateOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(2, updateOffset, 0);
|
||||
}
|
||||
|
||||
static endGameUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createGameUpdate(builder:flatbuffers.Builder, typeOffset:flatbuffers.Offset, updateType:GameUpdateUnion, updateOffset:flatbuffers.Offset):flatbuffers.Offset {
|
||||
GameUpdate.startGameUpdate(builder);
|
||||
GameUpdate.addType(builder, typeOffset);
|
||||
GameUpdate.addUpdateType(builder, updateType);
|
||||
GameUpdate.addUpdate(builder, updateOffset);
|
||||
return GameUpdate.endGameUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): GameUpdateT {
|
||||
return new GameUpdateT(
|
||||
this.type(),
|
||||
this.updateType(),
|
||||
(() => {
|
||||
const temp = unionToGameUpdateUnion(this.updateType(), this.update.bind(this));
|
||||
if(temp === null) { return null; }
|
||||
return temp.unpack()
|
||||
})()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: GameUpdateT): void {
|
||||
_o.type = this.type();
|
||||
_o.updateType = this.updateType();
|
||||
_o.update = (() => {
|
||||
const temp = unionToGameUpdateUnion(this.updateType(), this.update.bind(this));
|
||||
if(temp === null) { return null; }
|
||||
return temp.unpack()
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
export class GameUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public type: string|Uint8Array|null = null,
|
||||
public updateType: GameUpdateUnion = GameUpdateUnion.NONE,
|
||||
public update: AllianceExpiredUpdateT|AllianceExtensionUpdateT|AllianceRequestReplyUpdateT|AllianceRequestUpdateT|BonusEventUpdateT|BrokeAllianceUpdateT|ConquestUpdateT|DisplayChatMessageUpdateT|DisplayMessageUpdateT|EmbargoUpdateT|EmojiUpdateT|HashUpdateT|PlayerUpdateT|RailroadUpdateT|TargetPlayerUpdateT|TileUpdateWrapperT|UnitIncomingUpdateT|UnitUpdateT|WinUpdateT|null = null
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const type = (this.type !== null ? builder.createString(this.type!) : 0);
|
||||
const update = builder.createObjectOffset(this.update);
|
||||
|
||||
return GameUpdate.createGameUpdate(builder,
|
||||
type,
|
||||
this.updateType,
|
||||
update
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,73 +2,87 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class HashUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
|
||||
export class HashUpdate implements flatbuffers.IUnpackableObject<HashUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): HashUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsHashUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: HashUpdate,
|
||||
): HashUpdate {
|
||||
return (obj || new HashUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsHashUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: HashUpdate,
|
||||
): HashUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new HashUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
tick(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
hash(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startHashUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addTick(builder: flatbuffers.Builder, tick: number) {
|
||||
builder.addFieldInt32(0, tick, 0);
|
||||
}
|
||||
|
||||
static addHash(builder: flatbuffers.Builder, hash: number) {
|
||||
builder.addFieldInt32(1, hash, 0);
|
||||
}
|
||||
|
||||
static endHashUpdate(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createHashUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
tick: number,
|
||||
hash: number,
|
||||
): flatbuffers.Offset {
|
||||
HashUpdate.startHashUpdate(builder);
|
||||
HashUpdate.addTick(builder, tick);
|
||||
HashUpdate.addHash(builder, hash);
|
||||
return HashUpdate.endHashUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):HashUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsHashUpdate(bb:flatbuffers.ByteBuffer, obj?:HashUpdate):HashUpdate {
|
||||
return (obj || new HashUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsHashUpdate(bb:flatbuffers.ByteBuffer, obj?:HashUpdate):HashUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new HashUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
tick():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
hash():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startHashUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addTick(builder:flatbuffers.Builder, tick:number) {
|
||||
builder.addFieldInt32(0, tick, 0);
|
||||
}
|
||||
|
||||
static addHash(builder:flatbuffers.Builder, hash:number) {
|
||||
builder.addFieldInt32(1, hash, 0);
|
||||
}
|
||||
|
||||
static endHashUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createHashUpdate(builder:flatbuffers.Builder, tick:number, hash:number):flatbuffers.Offset {
|
||||
HashUpdate.startHashUpdate(builder);
|
||||
HashUpdate.addTick(builder, tick);
|
||||
HashUpdate.addHash(builder, hash);
|
||||
return HashUpdate.endHashUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): HashUpdateT {
|
||||
return new HashUpdateT(
|
||||
this.tick(),
|
||||
this.hash()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: HashUpdateT): void {
|
||||
_o.tick = this.tick();
|
||||
_o.hash = this.hash();
|
||||
}
|
||||
}
|
||||
|
||||
export class HashUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public tick: number = 0,
|
||||
public hash: number = 0
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return HashUpdate.createHashUpdate(builder,
|
||||
this.tick,
|
||||
this.hash
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,5 +6,5 @@ export enum MessageType {
|
||||
Info = 0,
|
||||
Warning = 1,
|
||||
Error = 2,
|
||||
Success = 3,
|
||||
Success = 3
|
||||
}
|
||||
|
||||
@@ -2,97 +2,108 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class NameViewData {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
|
||||
export class NameViewData implements flatbuffers.IUnpackableObject<NameViewDataT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): NameViewData {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsNameViewData(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: NameViewData,
|
||||
): NameViewData {
|
||||
return (obj || new NameViewData()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsNameViewData(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: NameViewData,
|
||||
): NameViewData {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new NameViewData()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
name(): string | null;
|
||||
name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
name(optionalEncoding?: any): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset
|
||||
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
||||
: null;
|
||||
}
|
||||
|
||||
displayName(): string | null;
|
||||
displayName(
|
||||
optionalEncoding: flatbuffers.Encoding,
|
||||
): string | Uint8Array | null;
|
||||
displayName(optionalEncoding?: any): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset
|
||||
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
||||
: null;
|
||||
}
|
||||
|
||||
color(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startNameViewData(builder: flatbuffers.Builder) {
|
||||
builder.startObject(3);
|
||||
}
|
||||
|
||||
static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, nameOffset, 0);
|
||||
}
|
||||
|
||||
static addDisplayName(
|
||||
builder: flatbuffers.Builder,
|
||||
displayNameOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(1, displayNameOffset, 0);
|
||||
}
|
||||
|
||||
static addColor(builder: flatbuffers.Builder, color: number) {
|
||||
builder.addFieldInt32(2, color, 0);
|
||||
}
|
||||
|
||||
static endNameViewData(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createNameViewData(
|
||||
builder: flatbuffers.Builder,
|
||||
nameOffset: flatbuffers.Offset,
|
||||
displayNameOffset: flatbuffers.Offset,
|
||||
color: number,
|
||||
): flatbuffers.Offset {
|
||||
NameViewData.startNameViewData(builder);
|
||||
NameViewData.addName(builder, nameOffset);
|
||||
NameViewData.addDisplayName(builder, displayNameOffset);
|
||||
NameViewData.addColor(builder, color);
|
||||
return NameViewData.endNameViewData(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):NameViewData {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsNameViewData(bb:flatbuffers.ByteBuffer, obj?:NameViewData):NameViewData {
|
||||
return (obj || new NameViewData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsNameViewData(bb:flatbuffers.ByteBuffer, obj?:NameViewData):NameViewData {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new NameViewData()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
name():string|null
|
||||
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
name(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
displayName():string|null
|
||||
displayName(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
displayName(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
color():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startNameViewData(builder:flatbuffers.Builder) {
|
||||
builder.startObject(3);
|
||||
}
|
||||
|
||||
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, nameOffset, 0);
|
||||
}
|
||||
|
||||
static addDisplayName(builder:flatbuffers.Builder, displayNameOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(1, displayNameOffset, 0);
|
||||
}
|
||||
|
||||
static addColor(builder:flatbuffers.Builder, color:number) {
|
||||
builder.addFieldInt32(2, color, 0);
|
||||
}
|
||||
|
||||
static endNameViewData(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createNameViewData(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, displayNameOffset:flatbuffers.Offset, color:number):flatbuffers.Offset {
|
||||
NameViewData.startNameViewData(builder);
|
||||
NameViewData.addName(builder, nameOffset);
|
||||
NameViewData.addDisplayName(builder, displayNameOffset);
|
||||
NameViewData.addColor(builder, color);
|
||||
return NameViewData.endNameViewData(builder);
|
||||
}
|
||||
|
||||
unpack(): NameViewDataT {
|
||||
return new NameViewDataT(
|
||||
this.name(),
|
||||
this.displayName(),
|
||||
this.color()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: NameViewDataT): void {
|
||||
_o.name = this.name();
|
||||
_o.displayName = this.displayName();
|
||||
_o.color = this.color();
|
||||
}
|
||||
}
|
||||
|
||||
export class NameViewDataT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public name: string|Uint8Array|null = null,
|
||||
public displayName: string|Uint8Array|null = null,
|
||||
public color: number = 0
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const name = (this.name !== null ? builder.createString(this.name!) : 0);
|
||||
const displayName = (this.displayName !== null ? builder.createString(this.displayName!) : 0);
|
||||
|
||||
return NameViewData.createNameViewData(builder,
|
||||
name,
|
||||
displayName,
|
||||
this.color
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@
|
||||
export enum PlayerType {
|
||||
Human = 0,
|
||||
Bot = 1,
|
||||
Spectator = 2,
|
||||
Spectator = 2
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,81 +2,88 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { RailType } from "../game-updates/rail-type.js";
|
||||
import { TileRef } from "../game-updates/tile-ref.js";
|
||||
import { RailType } from '../game-updates/rail-type.js';
|
||||
|
||||
export class RailTile {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
export class RailTile implements flatbuffers.IUnpackableObject<RailTileT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): RailTile {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsRailTile(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: RailTile,
|
||||
): RailTile {
|
||||
return (obj || new RailTile()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsRailTile(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: RailTile,
|
||||
): RailTile {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new RailTile()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
tile(obj?: TileRef): TileRef | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset
|
||||
? (obj || new TileRef()).__init(
|
||||
this.bb!.__indirect(this.bb_pos + offset),
|
||||
this.bb!,
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
||||
railType(): RailType {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt8(this.bb_pos + offset) : RailType.VERTICAL;
|
||||
}
|
||||
|
||||
static startRailTile(builder: flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addTile(builder: flatbuffers.Builder, tileOffset: flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, tileOffset, 0);
|
||||
}
|
||||
|
||||
static addRailType(builder: flatbuffers.Builder, railType: RailType) {
|
||||
builder.addFieldInt8(1, railType, RailType.VERTICAL);
|
||||
}
|
||||
|
||||
static endRailTile(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createRailTile(
|
||||
builder: flatbuffers.Builder,
|
||||
tileOffset: flatbuffers.Offset,
|
||||
railType: RailType,
|
||||
): flatbuffers.Offset {
|
||||
RailTile.startRailTile(builder);
|
||||
RailTile.addTile(builder, tileOffset);
|
||||
RailTile.addRailType(builder, railType);
|
||||
return RailTile.endRailTile(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):RailTile {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsRailTile(bb:flatbuffers.ByteBuffer, obj?:RailTile):RailTile {
|
||||
return (obj || new RailTile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsRailTile(bb:flatbuffers.ByteBuffer, obj?:RailTile):RailTile {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new RailTile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
tile():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
|
||||
}
|
||||
|
||||
railType():RailType {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt8(this.bb_pos + offset) : RailType.VERTICAL;
|
||||
}
|
||||
|
||||
static startRailTile(builder:flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addTile(builder:flatbuffers.Builder, tile:number) {
|
||||
builder.addFieldFloat64(0, tile, 0.0);
|
||||
}
|
||||
|
||||
static addRailType(builder:flatbuffers.Builder, railType:RailType) {
|
||||
builder.addFieldInt8(1, railType, RailType.VERTICAL);
|
||||
}
|
||||
|
||||
static endRailTile(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createRailTile(builder:flatbuffers.Builder, tile:number, railType:RailType):flatbuffers.Offset {
|
||||
RailTile.startRailTile(builder);
|
||||
RailTile.addTile(builder, tile);
|
||||
RailTile.addRailType(builder, railType);
|
||||
return RailTile.endRailTile(builder);
|
||||
}
|
||||
|
||||
unpack(): RailTileT {
|
||||
return new RailTileT(
|
||||
this.tile(),
|
||||
this.railType()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: RailTileT): void {
|
||||
_o.tile = this.tile();
|
||||
_o.railType = this.railType();
|
||||
}
|
||||
}
|
||||
|
||||
export class RailTileT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public tile: number = 0.0,
|
||||
public railType: RailType = RailType.VERTICAL
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return RailTile.createRailTile(builder,
|
||||
this.tile,
|
||||
this.railType
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ export enum RailType {
|
||||
TOP_LEFT = 2,
|
||||
TOP_RIGHT = 3,
|
||||
BOTTOM_LEFT = 4,
|
||||
BOTTOM_RIGHT = 5,
|
||||
BOTTOM_RIGHT = 5
|
||||
}
|
||||
|
||||
@@ -2,105 +2,107 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { RailTile } from "../game-updates/rail-tile.js";
|
||||
import { RailTile, RailTileT } from '../game-updates/rail-tile.js';
|
||||
|
||||
export class RailroadUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
export class RailroadUpdate implements flatbuffers.IUnpackableObject<RailroadUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): RailroadUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsRailroadUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: RailroadUpdate,
|
||||
): RailroadUpdate {
|
||||
return (obj || new RailroadUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsRailroadUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: RailroadUpdate,
|
||||
): RailroadUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new RailroadUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
isActive(): boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
railTiles(index: number, obj?: RailTile): RailTile | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset
|
||||
? (obj || new RailTile()).__init(
|
||||
this.bb!.__indirect(
|
||||
this.bb!.__vector(this.bb_pos + offset) + index * 4,
|
||||
),
|
||||
this.bb!,
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
||||
railTilesLength(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startRailroadUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addIsActive(builder: flatbuffers.Builder, isActive: boolean) {
|
||||
builder.addFieldInt8(0, +isActive, +false);
|
||||
}
|
||||
|
||||
static addRailTiles(
|
||||
builder: flatbuffers.Builder,
|
||||
railTilesOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(1, railTilesOffset, 0);
|
||||
}
|
||||
|
||||
static createRailTilesVector(
|
||||
builder: flatbuffers.Builder,
|
||||
data: flatbuffers.Offset[],
|
||||
): flatbuffers.Offset {
|
||||
builder.startVector(4, data.length, 4);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addOffset(data[i]!);
|
||||
}
|
||||
return builder.endVector();
|
||||
}
|
||||
|
||||
static startRailTilesVector(builder: flatbuffers.Builder, numElems: number) {
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
|
||||
static endRailroadUpdate(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createRailroadUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
isActive: boolean,
|
||||
railTilesOffset: flatbuffers.Offset,
|
||||
): flatbuffers.Offset {
|
||||
RailroadUpdate.startRailroadUpdate(builder);
|
||||
RailroadUpdate.addIsActive(builder, isActive);
|
||||
RailroadUpdate.addRailTiles(builder, railTilesOffset);
|
||||
return RailroadUpdate.endRailroadUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):RailroadUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsRailroadUpdate(bb:flatbuffers.ByteBuffer, obj?:RailroadUpdate):RailroadUpdate {
|
||||
return (obj || new RailroadUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsRailroadUpdate(bb:flatbuffers.ByteBuffer, obj?:RailroadUpdate):RailroadUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new RailroadUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
isActive():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
railTiles(index: number, obj?:RailTile):RailTile|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? (obj || new RailTile()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
|
||||
}
|
||||
|
||||
railTilesLength():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startRailroadUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addIsActive(builder:flatbuffers.Builder, isActive:boolean) {
|
||||
builder.addFieldInt8(0, +isActive, +false);
|
||||
}
|
||||
|
||||
static addRailTiles(builder:flatbuffers.Builder, railTilesOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(1, railTilesOffset, 0);
|
||||
}
|
||||
|
||||
static createRailTilesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
|
||||
builder.startVector(4, data.length, 4);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addOffset(data[i]!);
|
||||
}
|
||||
return builder.endVector();
|
||||
}
|
||||
|
||||
static startRailTilesVector(builder:flatbuffers.Builder, numElems:number) {
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
|
||||
static endRailroadUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createRailroadUpdate(builder:flatbuffers.Builder, isActive:boolean, railTilesOffset:flatbuffers.Offset):flatbuffers.Offset {
|
||||
RailroadUpdate.startRailroadUpdate(builder);
|
||||
RailroadUpdate.addIsActive(builder, isActive);
|
||||
RailroadUpdate.addRailTiles(builder, railTilesOffset);
|
||||
return RailroadUpdate.endRailroadUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): RailroadUpdateT {
|
||||
return new RailroadUpdateT(
|
||||
this.isActive(),
|
||||
this.bb!.createObjList<RailTile, RailTileT>(this.railTiles.bind(this), this.railTilesLength())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: RailroadUpdateT): void {
|
||||
_o.isActive = this.isActive();
|
||||
_o.railTiles = this.bb!.createObjList<RailTile, RailTileT>(this.railTiles.bind(this), this.railTilesLength());
|
||||
}
|
||||
}
|
||||
|
||||
export class RailroadUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public isActive: boolean = false,
|
||||
public railTiles: (RailTileT)[] = []
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const railTiles = RailroadUpdate.createRailTilesVector(builder, builder.createObjectOffsetList(this.railTiles));
|
||||
|
||||
return RailroadUpdate.createRailroadUpdate(builder,
|
||||
this.isActive,
|
||||
railTiles
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,75 +2,87 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class TargetPlayerUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
|
||||
export class TargetPlayerUpdate implements flatbuffers.IUnpackableObject<TargetPlayerUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): TargetPlayerUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsTargetPlayerUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: TargetPlayerUpdate,
|
||||
): TargetPlayerUpdate {
|
||||
return (obj || new TargetPlayerUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsTargetPlayerUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: TargetPlayerUpdate,
|
||||
): TargetPlayerUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new TargetPlayerUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
playerId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
targetId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startTargetPlayerUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addPlayerId(builder: flatbuffers.Builder, playerId: number) {
|
||||
builder.addFieldInt32(0, playerId, 0);
|
||||
}
|
||||
|
||||
static addTargetId(builder: flatbuffers.Builder, targetId: number) {
|
||||
builder.addFieldInt32(1, targetId, 0);
|
||||
}
|
||||
|
||||
static endTargetPlayerUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createTargetPlayerUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
playerId: number,
|
||||
targetId: number,
|
||||
): flatbuffers.Offset {
|
||||
TargetPlayerUpdate.startTargetPlayerUpdate(builder);
|
||||
TargetPlayerUpdate.addPlayerId(builder, playerId);
|
||||
TargetPlayerUpdate.addTargetId(builder, targetId);
|
||||
return TargetPlayerUpdate.endTargetPlayerUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):TargetPlayerUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsTargetPlayerUpdate(bb:flatbuffers.ByteBuffer, obj?:TargetPlayerUpdate):TargetPlayerUpdate {
|
||||
return (obj || new TargetPlayerUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsTargetPlayerUpdate(bb:flatbuffers.ByteBuffer, obj?:TargetPlayerUpdate):TargetPlayerUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new TargetPlayerUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
playerId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
targetId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startTargetPlayerUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addPlayerId(builder:flatbuffers.Builder, playerId:number) {
|
||||
builder.addFieldInt32(0, playerId, 0);
|
||||
}
|
||||
|
||||
static addTargetId(builder:flatbuffers.Builder, targetId:number) {
|
||||
builder.addFieldInt32(1, targetId, 0);
|
||||
}
|
||||
|
||||
static endTargetPlayerUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createTargetPlayerUpdate(builder:flatbuffers.Builder, playerId:number, targetId:number):flatbuffers.Offset {
|
||||
TargetPlayerUpdate.startTargetPlayerUpdate(builder);
|
||||
TargetPlayerUpdate.addPlayerId(builder, playerId);
|
||||
TargetPlayerUpdate.addTargetId(builder, targetId);
|
||||
return TargetPlayerUpdate.endTargetPlayerUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): TargetPlayerUpdateT {
|
||||
return new TargetPlayerUpdateT(
|
||||
this.playerId(),
|
||||
this.targetId()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: TargetPlayerUpdateT): void {
|
||||
_o.playerId = this.playerId();
|
||||
_o.targetId = this.targetId();
|
||||
}
|
||||
}
|
||||
|
||||
export class TargetPlayerUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public playerId: number = 0,
|
||||
public targetId: number = 0
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return TargetPlayerUpdate.createTargetPlayerUpdate(builder,
|
||||
this.playerId,
|
||||
this.targetId
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,74 +2,76 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { TileUpdate } from "../game-updates/tile-update.js";
|
||||
import { TileUpdate, TileUpdateT } from '../game-updates/tile-update.js';
|
||||
|
||||
export class TileUpdateWrapper {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
export class TileUpdateWrapper implements flatbuffers.IUnpackableObject<TileUpdateWrapperT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): TileUpdateWrapper {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsTileUpdateWrapper(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: TileUpdateWrapper,
|
||||
): TileUpdateWrapper {
|
||||
return (obj || new TileUpdateWrapper()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsTileUpdateWrapper(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: TileUpdateWrapper,
|
||||
): TileUpdateWrapper {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new TileUpdateWrapper()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
update(obj?: TileUpdate): TileUpdate | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset
|
||||
? (obj || new TileUpdate()).__init(
|
||||
this.bb!.__indirect(this.bb_pos + offset),
|
||||
this.bb!,
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
||||
static startTileUpdateWrapper(builder: flatbuffers.Builder) {
|
||||
builder.startObject(1);
|
||||
}
|
||||
|
||||
static addUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
updateOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(0, updateOffset, 0);
|
||||
}
|
||||
|
||||
static endTileUpdateWrapper(
|
||||
builder: flatbuffers.Builder,
|
||||
): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createTileUpdateWrapper(
|
||||
builder: flatbuffers.Builder,
|
||||
updateOffset: flatbuffers.Offset,
|
||||
): flatbuffers.Offset {
|
||||
TileUpdateWrapper.startTileUpdateWrapper(builder);
|
||||
TileUpdateWrapper.addUpdate(builder, updateOffset);
|
||||
return TileUpdateWrapper.endTileUpdateWrapper(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):TileUpdateWrapper {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsTileUpdateWrapper(bb:flatbuffers.ByteBuffer, obj?:TileUpdateWrapper):TileUpdateWrapper {
|
||||
return (obj || new TileUpdateWrapper()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsTileUpdateWrapper(bb:flatbuffers.ByteBuffer, obj?:TileUpdateWrapper):TileUpdateWrapper {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new TileUpdateWrapper()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
update(obj?:TileUpdate):TileUpdate|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? (obj || new TileUpdate()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
|
||||
}
|
||||
|
||||
static startTileUpdateWrapper(builder:flatbuffers.Builder) {
|
||||
builder.startObject(1);
|
||||
}
|
||||
|
||||
static addUpdate(builder:flatbuffers.Builder, updateOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, updateOffset, 0);
|
||||
}
|
||||
|
||||
static endTileUpdateWrapper(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createTileUpdateWrapper(builder:flatbuffers.Builder, updateOffset:flatbuffers.Offset):flatbuffers.Offset {
|
||||
TileUpdateWrapper.startTileUpdateWrapper(builder);
|
||||
TileUpdateWrapper.addUpdate(builder, updateOffset);
|
||||
return TileUpdateWrapper.endTileUpdateWrapper(builder);
|
||||
}
|
||||
|
||||
unpack(): TileUpdateWrapperT {
|
||||
return new TileUpdateWrapperT(
|
||||
(this.update() !== null ? this.update()!.unpack() : null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: TileUpdateWrapperT): void {
|
||||
_o.update = (this.update() !== null ? this.update()!.unpack() : null);
|
||||
}
|
||||
}
|
||||
|
||||
export class TileUpdateWrapperT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public update: TileUpdateT|null = null
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const update = (this.update !== null ? this.update!.pack(builder) : 0);
|
||||
|
||||
return TileUpdateWrapper.createTileUpdateWrapper(builder,
|
||||
update
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,141 +2,157 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { TileRef } from "../game-updates/tile-ref.js";
|
||||
|
||||
export class TileUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
export class TileUpdate implements flatbuffers.IUnpackableObject<TileUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): TileUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsTileUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: TileUpdate,
|
||||
): TileUpdate {
|
||||
return (obj || new TileUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsTileUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: TileUpdate,
|
||||
): TileUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new TileUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
tileRef(obj?: TileRef): TileRef | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset
|
||||
? (obj || new TileRef()).__init(
|
||||
this.bb!.__indirect(this.bb_pos + offset),
|
||||
this.bb!,
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
||||
ownerId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
|
||||
}
|
||||
|
||||
troops(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
gold(): bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt("0");
|
||||
}
|
||||
|
||||
isCity(): boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
isCapital(): boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 14);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
hasTrainStation(): boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 16);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
static startTileUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(7);
|
||||
}
|
||||
|
||||
static addTileRef(
|
||||
builder: flatbuffers.Builder,
|
||||
tileRefOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(0, tileRefOffset, 0);
|
||||
}
|
||||
|
||||
static addOwnerId(builder: flatbuffers.Builder, ownerId: number) {
|
||||
builder.addFieldInt32(1, ownerId, -1);
|
||||
}
|
||||
|
||||
static addTroops(builder: flatbuffers.Builder, troops: number) {
|
||||
builder.addFieldInt32(2, troops, 0);
|
||||
}
|
||||
|
||||
static addGold(builder: flatbuffers.Builder, gold: bigint) {
|
||||
builder.addFieldInt64(3, gold, BigInt("0"));
|
||||
}
|
||||
|
||||
static addIsCity(builder: flatbuffers.Builder, isCity: boolean) {
|
||||
builder.addFieldInt8(4, +isCity, +false);
|
||||
}
|
||||
|
||||
static addIsCapital(builder: flatbuffers.Builder, isCapital: boolean) {
|
||||
builder.addFieldInt8(5, +isCapital, +false);
|
||||
}
|
||||
|
||||
static addHasTrainStation(
|
||||
builder: flatbuffers.Builder,
|
||||
hasTrainStation: boolean,
|
||||
) {
|
||||
builder.addFieldInt8(6, +hasTrainStation, +false);
|
||||
}
|
||||
|
||||
static endTileUpdate(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createTileUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
tileRefOffset: flatbuffers.Offset,
|
||||
ownerId: number,
|
||||
troops: number,
|
||||
gold: bigint,
|
||||
isCity: boolean,
|
||||
isCapital: boolean,
|
||||
hasTrainStation: boolean,
|
||||
): flatbuffers.Offset {
|
||||
TileUpdate.startTileUpdate(builder);
|
||||
TileUpdate.addTileRef(builder, tileRefOffset);
|
||||
TileUpdate.addOwnerId(builder, ownerId);
|
||||
TileUpdate.addTroops(builder, troops);
|
||||
TileUpdate.addGold(builder, gold);
|
||||
TileUpdate.addIsCity(builder, isCity);
|
||||
TileUpdate.addIsCapital(builder, isCapital);
|
||||
TileUpdate.addHasTrainStation(builder, hasTrainStation);
|
||||
return TileUpdate.endTileUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):TileUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsTileUpdate(bb:flatbuffers.ByteBuffer, obj?:TileUpdate):TileUpdate {
|
||||
return (obj || new TileUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsTileUpdate(bb:flatbuffers.ByteBuffer, obj?:TileUpdate):TileUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new TileUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
tileRef():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
|
||||
}
|
||||
|
||||
ownerId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
|
||||
}
|
||||
|
||||
troops():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
gold():bigint {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
|
||||
}
|
||||
|
||||
isCity():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
isCapital():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 14);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
hasTrainStation():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 16);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
static startTileUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(7);
|
||||
}
|
||||
|
||||
static addTileRef(builder:flatbuffers.Builder, tileRef:number) {
|
||||
builder.addFieldFloat64(0, tileRef, 0.0);
|
||||
}
|
||||
|
||||
static addOwnerId(builder:flatbuffers.Builder, ownerId:number) {
|
||||
builder.addFieldInt32(1, ownerId, -1);
|
||||
}
|
||||
|
||||
static addTroops(builder:flatbuffers.Builder, troops:number) {
|
||||
builder.addFieldInt32(2, troops, 0);
|
||||
}
|
||||
|
||||
static addGold(builder:flatbuffers.Builder, gold:bigint) {
|
||||
builder.addFieldInt64(3, gold, BigInt('0'));
|
||||
}
|
||||
|
||||
static addIsCity(builder:flatbuffers.Builder, isCity:boolean) {
|
||||
builder.addFieldInt8(4, +isCity, +false);
|
||||
}
|
||||
|
||||
static addIsCapital(builder:flatbuffers.Builder, isCapital:boolean) {
|
||||
builder.addFieldInt8(5, +isCapital, +false);
|
||||
}
|
||||
|
||||
static addHasTrainStation(builder:flatbuffers.Builder, hasTrainStation:boolean) {
|
||||
builder.addFieldInt8(6, +hasTrainStation, +false);
|
||||
}
|
||||
|
||||
static endTileUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createTileUpdate(builder:flatbuffers.Builder, tileRef:number, ownerId:number, troops:number, gold:bigint, isCity:boolean, isCapital:boolean, hasTrainStation:boolean):flatbuffers.Offset {
|
||||
TileUpdate.startTileUpdate(builder);
|
||||
TileUpdate.addTileRef(builder, tileRef);
|
||||
TileUpdate.addOwnerId(builder, ownerId);
|
||||
TileUpdate.addTroops(builder, troops);
|
||||
TileUpdate.addGold(builder, gold);
|
||||
TileUpdate.addIsCity(builder, isCity);
|
||||
TileUpdate.addIsCapital(builder, isCapital);
|
||||
TileUpdate.addHasTrainStation(builder, hasTrainStation);
|
||||
return TileUpdate.endTileUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): TileUpdateT {
|
||||
return new TileUpdateT(
|
||||
this.tileRef(),
|
||||
this.ownerId(),
|
||||
this.troops(),
|
||||
this.gold(),
|
||||
this.isCity(),
|
||||
this.isCapital(),
|
||||
this.hasTrainStation()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: TileUpdateT): void {
|
||||
_o.tileRef = this.tileRef();
|
||||
_o.ownerId = this.ownerId();
|
||||
_o.troops = this.troops();
|
||||
_o.gold = this.gold();
|
||||
_o.isCity = this.isCity();
|
||||
_o.isCapital = this.isCapital();
|
||||
_o.hasTrainStation = this.hasTrainStation();
|
||||
}
|
||||
}
|
||||
|
||||
export class TileUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public tileRef: number = 0.0,
|
||||
public ownerId: number = -1,
|
||||
public troops: number = 0,
|
||||
public gold: bigint = BigInt('0'),
|
||||
public isCity: boolean = false,
|
||||
public isCapital: boolean = false,
|
||||
public hasTrainStation: boolean = false
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return TileUpdate.createTileUpdate(builder,
|
||||
this.tileRef,
|
||||
this.ownerId,
|
||||
this.troops,
|
||||
this.gold,
|
||||
this.isCity,
|
||||
this.isCapital,
|
||||
this.hasTrainStation
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
|
||||
export enum TrainType {
|
||||
Passenger = 0,
|
||||
Freight = 1,
|
||||
Freight = 1
|
||||
}
|
||||
|
||||
@@ -2,109 +2,122 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { MessageType } from "../game-updates/message-type.js";
|
||||
|
||||
export class UnitIncomingUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
export class UnitIncomingUpdate implements flatbuffers.IUnpackableObject<UnitIncomingUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): UnitIncomingUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsUnitIncomingUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: UnitIncomingUpdate,
|
||||
): UnitIncomingUpdate {
|
||||
return (obj || new UnitIncomingUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsUnitIncomingUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: UnitIncomingUpdate,
|
||||
): UnitIncomingUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new UnitIncomingUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
unitId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
message(): string | null;
|
||||
message(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
message(optionalEncoding?: any): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset
|
||||
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
||||
: null;
|
||||
}
|
||||
|
||||
messageType(): MessageType {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt8(this.bb_pos + offset) : MessageType.Info;
|
||||
}
|
||||
|
||||
playerId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startUnitIncomingUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(4);
|
||||
}
|
||||
|
||||
static addUnitId(builder: flatbuffers.Builder, unitId: number) {
|
||||
builder.addFieldInt32(0, unitId, 0);
|
||||
}
|
||||
|
||||
static addMessage(
|
||||
builder: flatbuffers.Builder,
|
||||
messageOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(1, messageOffset, 0);
|
||||
}
|
||||
|
||||
static addMessageType(
|
||||
builder: flatbuffers.Builder,
|
||||
messageType: MessageType,
|
||||
) {
|
||||
builder.addFieldInt8(2, messageType, MessageType.Info);
|
||||
}
|
||||
|
||||
static addPlayerId(builder: flatbuffers.Builder, playerId: number) {
|
||||
builder.addFieldInt32(3, playerId, 0);
|
||||
}
|
||||
|
||||
static endUnitIncomingUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createUnitIncomingUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
unitId: number,
|
||||
messageOffset: flatbuffers.Offset,
|
||||
messageType: MessageType,
|
||||
playerId: number,
|
||||
): flatbuffers.Offset {
|
||||
UnitIncomingUpdate.startUnitIncomingUpdate(builder);
|
||||
UnitIncomingUpdate.addUnitId(builder, unitId);
|
||||
UnitIncomingUpdate.addMessage(builder, messageOffset);
|
||||
UnitIncomingUpdate.addMessageType(builder, messageType);
|
||||
UnitIncomingUpdate.addPlayerId(builder, playerId);
|
||||
return UnitIncomingUpdate.endUnitIncomingUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):UnitIncomingUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsUnitIncomingUpdate(bb:flatbuffers.ByteBuffer, obj?:UnitIncomingUpdate):UnitIncomingUpdate {
|
||||
return (obj || new UnitIncomingUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsUnitIncomingUpdate(bb:flatbuffers.ByteBuffer, obj?:UnitIncomingUpdate):UnitIncomingUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new UnitIncomingUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
unitId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
message():string|null
|
||||
message(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
message(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
messageType():string|null
|
||||
messageType(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
messageType(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
playerId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
static startUnitIncomingUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(4);
|
||||
}
|
||||
|
||||
static addUnitId(builder:flatbuffers.Builder, unitId:number) {
|
||||
builder.addFieldInt32(0, unitId, 0);
|
||||
}
|
||||
|
||||
static addMessage(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(1, messageOffset, 0);
|
||||
}
|
||||
|
||||
static addMessageType(builder:flatbuffers.Builder, messageTypeOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(2, messageTypeOffset, 0);
|
||||
}
|
||||
|
||||
static addPlayerId(builder:flatbuffers.Builder, playerId:number) {
|
||||
builder.addFieldInt32(3, playerId, 0);
|
||||
}
|
||||
|
||||
static endUnitIncomingUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createUnitIncomingUpdate(builder:flatbuffers.Builder, unitId:number, messageOffset:flatbuffers.Offset, messageTypeOffset:flatbuffers.Offset, playerId:number):flatbuffers.Offset {
|
||||
UnitIncomingUpdate.startUnitIncomingUpdate(builder);
|
||||
UnitIncomingUpdate.addUnitId(builder, unitId);
|
||||
UnitIncomingUpdate.addMessage(builder, messageOffset);
|
||||
UnitIncomingUpdate.addMessageType(builder, messageTypeOffset);
|
||||
UnitIncomingUpdate.addPlayerId(builder, playerId);
|
||||
return UnitIncomingUpdate.endUnitIncomingUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): UnitIncomingUpdateT {
|
||||
return new UnitIncomingUpdateT(
|
||||
this.unitId(),
|
||||
this.message(),
|
||||
this.messageType(),
|
||||
this.playerId()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: UnitIncomingUpdateT): void {
|
||||
_o.unitId = this.unitId();
|
||||
_o.message = this.message();
|
||||
_o.messageType = this.messageType();
|
||||
_o.playerId = this.playerId();
|
||||
}
|
||||
}
|
||||
|
||||
export class UnitIncomingUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public unitId: number = 0,
|
||||
public message: string|Uint8Array|null = null,
|
||||
public messageType: string|Uint8Array|null = null,
|
||||
public playerId: number = 0
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const message = (this.message !== null ? builder.createString(this.message!) : 0);
|
||||
const messageType = (this.messageType !== null ? builder.createString(this.messageType!) : 0);
|
||||
|
||||
return UnitIncomingUpdate.createUnitIncomingUpdate(builder,
|
||||
this.unitId,
|
||||
message,
|
||||
messageType,
|
||||
this.playerId
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ export enum UnitType {
|
||||
Ship = 2,
|
||||
Plane = 3,
|
||||
Nuke = 4,
|
||||
Train = 5,
|
||||
Train = 5
|
||||
}
|
||||
|
||||
@@ -2,322 +2,386 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { TileRef } from "../game-updates/tile-ref.js";
|
||||
import { TrainType } from "../game-updates/train-type.js";
|
||||
import { UnitType } from "../game-updates/unit-type.js";
|
||||
import { TrainType } from '../game-updates/train-type.js';
|
||||
|
||||
export class UnitUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
export class UnitUpdate implements flatbuffers.IUnpackableObject<UnitUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): UnitUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsUnitUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: UnitUpdate,
|
||||
): UnitUpdate {
|
||||
return (obj || new UnitUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsUnitUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: UnitUpdate,
|
||||
): UnitUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new UnitUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
unitType(): UnitType {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.readInt8(this.bb_pos + offset) : UnitType.Infantry;
|
||||
}
|
||||
|
||||
troops(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
id(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
ownerId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
lastOwnerId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
|
||||
}
|
||||
|
||||
pos(obj?: TileRef): TileRef | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 14);
|
||||
return offset
|
||||
? (obj || new TileRef()).__init(
|
||||
this.bb!.__indirect(this.bb_pos + offset),
|
||||
this.bb!,
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
||||
lastPos(obj?: TileRef): TileRef | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 16);
|
||||
return offset
|
||||
? (obj || new TileRef()).__init(
|
||||
this.bb!.__indirect(this.bb_pos + offset),
|
||||
this.bb!,
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
||||
isActive(): boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 18);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
reachedTarget(): boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 20);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
retreating(): boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 22);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
targetable(): boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 24);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
markedForDeletion(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 26);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
|
||||
}
|
||||
|
||||
targetUnitId(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 28);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
|
||||
}
|
||||
|
||||
targetTile(obj?: TileRef): TileRef | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 30);
|
||||
return offset
|
||||
? (obj || new TileRef()).__init(
|
||||
this.bb!.__indirect(this.bb_pos + offset),
|
||||
this.bb!,
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
||||
health(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 32);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 100;
|
||||
}
|
||||
|
||||
underConstruction(): boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 34);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
missileTimerQueue(index: number): number | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 36);
|
||||
return offset
|
||||
? this.bb!.readInt32(this.bb!.__vector(this.bb_pos + offset) + index * 4)
|
||||
: 0;
|
||||
}
|
||||
|
||||
missileTimerQueueLength(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 36);
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
missileTimerQueueArray(): Int32Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 36);
|
||||
return offset
|
||||
? new Int32Array(
|
||||
this.bb!.bytes().buffer,
|
||||
this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset),
|
||||
this.bb!.__vector_len(this.bb_pos + offset),
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
||||
level(): number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 38);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 1;
|
||||
}
|
||||
|
||||
hasTrainStation(): boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 40);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
trainType(): TrainType {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 42);
|
||||
return offset
|
||||
? this.bb!.readInt8(this.bb_pos + offset)
|
||||
: TrainType.Passenger;
|
||||
}
|
||||
|
||||
loaded(): boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 44);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
static startUnitUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(21);
|
||||
}
|
||||
|
||||
static addUnitType(builder: flatbuffers.Builder, unitType: UnitType) {
|
||||
builder.addFieldInt8(0, unitType, UnitType.Infantry);
|
||||
}
|
||||
|
||||
static addTroops(builder: flatbuffers.Builder, troops: number) {
|
||||
builder.addFieldInt32(1, troops, 0);
|
||||
}
|
||||
|
||||
static addId(builder: flatbuffers.Builder, id: number) {
|
||||
builder.addFieldInt32(2, id, 0);
|
||||
}
|
||||
|
||||
static addOwnerId(builder: flatbuffers.Builder, ownerId: number) {
|
||||
builder.addFieldInt32(3, ownerId, 0);
|
||||
}
|
||||
|
||||
static addLastOwnerId(builder: flatbuffers.Builder, lastOwnerId: number) {
|
||||
builder.addFieldInt32(4, lastOwnerId, -1);
|
||||
}
|
||||
|
||||
static addPos(builder: flatbuffers.Builder, posOffset: flatbuffers.Offset) {
|
||||
builder.addFieldOffset(5, posOffset, 0);
|
||||
}
|
||||
|
||||
static addLastPos(
|
||||
builder: flatbuffers.Builder,
|
||||
lastPosOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(6, lastPosOffset, 0);
|
||||
}
|
||||
|
||||
static addIsActive(builder: flatbuffers.Builder, isActive: boolean) {
|
||||
builder.addFieldInt8(7, +isActive, +false);
|
||||
}
|
||||
|
||||
static addReachedTarget(
|
||||
builder: flatbuffers.Builder,
|
||||
reachedTarget: boolean,
|
||||
) {
|
||||
builder.addFieldInt8(8, +reachedTarget, +false);
|
||||
}
|
||||
|
||||
static addRetreating(builder: flatbuffers.Builder, retreating: boolean) {
|
||||
builder.addFieldInt8(9, +retreating, +false);
|
||||
}
|
||||
|
||||
static addTargetable(builder: flatbuffers.Builder, targetable: boolean) {
|
||||
builder.addFieldInt8(10, +targetable, +false);
|
||||
}
|
||||
|
||||
static addMarkedForDeletion(
|
||||
builder: flatbuffers.Builder,
|
||||
markedForDeletion: number,
|
||||
) {
|
||||
builder.addFieldInt32(11, markedForDeletion, -1);
|
||||
}
|
||||
|
||||
static addTargetUnitId(builder: flatbuffers.Builder, targetUnitId: number) {
|
||||
builder.addFieldInt32(12, targetUnitId, -1);
|
||||
}
|
||||
|
||||
static addTargetTile(
|
||||
builder: flatbuffers.Builder,
|
||||
targetTileOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(13, targetTileOffset, 0);
|
||||
}
|
||||
|
||||
static addHealth(builder: flatbuffers.Builder, health: number) {
|
||||
builder.addFieldInt32(14, health, 100);
|
||||
}
|
||||
|
||||
static addUnderConstruction(
|
||||
builder: flatbuffers.Builder,
|
||||
underConstruction: boolean,
|
||||
) {
|
||||
builder.addFieldInt8(15, +underConstruction, +false);
|
||||
}
|
||||
|
||||
static addMissileTimerQueue(
|
||||
builder: flatbuffers.Builder,
|
||||
missileTimerQueueOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(16, missileTimerQueueOffset, 0);
|
||||
}
|
||||
|
||||
static createMissileTimerQueueVector(
|
||||
builder: flatbuffers.Builder,
|
||||
data: number[] | Int32Array,
|
||||
): flatbuffers.Offset;
|
||||
/**
|
||||
* @deprecated This Uint8Array overload will be removed in the future.
|
||||
*/
|
||||
static createMissileTimerQueueVector(
|
||||
builder: flatbuffers.Builder,
|
||||
data: number[] | Uint8Array,
|
||||
): flatbuffers.Offset;
|
||||
static createMissileTimerQueueVector(
|
||||
builder: flatbuffers.Builder,
|
||||
data: number[] | Int32Array | Uint8Array,
|
||||
): flatbuffers.Offset {
|
||||
builder.startVector(4, data.length, 4);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addInt32(data[i]!);
|
||||
}
|
||||
return builder.endVector();
|
||||
}
|
||||
|
||||
static startMissileTimerQueueVector(
|
||||
builder: flatbuffers.Builder,
|
||||
numElems: number,
|
||||
) {
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
|
||||
static addLevel(builder: flatbuffers.Builder, level: number) {
|
||||
builder.addFieldInt32(17, level, 1);
|
||||
}
|
||||
|
||||
static addHasTrainStation(
|
||||
builder: flatbuffers.Builder,
|
||||
hasTrainStation: boolean,
|
||||
) {
|
||||
builder.addFieldInt8(18, +hasTrainStation, +false);
|
||||
}
|
||||
|
||||
static addTrainType(builder: flatbuffers.Builder, trainType: TrainType) {
|
||||
builder.addFieldInt8(19, trainType, TrainType.Passenger);
|
||||
}
|
||||
|
||||
static addLoaded(builder: flatbuffers.Builder, loaded: boolean) {
|
||||
builder.addFieldInt8(20, +loaded, +false);
|
||||
}
|
||||
|
||||
static endUnitUpdate(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):UnitUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsUnitUpdate(bb:flatbuffers.ByteBuffer, obj?:UnitUpdate):UnitUpdate {
|
||||
return (obj || new UnitUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsUnitUpdate(bb:flatbuffers.ByteBuffer, obj?:UnitUpdate):UnitUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new UnitUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
unitType():string|null
|
||||
unitType(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
unitType(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
troops():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
id():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
ownerId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
lastOwnerId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 12);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
|
||||
}
|
||||
|
||||
pos():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 14);
|
||||
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
|
||||
}
|
||||
|
||||
lastPos():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 16);
|
||||
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
|
||||
}
|
||||
|
||||
isActive():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 18);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
reachedTarget():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 20);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
retreating():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 22);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
targetable():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 24);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
markedForDeletion():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 26);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
|
||||
}
|
||||
|
||||
targetUnitId():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 28);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
|
||||
}
|
||||
|
||||
targetTile():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 30);
|
||||
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
|
||||
}
|
||||
|
||||
health():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 32);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 100;
|
||||
}
|
||||
|
||||
underConstruction():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 34);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
missileTimerQueue(index: number):number|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 36);
|
||||
return offset ? this.bb!.readInt32(this.bb!.__vector(this.bb_pos + offset) + index * 4) : 0;
|
||||
}
|
||||
|
||||
missileTimerQueueLength():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 36);
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
}
|
||||
|
||||
missileTimerQueueArray():Int32Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 36);
|
||||
return offset ? new Int32Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
|
||||
}
|
||||
|
||||
level():number {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 38);
|
||||
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 1;
|
||||
}
|
||||
|
||||
hasTrainStation():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 40);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
trainType():TrainType {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 42);
|
||||
return offset ? this.bb!.readInt8(this.bb_pos + offset) : TrainType.Passenger;
|
||||
}
|
||||
|
||||
loaded():boolean {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 44);
|
||||
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
|
||||
static startUnitUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(21);
|
||||
}
|
||||
|
||||
static addUnitType(builder:flatbuffers.Builder, unitTypeOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, unitTypeOffset, 0);
|
||||
}
|
||||
|
||||
static addTroops(builder:flatbuffers.Builder, troops:number) {
|
||||
builder.addFieldInt32(1, troops, 0);
|
||||
}
|
||||
|
||||
static addId(builder:flatbuffers.Builder, id:number) {
|
||||
builder.addFieldInt32(2, id, 0);
|
||||
}
|
||||
|
||||
static addOwnerId(builder:flatbuffers.Builder, ownerId:number) {
|
||||
builder.addFieldInt32(3, ownerId, 0);
|
||||
}
|
||||
|
||||
static addLastOwnerId(builder:flatbuffers.Builder, lastOwnerId:number) {
|
||||
builder.addFieldInt32(4, lastOwnerId, -1);
|
||||
}
|
||||
|
||||
static addPos(builder:flatbuffers.Builder, pos:number) {
|
||||
builder.addFieldFloat64(5, pos, 0.0);
|
||||
}
|
||||
|
||||
static addLastPos(builder:flatbuffers.Builder, lastPos:number) {
|
||||
builder.addFieldFloat64(6, lastPos, 0.0);
|
||||
}
|
||||
|
||||
static addIsActive(builder:flatbuffers.Builder, isActive:boolean) {
|
||||
builder.addFieldInt8(7, +isActive, +false);
|
||||
}
|
||||
|
||||
static addReachedTarget(builder:flatbuffers.Builder, reachedTarget:boolean) {
|
||||
builder.addFieldInt8(8, +reachedTarget, +false);
|
||||
}
|
||||
|
||||
static addRetreating(builder:flatbuffers.Builder, retreating:boolean) {
|
||||
builder.addFieldInt8(9, +retreating, +false);
|
||||
}
|
||||
|
||||
static addTargetable(builder:flatbuffers.Builder, targetable:boolean) {
|
||||
builder.addFieldInt8(10, +targetable, +false);
|
||||
}
|
||||
|
||||
static addMarkedForDeletion(builder:flatbuffers.Builder, markedForDeletion:number) {
|
||||
builder.addFieldInt32(11, markedForDeletion, -1);
|
||||
}
|
||||
|
||||
static addTargetUnitId(builder:flatbuffers.Builder, targetUnitId:number) {
|
||||
builder.addFieldInt32(12, targetUnitId, -1);
|
||||
}
|
||||
|
||||
static addTargetTile(builder:flatbuffers.Builder, targetTile:number) {
|
||||
builder.addFieldFloat64(13, targetTile, 0.0);
|
||||
}
|
||||
|
||||
static addHealth(builder:flatbuffers.Builder, health:number) {
|
||||
builder.addFieldInt32(14, health, 100);
|
||||
}
|
||||
|
||||
static addUnderConstruction(builder:flatbuffers.Builder, underConstruction:boolean) {
|
||||
builder.addFieldInt8(15, +underConstruction, +false);
|
||||
}
|
||||
|
||||
static addMissileTimerQueue(builder:flatbuffers.Builder, missileTimerQueueOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(16, missileTimerQueueOffset, 0);
|
||||
}
|
||||
|
||||
static createMissileTimerQueueVector(builder:flatbuffers.Builder, data:number[]|Int32Array):flatbuffers.Offset;
|
||||
/**
|
||||
* @deprecated This Uint8Array overload will be removed in the future.
|
||||
*/
|
||||
static createMissileTimerQueueVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset;
|
||||
static createMissileTimerQueueVector(builder:flatbuffers.Builder, data:number[]|Int32Array|Uint8Array):flatbuffers.Offset {
|
||||
builder.startVector(4, data.length, 4);
|
||||
for (let i = data.length - 1; i >= 0; i--) {
|
||||
builder.addInt32(data[i]!);
|
||||
}
|
||||
return builder.endVector();
|
||||
}
|
||||
|
||||
static startMissileTimerQueueVector(builder:flatbuffers.Builder, numElems:number) {
|
||||
builder.startVector(4, numElems, 4);
|
||||
}
|
||||
|
||||
static addLevel(builder:flatbuffers.Builder, level:number) {
|
||||
builder.addFieldInt32(17, level, 1);
|
||||
}
|
||||
|
||||
static addHasTrainStation(builder:flatbuffers.Builder, hasTrainStation:boolean) {
|
||||
builder.addFieldInt8(18, +hasTrainStation, +false);
|
||||
}
|
||||
|
||||
static addTrainType(builder:flatbuffers.Builder, trainType:TrainType) {
|
||||
builder.addFieldInt8(19, trainType, TrainType.Passenger);
|
||||
}
|
||||
|
||||
static addLoaded(builder:flatbuffers.Builder, loaded:boolean) {
|
||||
builder.addFieldInt8(20, +loaded, +false);
|
||||
}
|
||||
|
||||
static endUnitUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createUnitUpdate(builder:flatbuffers.Builder, unitTypeOffset:flatbuffers.Offset, troops:number, id:number, ownerId:number, lastOwnerId:number, pos:number, lastPos:number, isActive:boolean, reachedTarget:boolean, retreating:boolean, targetable:boolean, markedForDeletion:number, targetUnitId:number, targetTile:number, health:number, underConstruction:boolean, missileTimerQueueOffset:flatbuffers.Offset, level:number, hasTrainStation:boolean, trainType:TrainType, loaded:boolean):flatbuffers.Offset {
|
||||
UnitUpdate.startUnitUpdate(builder);
|
||||
UnitUpdate.addUnitType(builder, unitTypeOffset);
|
||||
UnitUpdate.addTroops(builder, troops);
|
||||
UnitUpdate.addId(builder, id);
|
||||
UnitUpdate.addOwnerId(builder, ownerId);
|
||||
UnitUpdate.addLastOwnerId(builder, lastOwnerId);
|
||||
UnitUpdate.addPos(builder, pos);
|
||||
UnitUpdate.addLastPos(builder, lastPos);
|
||||
UnitUpdate.addIsActive(builder, isActive);
|
||||
UnitUpdate.addReachedTarget(builder, reachedTarget);
|
||||
UnitUpdate.addRetreating(builder, retreating);
|
||||
UnitUpdate.addTargetable(builder, targetable);
|
||||
UnitUpdate.addMarkedForDeletion(builder, markedForDeletion);
|
||||
UnitUpdate.addTargetUnitId(builder, targetUnitId);
|
||||
UnitUpdate.addTargetTile(builder, targetTile);
|
||||
UnitUpdate.addHealth(builder, health);
|
||||
UnitUpdate.addUnderConstruction(builder, underConstruction);
|
||||
UnitUpdate.addMissileTimerQueue(builder, missileTimerQueueOffset);
|
||||
UnitUpdate.addLevel(builder, level);
|
||||
UnitUpdate.addHasTrainStation(builder, hasTrainStation);
|
||||
UnitUpdate.addTrainType(builder, trainType);
|
||||
UnitUpdate.addLoaded(builder, loaded);
|
||||
return UnitUpdate.endUnitUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): UnitUpdateT {
|
||||
return new UnitUpdateT(
|
||||
this.unitType(),
|
||||
this.troops(),
|
||||
this.id(),
|
||||
this.ownerId(),
|
||||
this.lastOwnerId(),
|
||||
this.pos(),
|
||||
this.lastPos(),
|
||||
this.isActive(),
|
||||
this.reachedTarget(),
|
||||
this.retreating(),
|
||||
this.targetable(),
|
||||
this.markedForDeletion(),
|
||||
this.targetUnitId(),
|
||||
this.targetTile(),
|
||||
this.health(),
|
||||
this.underConstruction(),
|
||||
this.bb!.createScalarList<number>(this.missileTimerQueue.bind(this), this.missileTimerQueueLength()),
|
||||
this.level(),
|
||||
this.hasTrainStation(),
|
||||
this.trainType(),
|
||||
this.loaded()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: UnitUpdateT): void {
|
||||
_o.unitType = this.unitType();
|
||||
_o.troops = this.troops();
|
||||
_o.id = this.id();
|
||||
_o.ownerId = this.ownerId();
|
||||
_o.lastOwnerId = this.lastOwnerId();
|
||||
_o.pos = this.pos();
|
||||
_o.lastPos = this.lastPos();
|
||||
_o.isActive = this.isActive();
|
||||
_o.reachedTarget = this.reachedTarget();
|
||||
_o.retreating = this.retreating();
|
||||
_o.targetable = this.targetable();
|
||||
_o.markedForDeletion = this.markedForDeletion();
|
||||
_o.targetUnitId = this.targetUnitId();
|
||||
_o.targetTile = this.targetTile();
|
||||
_o.health = this.health();
|
||||
_o.underConstruction = this.underConstruction();
|
||||
_o.missileTimerQueue = this.bb!.createScalarList<number>(this.missileTimerQueue.bind(this), this.missileTimerQueueLength());
|
||||
_o.level = this.level();
|
||||
_o.hasTrainStation = this.hasTrainStation();
|
||||
_o.trainType = this.trainType();
|
||||
_o.loaded = this.loaded();
|
||||
}
|
||||
}
|
||||
|
||||
export class UnitUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public unitType: string|Uint8Array|null = null,
|
||||
public troops: number = 0,
|
||||
public id: number = 0,
|
||||
public ownerId: number = 0,
|
||||
public lastOwnerId: number = -1,
|
||||
public pos: number = 0.0,
|
||||
public lastPos: number = 0.0,
|
||||
public isActive: boolean = false,
|
||||
public reachedTarget: boolean = false,
|
||||
public retreating: boolean = false,
|
||||
public targetable: boolean = false,
|
||||
public markedForDeletion: number = -1,
|
||||
public targetUnitId: number = -1,
|
||||
public targetTile: number = 0.0,
|
||||
public health: number = 100,
|
||||
public underConstruction: boolean = false,
|
||||
public missileTimerQueue: (number)[] = [],
|
||||
public level: number = 1,
|
||||
public hasTrainStation: boolean = false,
|
||||
public trainType: TrainType = TrainType.Passenger,
|
||||
public loaded: boolean = false
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const unitType = (this.unitType !== null ? builder.createString(this.unitType!) : 0);
|
||||
const missileTimerQueue = UnitUpdate.createMissileTimerQueueVector(builder, this.missileTimerQueue);
|
||||
|
||||
return UnitUpdate.createUnitUpdate(builder,
|
||||
unitType,
|
||||
this.troops,
|
||||
this.id,
|
||||
this.ownerId,
|
||||
this.lastOwnerId,
|
||||
this.pos,
|
||||
this.lastPos,
|
||||
this.isActive,
|
||||
this.reachedTarget,
|
||||
this.retreating,
|
||||
this.targetable,
|
||||
this.markedForDeletion,
|
||||
this.targetUnitId,
|
||||
this.targetTile,
|
||||
this.health,
|
||||
this.underConstruction,
|
||||
missileTimerQueue,
|
||||
this.level,
|
||||
this.hasTrainStation,
|
||||
this.trainType,
|
||||
this.loaded
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,89 +2,94 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class WinUpdate {
|
||||
bb: flatbuffers.ByteBuffer | null = null;
|
||||
|
||||
|
||||
export class WinUpdate implements flatbuffers.IUnpackableObject<WinUpdateT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): WinUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsWinUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: WinUpdate,
|
||||
): WinUpdate {
|
||||
return (obj || new WinUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsWinUpdate(
|
||||
bb: flatbuffers.ByteBuffer,
|
||||
obj?: WinUpdate,
|
||||
): WinUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new WinUpdate()).__init(
|
||||
bb.readInt32(bb.position()) + bb.position(),
|
||||
bb,
|
||||
);
|
||||
}
|
||||
|
||||
allPlayersStats(): string | null;
|
||||
allPlayersStats(
|
||||
optionalEncoding: flatbuffers.Encoding,
|
||||
): string | Uint8Array | null;
|
||||
allPlayersStats(optionalEncoding?: any): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset
|
||||
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
||||
: null;
|
||||
}
|
||||
|
||||
winner(): string | null;
|
||||
winner(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
winner(optionalEncoding?: any): string | Uint8Array | null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset
|
||||
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
||||
: null;
|
||||
}
|
||||
|
||||
static startWinUpdate(builder: flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addAllPlayersStats(
|
||||
builder: flatbuffers.Builder,
|
||||
allPlayersStatsOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(0, allPlayersStatsOffset, 0);
|
||||
}
|
||||
|
||||
static addWinner(
|
||||
builder: flatbuffers.Builder,
|
||||
winnerOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldOffset(1, winnerOffset, 0);
|
||||
}
|
||||
|
||||
static endWinUpdate(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createWinUpdate(
|
||||
builder: flatbuffers.Builder,
|
||||
allPlayersStatsOffset: flatbuffers.Offset,
|
||||
winnerOffset: flatbuffers.Offset,
|
||||
): flatbuffers.Offset {
|
||||
WinUpdate.startWinUpdate(builder);
|
||||
WinUpdate.addAllPlayersStats(builder, allPlayersStatsOffset);
|
||||
WinUpdate.addWinner(builder, winnerOffset);
|
||||
return WinUpdate.endWinUpdate(builder);
|
||||
}
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):WinUpdate {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsWinUpdate(bb:flatbuffers.ByteBuffer, obj?:WinUpdate):WinUpdate {
|
||||
return (obj || new WinUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsWinUpdate(bb:flatbuffers.ByteBuffer, obj?:WinUpdate):WinUpdate {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new WinUpdate()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
allPlayersStats():string|null
|
||||
allPlayersStats(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
allPlayersStats(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
winner():string|null
|
||||
winner(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
winner(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
static startWinUpdate(builder:flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addAllPlayersStats(builder:flatbuffers.Builder, allPlayersStatsOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, allPlayersStatsOffset, 0);
|
||||
}
|
||||
|
||||
static addWinner(builder:flatbuffers.Builder, winnerOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(1, winnerOffset, 0);
|
||||
}
|
||||
|
||||
static endWinUpdate(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static createWinUpdate(builder:flatbuffers.Builder, allPlayersStatsOffset:flatbuffers.Offset, winnerOffset:flatbuffers.Offset):flatbuffers.Offset {
|
||||
WinUpdate.startWinUpdate(builder);
|
||||
WinUpdate.addAllPlayersStats(builder, allPlayersStatsOffset);
|
||||
WinUpdate.addWinner(builder, winnerOffset);
|
||||
return WinUpdate.endWinUpdate(builder);
|
||||
}
|
||||
|
||||
unpack(): WinUpdateT {
|
||||
return new WinUpdateT(
|
||||
this.allPlayersStats(),
|
||||
this.winner()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: WinUpdateT): void {
|
||||
_o.allPlayersStats = this.allPlayersStats();
|
||||
_o.winner = this.winner();
|
||||
}
|
||||
}
|
||||
|
||||
export class WinUpdateT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public allPlayersStats: string|Uint8Array|null = null,
|
||||
public winner: string|Uint8Array|null = null
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const allPlayersStats = (this.allPlayersStats !== null ? builder.createString(this.allPlayersStats!) : 0);
|
||||
const winner = (this.winner !== null ? builder.createString(this.winner!) : 0);
|
||||
|
||||
return WinUpdate.createWinUpdate(builder,
|
||||
allPlayersStats,
|
||||
winner
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user