/** * 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, getI16Decoder, getI16Encoder, getI64Decoder, getI64Encoder, getMapDecoder, getMapEncoder, getSetDecoder, getSetEncoder, getStructDecoder, getStructEncoder, getU16Decoder, getU16Encoder, getU32Decoder, getU32Encoder, getU64Decoder, getU64Encoder, type Codec, type Decoder, type Encoder, } from '@solana/kit'; import { getBuildingIdDecoder, getBuildingIdEncoder, getBuildingTagDecoder, getBuildingTagEncoder, getCargoIdDecoder, getCargoIdEncoder, getNameDecoder, getNameEncoder, getResearchTagDecoder, getResearchTagEncoder, getTierDecoder, getTierEncoder, type BuildingId, type BuildingIdArgs, type BuildingTag, type BuildingTagArgs, type CargoId, type CargoIdArgs, type Name, type NameArgs, type ResearchTag, type ResearchTagArgs, type Tier, type TierArgs, } from '.'; import { getI54F10Decoder, getI54F10Encoder, getU16F16Decoder, getU16F16Encoder, getU54F10Decoder, getU54F10Encoder, type I54F10, type I54F10Args, type U16F16, type U16F16Args, type U54F10, type U54F10Args, } from '../../fixed/codecs'; /** Building definition that specifies capabilities and requirements */ export type BuildingDefinition = { /** The cargo type which is used to place the building */ buildingId: BuildingId; /** Name of the building (fixed length array of 64 bytes) */ name: Name; /** Number of plot slots required */ slots: number; /** Number of crew slots provided */ crewSlots: number; /** Number of crew needed to operate */ neededCrew: number; /** Time required for construction (in seconds) */ constructionTime: bigint; /** Power consumption/generation */ power: number; /** Total resource storage capacity */ resourceStorage: bigint; /** Value when used as a hub */ hubValue: number; /** Minimum claim stake tier required for placement */ minimumTier: Tier; /** XP value of the building */ xpValue: U16F16; /** Refund amount when recycling the building */ refunds: Map; /** Cost to construct the building */ constructionCost: Map; /** Research requirements (all required) */ researchRequirements: Set; /** Resource production rates per type */ netResourceProduction: Map; /** Resource extraction rates per type */ resourceExtraction: Map; /** Building tags (must match planet or claim stake tags) */ requiredTags: Set; /** Building tags provided by the building */ providedTags: Set; }; export type BuildingDefinitionArgs = { /** The cargo type which is used to place the building */ buildingId: BuildingIdArgs; /** Name of the building (fixed length array of 64 bytes) */ name: NameArgs; /** Number of plot slots required */ slots: number; /** Number of crew slots provided */ crewSlots: number; /** Number of crew needed to operate */ neededCrew: number; /** Time required for construction (in seconds) */ constructionTime: number | bigint; /** Power consumption/generation */ power: number; /** Total resource storage capacity */ resourceStorage: number | bigint; /** Value when used as a hub */ hubValue: number; /** Minimum claim stake tier required for placement */ minimumTier: TierArgs; /** XP value of the building */ xpValue: U16F16Args; /** Refund amount when recycling the building */ refunds: Map; /** Cost to construct the building */ constructionCost: Map; /** Research requirements (all required) */ researchRequirements: Set; /** Resource production rates per type */ netResourceProduction: Map; /** Resource extraction rates per type */ resourceExtraction: Map; /** Building tags (must match planet or claim stake tags) */ requiredTags: Set; /** Building tags provided by the building */ providedTags: Set; }; export function getBuildingDefinitionEncoder(): Encoder { return getStructEncoder([ ['buildingId', getBuildingIdEncoder()], ['name', getNameEncoder()], ['slots', getU32Encoder()], ['crewSlots', getI16Encoder()], ['neededCrew', getU16Encoder()], ['constructionTime', getI64Encoder()], ['power', getI16Encoder()], ['resourceStorage', getU64Encoder()], ['hubValue', getU16Encoder()], ['minimumTier', getTierEncoder()], ['xpValue', getU16F16Encoder()], ['refunds', getMapEncoder(getCargoIdEncoder(), getU64Encoder())], ['constructionCost', getMapEncoder(getCargoIdEncoder(), getU64Encoder())], ['researchRequirements', getSetEncoder(getResearchTagEncoder())], [ 'netResourceProduction', getMapEncoder(getCargoIdEncoder(), getI54F10Encoder()), ], [ 'resourceExtraction', getMapEncoder(getCargoIdEncoder(), getU54F10Encoder()), ], ['requiredTags', getSetEncoder(getBuildingTagEncoder())], ['providedTags', getSetEncoder(getBuildingTagEncoder())], ]); } export function getBuildingDefinitionDecoder(): Decoder { return getStructDecoder([ ['buildingId', getBuildingIdDecoder()], ['name', getNameDecoder()], ['slots', getU32Decoder()], ['crewSlots', getI16Decoder()], ['neededCrew', getU16Decoder()], ['constructionTime', getI64Decoder()], ['power', getI16Decoder()], ['resourceStorage', getU64Decoder()], ['hubValue', getU16Decoder()], ['minimumTier', getTierDecoder()], ['xpValue', getU16F16Decoder()], ['refunds', getMapDecoder(getCargoIdDecoder(), getU64Decoder())], ['constructionCost', getMapDecoder(getCargoIdDecoder(), getU64Decoder())], ['researchRequirements', getSetDecoder(getResearchTagDecoder())], [ 'netResourceProduction', getMapDecoder(getCargoIdDecoder(), getI54F10Decoder()), ], [ 'resourceExtraction', getMapDecoder(getCargoIdDecoder(), getU54F10Decoder()), ], ['requiredTags', getSetDecoder(getBuildingTagDecoder())], ['providedTags', getSetDecoder(getBuildingTagDecoder())], ]); } export function getBuildingDefinitionCodec(): Codec< BuildingDefinitionArgs, BuildingDefinition > { return combineCodec( getBuildingDefinitionEncoder(), getBuildingDefinitionDecoder(), ); }