2018-11-17 19:11:36 +01:00
|
|
|
{-# LANGUAGE DeriveGeneric #-}
|
|
|
|
{-# LANGUAGE OverloadedLists #-}
|
|
|
|
module Item (
|
|
|
|
Item(..)
|
2018-12-17 12:42:00 +01:00
|
|
|
, Group(..)
|
2018-11-17 19:11:36 +01:00
|
|
|
, Key
|
|
|
|
, Type(..)
|
|
|
|
, dex
|
|
|
|
) where
|
|
|
|
|
2018-12-17 12:42:00 +01:00
|
|
|
import Data.Aeson (ToJSON(..), FromJSON(..), genericToEncoding, defaultOptions)
|
2018-11-17 19:11:36 +01:00
|
|
|
import Data.Vector (Vector)
|
|
|
|
import GHC.Generics (Generic)
|
2018-12-17 12:40:46 +01:00
|
|
|
import Pokemon (Pokemon)
|
2018-11-17 19:11:36 +01:00
|
|
|
|
2018-12-17 12:40:46 +01:00
|
|
|
data Type = Hold | Transform (Pokemon -> Pokemon) | Special
|
2018-11-17 19:11:36 +01:00
|
|
|
|
|
|
|
data Item = Item {
|
|
|
|
name :: String
|
|
|
|
, skin :: FilePath
|
|
|
|
, type_ :: Type
|
|
|
|
, inBattle :: Bool
|
|
|
|
}
|
|
|
|
|
|
|
|
newtype Key = Key Int deriving (Generic)
|
|
|
|
|
|
|
|
instance ToJSON Key where
|
|
|
|
toEncoding = genericToEncoding defaultOptions
|
2018-12-17 12:42:00 +01:00
|
|
|
instance FromJSON Key
|
|
|
|
|
|
|
|
data Group = Group {
|
|
|
|
item :: Key
|
|
|
|
, count :: Int
|
|
|
|
} deriving (Generic)
|
|
|
|
|
|
|
|
instance ToJSON Group where
|
|
|
|
toEncoding = genericToEncoding defaultOptions
|
|
|
|
instance FromJSON Group
|
2018-11-17 19:11:36 +01:00
|
|
|
|
|
|
|
dex :: Vector Item
|
|
|
|
dex = []
|