character

package
v0.0.0-...-10f3eee Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbilityScoreData

type AbilityScoreData struct {
	Score int `json:"score"`
	Bonus int `json:"bonus"`
}

type AttributeData

type AttributeData struct {
	Str *AbilityScoreData `json:"str"`
	Dex *AbilityScoreData `json:"dex"`
	Con *AbilityScoreData `json:"con"`
	Int *AbilityScoreData `json:"int"`
	Wis *AbilityScoreData `json:"wis"`
	Cha *AbilityScoreData `json:"cha"`
}

type Config

type Config struct {
	Client redis.UniversalClient
}

type Data

type Data struct {
	ID               string                       `json:"id"`
	OwnerID          string                       `json:"owner_id"`
	Name             string                       `json:"name"`
	ClassKey         string                       `json:"class_key"`
	RaceKey          string                       `json:"race_key"`
	AC               int                          `json:"ac"`
	Speed            int                          `json:"speed"`
	HitDie           int                          `json:"hit_die"`
	Level            int                          `json:"level"`
	Experience       int                          `json:"experience"`
	MaxHitPoints     int                          `json:"max_hit_points"`
	CurrentHitPoints int                          `json:"current_hit_points"`
	EquippedSlots    map[entities.Slot]*Equipment `json:"equipped_slots"`
	Attributes       *AttributeData               `json:"attributes"`
	NextLevel        int                          `json:"next_level"`
	Rolls            []*RollData                  `json:"rolls"`
	Proficiencies    []*Proficiency               `json:"proficiencies"`
	Inventory        []*Equipment                 `json:"inventory"`
}

type Equipment

type Equipment struct {
	Key  string                 `json:"key"`
	Name string                 `json:"name,omitempty"`
	Type entities.EquipmentType `json:"type,omitempty"`
}

type Mock

type Mock struct {
	mock.Mock
}

func (*Mock) Get

func (m *Mock) Get(ctx context.Context, id string) (*Data, error)

func (*Mock) Put

func (m *Mock) Put(ctx context.Context, character *entities.Character) (*entities.Character, error)

type Proficiency

type Proficiency struct {
	Key  string `json:"key"`
	Name string `json:"name,omitempty"`
	Type string `json:"type,omitempty"`
}

type Repository

type Repository interface {
	Put(ctx context.Context, character *entities.Character) (*entities.Character, error)
	Get(ctx context.Context, id string) (*Data, error)
}

func New

func New(cfg *Config) (Repository, error)

type RollData

type RollData struct {
	Used    bool  `json:"used"`
	Total   int   `json:"total"`
	Highest int   `json:"highest"`
	Lowest  int   `json:"lowest"`
	Rolls   []int `json:"rolls"`
}

Jump to

Keyboard shortcuts

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