entities

package
v0.0.0-...-881765e Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Name  string `json:"name"`
	Value int32  `json:"value"`
}

Attribute data

type Character

type Character struct {
	*Entity
	Name        string `json:"name"`
	Description string `json:"description"`
	Race        Race   `json:"race"`
	Class       Class  `json:"class"`
}

Character header data is an abbrevated version of the character sheet

func NewCharacter

func NewCharacter() *Character

NewCharacter creates a new character

type CharacterRace

type CharacterRace int

CharacterRace type

func (CharacterRace) String

func (cr CharacterRace) String() string

type CharacterSheet

type CharacterSheet struct {
	*Entity     `bson:",inline"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Race        Race   `json:"race"`
	Class       Class  `json:"class"`

	CurrentHitPoints int32 `json:"currentHitPoints"`
	MaxHitPoints     int32 `json:"maxHitPoints"`
	ArmorClass       int32 `json:"armorClass"`

	Created    time.Time    `bson:"created" json:"created,omitempty"`
	Attributes []*Attribute `bson:"attributes" json:"attributes,omitempty"`

	PersonalityTraits string `json:"personalityTraits,omitempty"`
}

CharacterSheet data

func (*CharacterSheet) AsCharacter

func (cs *CharacterSheet) AsCharacter() *Character

AsCharacter creates a new character from charactersheet

type Class

type Class int

Class type

func (Class) String

func (cr Class) String() string

type Entity

type Entity struct {
	ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
}

Entity ...

func NewEntity

func NewEntity() *Entity

NewEntity ...

type Party

type Party struct {
	*Entity    `bson:",inline"`
	Name       string               `json:"name"`
	Created    time.Time            `bson:"created,omitempty" json:"created,omitempty"`
	Characters []primitive.ObjectID `bson:"characters,omitempty" json:"characters,omitempty"`
}

Party data

type Race

type Race int

Race type

func (Race) String

func (cr Race) String() string

type User

type User struct {
	*Entity `bson:",inline"`

	// main *unique* reference id, its additional to ID because it might be a list of reference ids in the future so a user
	// can merge multiple accounts (refids) into the same user object
	RefID string `json:"refid,omitempty"`

	Name     string    `json:"name"`
	Nickname string    `json:"nickname"`
	Email    string    `json:"email"`
	Created  time.Time `bson:"created" json:"created,omitempty"`
	LastSeen time.Time `bson:"lastSeen" json:"lastSeen,omitempty"`
	Picture  string    `json:"picture"`

	// is set to false after the first PUT request
	IsNewUser bool `json:"isNewUser"`
}

User connects to login credentials to a user object

func NewUser

func NewUser() *User

NewUser creates a new user

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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