all repos — felt @ main

virtual tabletop for dungeons and dragons (and similar) using Go, MongoDB, and websockets

models/models.go (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package models

import (
	"time"
)

type TableKey struct {
	Name     string `json:"name"`
	Passcode string `json:"passcode"`
}

type DiceRoll struct {
	Faces     uint8     `json:"faces"`
	Roll      []uint8   `json:"roll"`
	Player    string    `json:"player"`
	Note      string    `json:"note"`
	Timestamp time.Time `json:"timestamp"`
}

type Token struct {
	Id     *string  `json:"id" bson:"_id"`
	Name   *string  `json:"name,omitempty"`
	Sprite *string  `json:"sprite,omitempty"`
	W      *int     `json:"w,omitempty"`
	H      *int     `json:"h,omitempty"`
	OX     *int     `json:"oX,omitempty"`
	OY     *int     `json:"oY,omitempty"`
	X      *float64 `json:"x"`
	Y      *float64 `json:"y"`
	Active bool     `json:"active"`
}

type Table struct {
	Name        string     `json:"name"`
	Passcode    string     `json:"passcode"`
	MapImageUrl string     `json:"mapImg"`
	DiceRolls   []DiceRoll `json:"diceRolls"`
	Tokens      []Token    `json:"tokens"`
	AuxMessage  string     `json:"auxMsg"`
}

type TableMessage struct {
	Auth     *string   `json:"auth,omitempty"`
	Key      *TableKey `json:"key"`
	DiceRoll *DiceRoll `json:"diceRoll,omitempty"`
	Token    *Token    `json:"token,omitempty"`
	MapImg   *string   `json:"mapImg,omitempty"`
	AuxMsg   *string   `json:"auxMsg,omitempty"`
}