/** * This code was AUTOGENERATED using the Codama library. * Please DO NOT EDIT THIS FILE, instead use visitors * to add features, then rerun Codama to update it. * * @see https://github.com/codama-idl/codama */ import { combineCodec, getStructDecoder, getStructEncoder, getU16Decoder, getU16Encoder, getU32Decoder, getU32Encoder, type Codec, type Decoder, type Encoder, } from '@solana/kit'; import { getU16F16Decoder, getU16F16Encoder, getU26F6Decoder, getU26F6Encoder, getU8F8Decoder, getU8F8Encoder, type U16F16, type U16F16Args, type U26F6, type U26F6Args, type U8F8, type U8F8Args, } from '../../fixed/codecs'; /** A ship's movement stats */ export type MovementStats = { /** the amount of distance that the ship can cover in one second while sub-warping */ subwarpSpeed: U16F16; /** the amount of distance that the ship can cover in one second while warping */ warpSpeed: U16F16; /** the amount of distance that the ship can cover in one second while warping */ warpLaneSpeed: U16F16; /** the max distance that the ship can warp */ maxWarpDistance: U8F8; /** the time it takes the ship to be able to warp again after a warp */ warpCoolDown: number; /** the amount of fuel consumed by the ship when sub-warp moving */ subwarpFuelConsumptionRate: U26F6; /** the amount of fuel consumed by the ship when warp moving */ warpFuelConsumptionRate: U26F6; /** the amount of fuel required to exit a planet */ planetExitFuelAmount: number; /** the amount of XP earned for each AU of warp distance */ warpXpRate: U16F16; /** the amount of XP earned for each AU of subwarp distance */ subwarpXpRate: U16F16; }; export type MovementStatsArgs = { /** the amount of distance that the ship can cover in one second while sub-warping */ subwarpSpeed: U16F16Args; /** the amount of distance that the ship can cover in one second while warping */ warpSpeed: U16F16Args; /** the amount of distance that the ship can cover in one second while warping */ warpLaneSpeed: U16F16Args; /** the max distance that the ship can warp */ maxWarpDistance: U8F8Args; /** the time it takes the ship to be able to warp again after a warp */ warpCoolDown: number; /** the amount of fuel consumed by the ship when sub-warp moving */ subwarpFuelConsumptionRate: U26F6Args; /** the amount of fuel consumed by the ship when warp moving */ warpFuelConsumptionRate: U26F6Args; /** the amount of fuel required to exit a planet */ planetExitFuelAmount: number; /** the amount of XP earned for each AU of warp distance */ warpXpRate: U16F16Args; /** the amount of XP earned for each AU of subwarp distance */ subwarpXpRate: U16F16Args; }; export function getMovementStatsEncoder(): Encoder { return getStructEncoder([ ['subwarpSpeed', getU16F16Encoder()], ['warpSpeed', getU16F16Encoder()], ['warpLaneSpeed', getU16F16Encoder()], ['maxWarpDistance', getU8F8Encoder()], ['warpCoolDown', getU16Encoder()], ['subwarpFuelConsumptionRate', getU26F6Encoder()], ['warpFuelConsumptionRate', getU26F6Encoder()], ['planetExitFuelAmount', getU32Encoder()], ['warpXpRate', getU16F16Encoder()], ['subwarpXpRate', getU16F16Encoder()], ]); } export function getMovementStatsDecoder(): Decoder { return getStructDecoder([ ['subwarpSpeed', getU16F16Decoder()], ['warpSpeed', getU16F16Decoder()], ['warpLaneSpeed', getU16F16Decoder()], ['maxWarpDistance', getU8F8Decoder()], ['warpCoolDown', getU16Decoder()], ['subwarpFuelConsumptionRate', getU26F6Decoder()], ['warpFuelConsumptionRate', getU26F6Decoder()], ['planetExitFuelAmount', getU32Decoder()], ['warpXpRate', getU16F16Decoder()], ['subwarpXpRate', getU16F16Decoder()], ]); } export function getMovementStatsCodec(): Codec< MovementStatsArgs, MovementStats > { return combineCodec(getMovementStatsEncoder(), getMovementStatsDecoder()); }