module Rattletrap.Decode.LoadoutOnlineAttribute ( decodeLoadoutOnlineAttributeBits ) where import Rattletrap.Decode.Common import Rattletrap.Decode.ProductAttribute import Rattletrap.Decode.Word8le import Rattletrap.Type.LoadoutOnlineAttribute import Rattletrap.Type.Str import Rattletrap.Type.Word32le import Rattletrap.Type.Word8le import qualified Control.Monad as Monad import qualified Data.Map as Map decodeLoadoutOnlineAttributeBits :: (Int, Int, Int) -> Map.Map Word32le Str -> DecodeBits LoadoutOnlineAttribute decodeLoadoutOnlineAttributeBits :: (Int, Int, Int) -> Map Word32le Str -> DecodeBits LoadoutOnlineAttribute decodeLoadoutOnlineAttributeBits (Int, Int, Int) version Map Word32le Str objectMap = do Word8le size <- DecodeBits Word8le decodeWord8leBits [[ProductAttribute]] -> LoadoutOnlineAttribute LoadoutOnlineAttribute ([[ProductAttribute]] -> LoadoutOnlineAttribute) -> BitGet [[ProductAttribute]] -> DecodeBits LoadoutOnlineAttribute forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Int -> BitGet [ProductAttribute] -> BitGet [[ProductAttribute]] forall (m :: * -> *) a. Applicative m => Int -> m a -> m [a] Monad.replicateM (Word8 -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral (Word8le -> Word8 word8leValue Word8le size)) ((Int, Int, Int) -> Map Word32le Str -> BitGet [ProductAttribute] decodeProductAttributesBits (Int, Int, Int) version Map Word32le Str objectMap)