Safe Haskell | None |
---|---|
Language | Haskell2010 |
Creation of items on the server. Types and operations that don't involve server state nor our custom monads.
Synopsis
- data ItemKnown = ItemKnown ItemIdentity AspectRecord (Maybe FactionId)
- type ItemRev = HashMap ItemKnown ItemId
- type UniqueSet = EnumSet (ContentId ItemKind)
- buildItem :: COps -> AspectRecord -> FlavourMap -> DiscoveryKindRev -> ContentId ItemKind -> Item
- newItemKind :: COps -> UniqueSet -> Freqs ItemKind -> AbsDepth -> AbsDepth -> Int -> Frequency (ContentId ItemKind, ItemKind)
- newItem :: COps -> Frequency (ContentId ItemKind, ItemKind) -> FlavourMap -> DiscoveryKindRev -> AbsDepth -> AbsDepth -> Rnd (Maybe (ItemKnown, ItemFullKit))
- data DiscoveryKindRev
- emptyDiscoveryKindRev :: DiscoveryKindRev
- serverDiscos :: COps -> Rnd (DiscoveryKind, DiscoveryKindRev)
- data FlavourMap
- emptyFlavourMap :: FlavourMap
- dungeonFlavourMap :: COps -> Rnd FlavourMap
Documentation
The essential item properties, used for the ItemRev
hash table
from items to their ids, needed to assign ids to newly generated items.
All the other meaningul properties can be derived from them.
Note: item seed instead of AspectRecord
is not enough,
becaused different seeds may result in the same AspectRecord
and we don't want such items to be distinct in UI and elsewhere.
Instances
Eq ItemKnown Source # | |
Show ItemKnown Source # | |
Generic ItemKnown Source # | |
Binary ItemKnown Source # | |
Hashable ItemKnown Source # | |
Defined in Game.LambdaHack.Server.ItemRev | |
type Rep ItemKnown Source # | |
Defined in Game.LambdaHack.Server.ItemRev type Rep ItemKnown = D1 (MetaData "ItemKnown" "Game.LambdaHack.Server.ItemRev" "LambdaHack-0.9.4.1-inplace" False) (C1 (MetaCons "ItemKnown" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 ItemIdentity) :*: (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 AspectRecord) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 (Maybe FactionId))))) |
type ItemRev = HashMap ItemKnown ItemId Source #
Reverse item map, for item creation, to keep items and item identifiers in bijection.
buildItem :: COps -> AspectRecord -> FlavourMap -> DiscoveryKindRev -> ContentId ItemKind -> Item Source #
Build an item with the given kind and aspects.
newItemKind :: COps -> UniqueSet -> Freqs ItemKind -> AbsDepth -> AbsDepth -> Int -> Frequency (ContentId ItemKind, ItemKind) Source #
Roll an item kind based on given Freqs
and kind rarities
newItem :: COps -> Frequency (ContentId ItemKind, ItemKind) -> FlavourMap -> DiscoveryKindRev -> AbsDepth -> AbsDepth -> Rnd (Maybe (ItemKnown, ItemFullKit)) Source #
Given item kind frequency, roll item kind, generate item aspects based on level and put together the full item data set.
Item discovery types
data DiscoveryKindRev Source #
The reverse map to DiscoveryKind
, needed for item creation.
This is total and never changes, hence implemented as vector.
Morally, it's indexed by ContentId ItemKind
and elements are ItemKindIx
.
Instances
Show DiscoveryKindRev Source # | |
Defined in Game.LambdaHack.Server.ItemRev showsPrec :: Int -> DiscoveryKindRev -> ShowS # show :: DiscoveryKindRev -> String # showList :: [DiscoveryKindRev] -> ShowS # | |
Binary DiscoveryKindRev Source # | |
Defined in Game.LambdaHack.Server.ItemRev |
serverDiscos :: COps -> Rnd (DiscoveryKind, DiscoveryKindRev) Source #
The FlavourMap
type
data FlavourMap Source #
Flavours assigned by the server to item kinds, in this particular game.
This is total and never changes, hence implemented as vector.
Morally, it's indexed by ContentId ItemKind
and elements are Flavour
.
Instances
Show FlavourMap Source # | |
Defined in Game.LambdaHack.Server.ItemRev showsPrec :: Int -> FlavourMap -> ShowS # show :: FlavourMap -> String # showList :: [FlavourMap] -> ShowS # | |
Binary FlavourMap Source # | |
Defined in Game.LambdaHack.Server.ItemRev |
dungeonFlavourMap :: COps -> Rnd FlavourMap Source #
Randomly chooses flavour for all item kinds for this game.