culture

package
v0.2.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2022 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxLoadDataChunkSize   = 100
	MaxLoadDataConcurrency = 10

	RequiredCultureSlugSuffix   = "_culture"
	RequiredBaseSlugSuffix      = "_base"
	RequiredSubbaseSlugSuffix   = "_subbase"
	RequiredEthosSlugSuffix     = "_ethos"
	RequiredTraditionSlugSuffix = "_tradition"
	RequiredLanguageSlugSuffix  = "_lang"
)

Variables

This section is empty.

Functions

func ExtractBases added in v0.2.11

func ExtractBases(cultures []*Culture) []string

func ExtractGenderDominances added in v0.2.11

func ExtractGenderDominances(cultures []*Culture) []genderDominance.Dominance

func ExtractLanguageSlugs added in v0.2.11

func ExtractLanguageSlugs(cultures []*Culture) []string

func ExtractMartialCusoms added in v0.2.11

func ExtractMartialCusoms(cultures []*Culture) []genderAcceptance.Acceptance

func GenerateSlug added in v0.2.11

func GenerateSlug(word string) string

func GetEthosSimilarityCoef

func GetEthosSimilarityCoef(e1, e2 Ethos) float64

func LoadAllBases added in v0.2.9

func LoadAllBases(opts ...types.ChangeStringFunc) chan either.Either[[]string]

func LoadAllCultures added in v0.2.12

func LoadAllCultures(opts ...types.ChangeStringFunc) chan either.Either[*Culture]

func LoadAllEthoses

func LoadAllEthoses(opts ...types.ChangeStringFunc) chan either.Either[[]Ethos]

func LoadAllRawCultures added in v0.2.10

func LoadAllRawCultures(opts ...types.ChangeStringFunc) chan either.Either[[]*RawCulture]

func LoadAllSubbases added in v0.2.9

func LoadAllSubbases(opts ...types.ChangeStringFunc) chan either.Either[[]*Subbase]

func LoadAllTraditions

func LoadAllTraditions(opts ...types.ChangeStringFunc) chan either.Either[[]*Tradition]

func RandomBase added in v0.2.11

func RandomBase(in []string) (string, error)

func RandomMartialCustom added in v0.2.11

func RandomMartialCustom(d genderDominance.Dominance) (genderAcceptance.Acceptance, error)

func SelectBaseByMostRecent added in v0.2.11

func SelectBaseByMostRecent(in []string) (string, error)

func SepareteCulturesByPresent added in v0.2.12

func SepareteCulturesByPresent(present []*Culture, ts []string) ([]string, []string)

func SepareteTraditionsByPresent added in v0.2.12

func SepareteTraditionsByPresent(present []*Tradition, ts []string) ([]string, []string)

Types

type CreateCultureOpts added in v0.2.11

type CreateCultureOpts struct {
	LanguageSlugs []string
	Subbases      []Subbase
	Ethoses       []Ethos
	Traditions    []*Tradition
}

type Culture

type Culture struct {
	Slug            string                      `json:"slug" bson:"slug"`
	BaseSlug        string                      `json:"base_slug" bson:"base_slug"`
	Subbase         Subbase                     `json:"subbase" bson:"subbase"`
	ParentCultures  []*Culture                  `json:"parent_cultures" bson:"parent_cultures"`
	Ethos           Ethos                       `json:"ethos" bson:"ethos"`
	Traditions      []*Tradition                `json:"traditions" bson:"traditions"`
	LanguageSlug    string                      `json:"language_slug" bson:"language_slug"`
	GenderDominance genderDominance.Dominance   `json:"gender_dominance" bson:"gender_dominance"`
	MartialCustom   genderAcceptance.Acceptance `json:"martial_custom" bson:"martial_custom"`
}

func Generate added in v0.2.11

func Generate(opts *CreateCultureOpts, parents ...*Culture) (*Culture, error)

