Add generic derivations and To/FromJSON instances

This commit is contained in:
2022-07-25 22:49:18 +01:00
parent f5604ef429
commit b8e8413daa
99 changed files with 1406 additions and 517 deletions
+24 -9
View File
@@ -1,7 +1,10 @@
{-# LANGUAGE StrictData #-}
{-# LANGUAGE DeriveGeneric #-}
module Dodge.Data.Item.HeldUse where
import GHC.Generics
import Data.Aeson
import Dodge.Combine.Data
import Dodge.Data.CamouflageStatus
data HeldUse = HeldDoNothing
| HeldUseAmmoParams
| HeldOverNozzlesUseGasParams
@@ -17,12 +20,16 @@ data HeldUse = HeldDoNothing
| HeldTractor
| HeldForceField
| HeldShatter
deriving (Eq,Ord,Show,Read)
deriving (Eq,Ord,Show,Read,Generic)
instance ToJSON HeldUse where
toEncoding = genericToEncoding defaultOptions
instance FromJSON HeldUse
data Cuse = CDoNothing
| CHeal Int
deriving (Eq,Ord,Show,Read)
deriving (Eq,Ord,Show,Read,Generic)
instance ToJSON Cuse where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Cuse
data Euse = EDoNothing
| EDetector Detector
| EMagShield
@@ -33,15 +40,20 @@ data Euse = EDoNothing
| EonWristShield
| EoffWristShield
deriving (Eq,Ord,Show,Read)
deriving (Eq,Ord,Show,Read,Generic)
instance ToJSON Euse where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Euse
data Luse = LDoNothing
| LRewind
| LShrink
| LBlink
| LUnsafeBlink
| LBoost
deriving (Eq,Ord,Show,Read)
deriving (Eq,Ord,Show,Read,Generic)
instance ToJSON Luse where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Luse
data HeldMod = HeldModNothing
| PoisonSprayerMod
| FlameSpitterMod
@@ -74,4 +86,7 @@ data HeldMod = HeldModNothing
| SmgMod
| RevolverXMod
| BangConeMod
deriving (Eq,Ord,Show,Read)
deriving (Eq,Ord,Show,Read,Generic)
instance ToJSON HeldMod where
toEncoding = genericToEncoding defaultOptions
instance FromJSON HeldMod