// automatically generated by the FlatBuffers compiler, do not modify

/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */

import * as flatbuffers from 'flatbuffers';



export class OthersShipClass implements flatbuffers.IUnpackableObject<OthersShipClassT> {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):OthersShipClass {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

static getRootAsOthersShipClass(bb:flatbuffers.ByteBuffer, obj?:OthersShipClass):OthersShipClass {
  return (obj || new OthersShipClass()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

static getSizePrefixedRootAsOthersShipClass(bb:flatbuffers.ByteBuffer, obj?:OthersShipClass):OthersShipClass {
  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
  return (obj || new OthersShipClass()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

race():string|null
race(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
race(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;
}

name():string|null
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
name(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;
}

drive():number {
  const offset = this.bb!.__offset(this.bb_pos, 8);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

armament():bigint {
  const offset = this.bb!.__offset(this.bb_pos, 10);
  return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
}

weapons():number {
  const offset = this.bb!.__offset(this.bb_pos, 12);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

shields():number {
  const offset = this.bb!.__offset(this.bb_pos, 14);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

cargo():number {
  const offset = this.bb!.__offset(this.bb_pos, 16);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

mass():number {
  const offset = this.bb!.__offset(this.bb_pos, 18);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

static startOthersShipClass(builder:flatbuffers.Builder) {
  builder.startObject(8);
}

static addRace(builder:flatbuffers.Builder, raceOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, raceOffset, 0);
}

static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
  builder.addFieldOffset(1, nameOffset, 0);
}

static addDrive(builder:flatbuffers.Builder, drive:number) {
  builder.addFieldFloat32(2, drive, 0.0);
}

static addArmament(builder:flatbuffers.Builder, armament:bigint) {
  builder.addFieldInt64(3, armament, BigInt('0'));
}

static addWeapons(builder:flatbuffers.Builder, weapons:number) {
  builder.addFieldFloat32(4, weapons, 0.0);
}

static addShields(builder:flatbuffers.Builder, shields:number) {
  builder.addFieldFloat32(5, shields, 0.0);
}

static addCargo(builder:flatbuffers.Builder, cargo:number) {
  builder.addFieldFloat32(6, cargo, 0.0);
}

static addMass(builder:flatbuffers.Builder, mass:number) {
  builder.addFieldFloat32(7, mass, 0.0);
}

static endOthersShipClass(builder:flatbuffers.Builder):flatbuffers.Offset {
  const offset = builder.endObject();
  return offset;
}

static createOthersShipClass(builder:flatbuffers.Builder, raceOffset:flatbuffers.Offset, nameOffset:flatbuffers.Offset, drive:number, armament:bigint, weapons:number, shields:number, cargo:number, mass:number):flatbuffers.Offset {
  OthersShipClass.startOthersShipClass(builder);
  OthersShipClass.addRace(builder, raceOffset);
  OthersShipClass.addName(builder, nameOffset);
  OthersShipClass.addDrive(builder, drive);
  OthersShipClass.addArmament(builder, armament);
  OthersShipClass.addWeapons(builder, weapons);
  OthersShipClass.addShields(builder, shields);
  OthersShipClass.addCargo(builder, cargo);
  OthersShipClass.addMass(builder, mass);
  return OthersShipClass.endOthersShipClass(builder);
}

unpack(): OthersShipClassT {
  return new OthersShipClassT(
    this.race(),
    this.name(),
    this.drive(),
    this.armament(),
    this.weapons(),
    this.shields(),
    this.cargo(),
    this.mass()
  );
}


unpackTo(_o: OthersShipClassT): void {
  _o.race = this.race();
  _o.name = this.name();
  _o.drive = this.drive();
  _o.armament = this.armament();
  _o.weapons = this.weapons();
  _o.shields = this.shields();
  _o.cargo = this.cargo();
  _o.mass = this.mass();
}
}

export class OthersShipClassT implements flatbuffers.IGeneratedObject {
constructor(
  public race: string|Uint8Array|null = null,
  public name: string|Uint8Array|null = null,
  public drive: number = 0.0,
  public armament: bigint = BigInt('0'),
  public weapons: number = 0.0,
  public shields: number = 0.0,
  public cargo: number = 0.0,
  public mass: number = 0.0
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  const race = (this.race !== null ? builder.createString(this.race!) : 0);
  const name = (this.name !== null ? builder.createString(this.name!) : 0);

  return OthersShipClass.createOthersShipClass(builder,
    race,
    name,
    this.drive,
    this.armament,
    this.weapons,
    this.shields,
    this.cargo,
    this.mass
  );
}
}