Generate This method generates culture from already generated cultures Or it can generate from data from opts passing via arguments The method does not generate slug for the culture. It should be done by word_generator (Please, use GenrateSlug func for preparing generated word for using it as culture's slug)

func New added in v0.2.11

func New(opts *CreateCultureOpts) (*Culture, error)

func SearchCultures added in v0.2.12

func SearchCultures(slugs []string, opts ...types.ChangeStringFunc) ([]*Culture, error)

type Ethos

type Ethos struct {
	Slug             string `json:"slug" bson:"slug"`
	Description      string `json:"description" bson:"description"`
	IsDiplomatic     bool   `json:"is_diplomatic" bson:"is_diplomatic"`
	IsWarlike        bool   `json:"is_warlike" bson:"is_warlike"`
	IsAdministrative bool   `json:"is_administrative" bson:"is_administrative"`
	IsIntrigue       bool   `json:"is_intrigue" bson:"is_intrigue"`
	IsScholarly      bool   `json:"is_scholarly" bson:"is_scholarly"`
}

func ExtractEthoses

func ExtractEthoses(cultures []*Culture) []Ethos

func RandomEthos added in v0.2.11

func RandomEthos(in []Ethos) (Ethos, error)

func SearchEthos

func SearchEthos(slug string, opts ...types.ChangeStringFunc) (*Ethos, error)

func SelectEthosByMostRecent added in v0.2.11

func SelectEthosByMostRecent(in []Ethos) (Ethos, error)

func UniqueEthoses

func UniqueEthoses(ethoses []Ethos) []Ethos

func (Ethos) IsZero

func (e Ethos) IsZero() bool

type RawCulture

type RawCulture struct {
	Slug               string                      `json:"slug" bson:"slug"`
	BaseSlug           string                      `json:"base_slug" bson:"base_slug"`
	SubbaseSlug        string                      `json:"subbase_slug" bson:"subbase_slug"`
	ParentCultureSlugs []string                    `json:"parent_culture_slugs" bson:"parent_culture_slugs"`
	EthosSlug          string                      `json:"ethos_slug" bson:"ethos_slug"`
	TraditionSlugs     []string                    `json:"tradition_slugs" bson:"tradition_slugs"`
	LanguageSlug       string                      `json:"language_slug" bson:"language_slug"`
	GenderDominance    genderDominance.Dominance   `json:"gender_dominance" bson:"gender_dominance"`
	MartialCustom      genderAcceptance.Acceptance `json:"martial_custom" bson:"martial_custom"`
}

func FilterRawCulturesBySlugs added in v0.2.12

func FilterRawCulturesBySlugs(rCultures []*RawCulture, slugs []string) []*RawCulture

type Subbase

type Subbase struct {
	Slug     string `json:"slug" bson:"slug"`
	BaseSlug string `json:"base_slug" bson:"base_slug"`
}

func ExtractSubbases added in v0.2.11

func ExtractSubbases(cultures []*Culture) []Subbase

func FilterSubbasesByBaseSlug added in v0.2.11

func FilterSubbasesByBaseSlug(subbases []Subbase, baseSlug string) []Subbase

func RandomSubbase added in v0.2.11

func RandomSubbase(in []Subbase) (Subbase, error)

func SearchSubbase added in v0.2.12

func SearchSubbase(slug string, opts ...types.ChangeStringFunc) (*Subbase, error)

func SelectSubbaseByMostRecent added in v0.2.11

func SelectSubbaseByMostRecent(in []Subbase) (Subbase, error)

func (Subbase) IsZero added in v0.2.11

func (sb Subbase) IsZero() bool

type Tradition

type Tradition struct {
	Slug                string        `json:"slug" bson:"slug"`
	Description         string        `json:"description" bson:"description"`
	PreferredEthosSlugs []string      `json:"preferred_ethos_slugs" bson:"preferred_ethos_slugs"`
	Type                TraditionType `json:"type" bson:"type"`
	OmitTraditionSlugs  []string      `json:"omit_tradition_slugs" bson:"omit_tradition_slugs"`
	OmitGenderDominance []gender.Sex  `json:"omit_gender_dominance" bson:"omit_gender_dominance"`
	OmitEthosSlugs      []string      `json:"omit_ethos_slugs" bson:"omit_ethos_slugs"`
}

func ExtractTraditions added in v0.2.11

func ExtractTraditions(cultures []*Culture) []*Tradition

func FilterTraditionsByDomitatedSex added in v0.2.11

func FilterTraditionsByDomitatedSex(in []*Tradition, ds gender.Sex) []*Tradition

func FilterTraditionsByEthos added in v0.2.11

func FilterTraditionsByEthos(in []*Tradition, e Ethos) []*Tradition

func RandomTraditions added in v0.2.11

func RandomTraditions(ts []*Tradition, min, max int, e Ethos, ds gender.Sex) ([]*Tradition, error)

func SearchTradition

func SearchTradition(slug string, opts ...types.ChangeStringFunc) (*Tradition, error)

func SearchTraditions added in v0.2.12

func SearchTraditions(slugs []string, opts ...types.ChangeStringFunc) ([]*Tradition, error)

func UniqueTraditions added in v0.2.11

func UniqueTraditions(in []*Tradition) []*Tradition

type TraditionType

type TraditionType string
const (
	RealmTraditionType    TraditionType = "realm_tradition_type"
	RegionalTraditionType TraditionType = "regional_tradition_type"
	RitualTraditionType   TraditionType = "ritual_tradition_type"
	SocialTraditionType   TraditionType = "social_tradition_type"
	WarfareTraditionType  TraditionType = "warfare_tradition_type"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL