/** * 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, getU64Decoder, getU64Encoder, type Codec, type Decoder, type Encoder, } from '@solana/kit'; import { getU16F16Decoder, getU16F16Encoder, getU26F6Decoder, getU26F6Encoder, type U16F16, type U16F16Args, type U26F6, type U26F6Args, } from '../../fixed/codecs'; /** Information associated with `Starbase` levels */ export type StarbaseLevelInfo = { /** The `Starbase` health points for this level. */ hp: number; /** The `Starbase` shield points for this level. */ sp: number; /** The XP value of the `Starbase` */ xpValue: U16F16; /** the time it takes the `Starbase` SP to start regenerating after getting to 0 */ shieldBreakDelay: number; /** the amount of SP regenerated per second */ shieldRechargeRate: U26F6; /** the amount of HP healed per second when repairing */ repairRate: U26F6; /** the repair ability of the `Starbase` */ repairAbility: U26F6; /** the repair efficiency of the `Starbase` */ repairEfficiency: U26F6; /** the cost multiplier for repairing the starbase */ repairCost: U26F6; /** * Fee charged for repairs done at the starbase; meant to be charged in ATLAS * Since ATLAS has 8 decimal places, units are in the smallest value of ATLAS possible. */ repairFee: bigint; /** The damage a starbase's weapon systems deal in a single combat round. */ damagePerRound: number; }; export type StarbaseLevelInfoArgs = { /** The `Starbase` health points for this level. */ hp: number; /** The `Starbase` shield points for this level. */ sp: number; /** The XP value of the `Starbase` */ xpValue: U16F16Args; /** the time it takes the `Starbase` SP to start regenerating after getting to 0 */ shieldBreakDelay: number; /** the amount of SP regenerated per second */ shieldRechargeRate: U26F6Args; /** the amount of HP healed per second when repairing */ repairRate: U26F6Args; /** the repair ability of the `Starbase` */ repairAbility: U26F6Args; /** the repair efficiency of the `Starbase` */ repairEfficiency: U26F6Args; /** the cost multiplier for repairing the starbase */ repairCost: U26F6Args; /** * Fee charged for repairs done at the starbase; meant to be charged in ATLAS * Since ATLAS has 8 decimal places, units are in the smallest value of ATLAS possible. */ repairFee: number | bigint; /** The damage a starbase's weapon systems deal in a single combat round. */ damagePerRound: number; }; export function getStarbaseLevelInfoEncoder(): Encoder { return getStructEncoder([ ['hp', getU32Encoder()], ['sp', getU32Encoder()], ['xpValue', getU16F16Encoder()], ['shieldBreakDelay', getU16Encoder()], ['shieldRechargeRate', getU26F6Encoder()], ['repairRate', getU26F6Encoder()], ['repairAbility', getU26F6Encoder()], ['repairEfficiency', getU26F6Encoder()], ['repairCost', getU26F6Encoder()], ['repairFee', getU64Encoder()], ['damagePerRound', getU32Encoder()], ]); } export function getStarbaseLevelInfoDecoder(): Decoder { return getStructDecoder([ ['hp', getU32Decoder()], ['sp', getU32Decoder()], ['xpValue', getU16F16Decoder()], ['shieldBreakDelay', getU16Decoder()], ['shieldRechargeRate', getU26F6Decoder()], ['repairRate', getU26F6Decoder()], ['repairAbility', getU26F6Decoder()], ['repairEfficiency', getU26F6Decoder()], ['repairCost', getU26F6Decoder()], ['repairFee', getU64Decoder()], ['damagePerRound', getU32Decoder()], ]); } export function getStarbaseLevelInfoCodec(): Codec< StarbaseLevelInfoArgs, StarbaseLevelInfo > { return combineCodec( getStarbaseLevelInfoEncoder(), getStarbaseLevelInfoDecoder(), ); }