shared

package
v0.1.1-0...-1ecdc53 Latest Latest
Warning

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

Go to latest
Published: May 30, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package shared defines data structures that are used both by the server and by the web client. These are typically data types transferred as JSON.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	Systems []System `json:"systems"`
	Groups  []Group  `json:"groups"`
}

Data contains all systems and groups and is used for the server's "/data" endpoint

type Group

type Group struct {
	Name        string  `json:"name"`
	ID          string  `json:"id"`
	SystemIndex int     `json:"systemIndex"`
	Heroes      []Hero  `json:"heroes"`
	Scenes      []Scene `json:"scenes"`
}

Group describes a dataset for a pen & paper roleplaying group.

type GroupCreationRequest

type GroupCreationRequest struct {
	Name               string `json:"name"`
	PluginIndex        int    `json:"pluginIndex"`
	GroupTemplateIndex int    `json:"groupTemplateIndex"`
}

GroupCreationRequest is sent from the client to the server to request the creation of a group.

type GroupModificationRequest

type GroupModificationRequest struct {
	Name        string `json:"name"`
	SystemIndex int    `json:"systemIndex"`
}

GroupModificationRequest is sent from the client to the server to request the modification of a group.

type Hero

type Hero struct {
	Name        string `json:"name"`
	ID          string `json:"id"`
	Description string `json:"description"`
}

Hero describes a hero in a group.

type HeroModificationRequest

type HeroModificationRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

HeroModificationRequest is sent from the client to the server to request the modification of a hero.

type Message

type Message struct {
	// true if this is an error, false if it's just a warning.
	IsError bool `json:"isError"`
	// Index of the module the message is issued from, -1 if none
	ModuleIndex ModuleIndex `json:"moduleIndex"`
	// text to display
	Text string `json:"text"`
}

Message is a warning or an error that should be displayed on the starting screen of the client.

type Module

type Module struct {
	Name string `json:"name"`
	// <plugin-id>/<module-id>
	Path string `json:"path"`
}

Module describes a loaded module.

type ModuleConfig

type ModuleConfig []interface{}

ModuleConfig is a list of configuration items.

type ModuleIndex

type ModuleIndex int

ModuleIndex identifies a module internally. This is not the index of a module inside a plugin.

const FirstModule ModuleIndex = 0

FirstModule is the index of the first module

type Plugin

type Plugin struct {
	Name            string `json:"name"`
	ID              string `json:"id"`
	SystemTemplates []TemplateDescr
	GroupTemplates  []TemplateDescr
	SceneTemplates  []TemplateDescr
}

Plugin describes a loaded plugin.

type Scene

type Scene struct {
	Name    string `json:"name"`
	ID      string `json:"id"`
	Modules []bool `json:"modules"`
}

Scene describes a scene of a group.

type SceneCreationRequest

type SceneCreationRequest struct {
	Name               string `json:"name"`
	PluginIndex        int    `json:"pluginIndex"`
	SceneTemplateIndex int    `json:"sceneTemplateIndex"`
}

SceneCreationRequest is sent from the client to the server to request the creation of a scene.

type SceneModificationRequest

type SceneModificationRequest struct {
	Name    string `json:"name"`
	Modules []bool `json:"modules"`
}

SceneModificationRequest is sent from the client to the server to request the modification of a scene's name and modules.

type State

type State struct {
	ActiveGroup int
	ActiveScene int
}

State contains the current state, including currently active group and scene. The state of the modules is local to the session page and not available globally.

type StateRequest

type StateRequest struct {
	Action string `json:"action"`
	Index  int    `json:"index"`
}

type StateResponse

type StateResponse struct {
	ActiveGroup int               `json:"activeGroup"`
	ActiveScene int               `json:"activeScene"`
	Modules     []json.RawMessage `json:"modules"`
}

type Static

type Static struct {
	Fonts            []string             `json:"fonts"`
	Textures         []resources.Resource `json:"textures"`
	NumPluginSystems int                  `json:"numPluginSystems"`
	Plugins          []Plugin             `json:"plugins"`
	FontDir          string               `json:"fontDir"`
	Messages         []Message            `json:"messages"`
	AppVersion       string               `json:"appVersion"`
	Modules          []Module             `json:"modules"`
}

Static describes static data that will never change during the lifetime of the server/client.

type System

type System struct {
	Name string `json:"name"`
	ID   string `json:"id"`
}

System describes a pen & paper roleplaying system.

type SystemModificationRequest

type SystemModificationRequest struct {
	Name string `json:"name"`
}

SystemModificationRequest is sent from the client to the server to request the modification of a system.

type TemplateDescr

type TemplateDescr struct {
	Name, Description string
}

TemplateDescr describes an available template for a system, group or scene.

Jump to

Keyboard shortcuts

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