Skip to content

Commit

Permalink
tools: yarn generate-codec-types
Browse files Browse the repository at this point in the history
  • Loading branch information
tash-2s committed Jan 16, 2022
1 parent f3a28d3 commit e823f0d
Showing 1 changed file with 45 additions and 45 deletions.
90 changes: 45 additions & 45 deletions common/rs/src/codec_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use parity_scale_codec::{Decode, Encode};
use sp_std::{collections::btree_map::BTreeMap, prelude::*};

#[cfg(feature = "ink")]
use codec_types_derive::EmptySpreadLayout;
use codec_types_derive::SpreadLayoutOneStorageCell;
#[cfg(feature = "ink")]
use ink_storage::traits::PackedLayout;

Expand All @@ -16,28 +16,28 @@ pub mod mtc {
use super::*;

#[derive(Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub struct Emo {
pub id: u16,
pub base_id: u16,
}

#[derive(Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub struct GradeAndBoard {
pub grade: u8,
pub board: mtc::Board,
}

#[derive(Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub struct Board(pub Vec<mtc::BoardEmo>);

#[derive(Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub struct BoardEmo {
pub mtc_emo_ids: Vec<u16>,
Expand All @@ -46,35 +46,35 @@ pub mod mtc {
}

#[derive(Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub struct Ghost {
pub history: Vec<mtc::GradeAndGhostBoard>,
}

#[derive(Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub struct GradeAndGhostBoard {
pub grade: u8,
pub board: mtc::GhostBoard,
}

#[derive(Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub struct GhostBoard(pub Vec<mtc::GhostBoardEmo>);

#[derive(Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub struct GhostBoardEmo {
pub base_id: u16,
pub attributes: emo::Attributes,
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum GhostState {
Active { health: u8 },
Expand All @@ -92,17 +92,17 @@ pub mod mtc {
use super::*;

#[derive(Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub struct Catalog(pub Vec<mtc::shop::CatalogLine>);

#[derive(Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub struct CatalogLine(pub Vec<mtc::Emo>);

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum PlayerOperation {
Buy { mtc_emo_id: u16, index: u8 },
Expand All @@ -121,12 +121,12 @@ pub mod mtc {
}

#[derive(Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub struct BoardLogs(pub Vec<mtc::shop::BoardLog>);

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum BoardLog {
Add {
Expand Down Expand Up @@ -170,12 +170,12 @@ pub mod mtc {
use super::*;

#[derive(Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub struct Logs(pub Vec<mtc::battle::Log>);

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum Log {
Attack {
Expand Down Expand Up @@ -244,12 +244,12 @@ pub mod emo {
use super::*;

#[derive(Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub struct Bases(pub BTreeMap<u16, emo::Base>);

#[derive(Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub struct Base {
pub id: u16,
Expand All @@ -262,7 +262,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum Typ {
Human,
Expand All @@ -277,7 +277,7 @@ pub mod emo {
}

#[derive(Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub struct Attributes {
pub attack: u16,
Expand All @@ -290,7 +290,7 @@ pub mod emo {
use super::*;

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum Ability {
Shop(emo::ability::shop::Shop),
Expand All @@ -306,7 +306,7 @@ pub mod emo {
use super::*;

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum Shop {
Pre(emo::ability::shop::Pre),
Expand All @@ -320,7 +320,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum Pre {
Normal(emo::ability::shop::NormalAction),
Expand All @@ -333,7 +333,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum Peri {
AsOneself {
Expand All @@ -355,7 +355,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum Special {
Placeholder,
Expand All @@ -367,7 +367,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum PeriAsOneselfTrigger {
Set,
Expand All @@ -383,7 +383,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum PeriAsAllyTrigger {
AllySet {
Expand All @@ -399,7 +399,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum PeriAsAllyAction {
OneselfTripleNormal(emo::ability::shop::NormalAction),
Expand All @@ -412,7 +412,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum NormalAction {
SetEmo {
Expand Down Expand Up @@ -459,7 +459,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum RandomAction {
IncreaseStatsOfMenagerie {
Expand All @@ -479,7 +479,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum AsAllyAction {
TriggerSetActions,
Expand All @@ -495,7 +495,7 @@ pub mod emo {
use super::*;

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum Battle {
General(emo::ability::battle::General),
Expand All @@ -508,7 +508,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum General {
AsOneself {
Expand All @@ -530,7 +530,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum Special {
Shield,
Expand All @@ -544,7 +544,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum GeneralAsOneselfTrigger {
Pre,
Expand All @@ -568,7 +568,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum GeneralAsAllyTrigger {
AllySet {
Expand All @@ -587,7 +587,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum GeneralAsAllyAction {
OneselfTripleNormal(emo::ability::battle::NormalAction),
Expand All @@ -600,7 +600,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum NormalAction {
SetEmo {
Expand Down Expand Up @@ -648,7 +648,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum AsAllyAction {
TriggerRetireActions,
Expand All @@ -661,7 +661,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum TargetOrRandom {
Target(emo::ability::Target),
Expand All @@ -677,7 +677,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum Target {
Oneself,
Expand All @@ -693,7 +693,7 @@ pub mod emo {
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum Destination {
Left,
Expand All @@ -707,15 +707,15 @@ pub mod emo {
}

#[derive(Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub struct TypOptAndIsTripleOpt {
pub typ_opt: Option<emo::Typ>,
pub is_triple_opt: Option<bool>,
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug, Encode, Decode)]
#[cfg_attr(feature = "ink", derive(PackedLayout, EmptySpreadLayout))]
#[cfg_attr(feature = "ink", derive(PackedLayout, SpreadLayoutOneStorageCell))]
#[cfg_attr(feature = "ink-std", derive(TypeInfo, StorageLayout))]
pub enum Side {
Ally,
Expand Down

0 comments on commit e823f0d

Please sign in to comment.