server

package
v0.0.0-...-1df5436 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: AGPL-3.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	YEAR time.Duration = 366 * 24 * time.Hour
)

Variables

This section is empty.

Functions

func Start

func Start()

Types

type Assets

type Assets struct {
	// contains filtered or unexported fields
}

func (*Assets) IsValidPicture

func (a *Assets) IsValidPicture(name string) bool

func (*Assets) IsValidSound

func (a *Assets) IsValidSound(name string) bool

func (*Assets) IsValidSprite

func (a *Assets) IsValidSprite(name string) bool

func (*Assets) IsValidSystem

func (a *Assets) IsValidSystem(name string, ignoreSingleQuotes bool) bool

type Badge

type Badge struct {
	Group           string     `json:"group"`
	Order           int        `json:"order"`
	MapOrder        int        `json:"mapOrder"`
	Bp              int        `json:"bp"`
	ReqType         string     `json:"reqType"`
	ReqInt          int        `json:"reqInt"`
	ReqString       string     `json:"reqString"`
	ReqStrings      []string   `json:"reqStrings"`
	ReqStringArrays [][]string `json:"reqStringArrays"`
	ReqCount        int        `json:"reqCount"`
	Map             int        `json:"map"`
	MapX            int        `json:"mapX"`
	MapY            int        `json:"mapY"`
	Secret          bool       `json:"secret"`
	SecretMap       bool       `json:"secretMap"`
	SecretCondition bool       `json:"secretCondition"`
	Hidden          bool       `json:"hidden"`
	Parent          string     `json:"parent"`
	OverlayType     int        `json:"overlayType"`
	Art             string     `json:"art"`
	Animated        bool       `json:"animated"`
	Batch           int        `json:"batch"`
	Dev             bool       `json:"dev"`
}

type ChatHistory

type ChatHistory struct {
	Players  []*ChatPlayer  `json:"players"`
	Messages []*ChatMessage `json:"messages"`
}

type ChatMessage

type ChatMessage struct {
	MsgId         string    `json:"msgId"`
	Uuid          string    `json:"uuid"`
	MapId         string    `json:"mapId"`
	PrevMapId     string    `json:"prevMapId"`
	PrevLocations string    `json:"prevLocations"`
	X             int       `json:"x"`
	Y             int       `json:"y"`
	Contents      string    `json:"contents"`
	Timestamp     time.Time `json:"timestamp"`
	Party         bool      `json:"party"`
}

type ChatPlayer

type ChatPlayer struct {
	Uuid       string `json:"uuid"`
	Name       string `json:"name"`
	SystemName string `json:"systemName"`
	Rank       int    `json:"rank"`
	Account    bool   `json:"account"`
	Badge      string `json:"badge"`
	Medals     [5]int `json:"medals"`
}

type CheckUpdateData

type CheckUpdateData struct {
	BadgeIds []string `json:"badgeIds"`
	NewTags  bool     `json:"newTags"`
}

type Condition

type Condition struct {
	ConditionId  string   `json:"conditionId"`
	Map          int      `json:"map"`
	MapX1        int      `json:"mapX1"`
	MapY1        int      `json:"mapY1"`
	MapX2        int      `json:"mapX2"`
	MapY2        int      `json:"mapY2"`
	SwitchId     int      `json:"switchId"`
	SwitchValue  bool     `json:"switchValue"`
	SwitchIds    []int    `json:"switchIds"`
	SwitchValues []bool   `json:"switchValues"`
	SwitchDelay  bool     `json:"switchDelay"`
	VarId        int      `json:"varId"`
	VarValue     int      `json:"varValue"`
	VarValue2    int      `json:"varValue2"`
	VarOp        string   `json:"varOp"`
	VarIds       []int    `json:"varIds"`
	VarValues    []int    `json:"varValues"`
	VarOps       []string `json:"varOps"`
	VarDelay     bool     `json:"varDelay"`
	VarTrigger   bool     `json:"varTrigger"`
	Trigger      string   `json:"trigger"`
	Value        string   `json:"value"`
	Values       []string `json:"values"`
	TimeTrial    bool     `json:"timeTrial"`
	Disabled     bool     `json:"disabled"`
}

type Config

type Config struct {
	// contains filtered or unexported fields
}

type ConfigFile

type ConfigFile struct {
	GameName string `yaml:"game_name"`
	GamePath string `yaml:"game_path"`

	DbUser string `yaml:"db_user"`
	DbPass string `yaml:"db_pass"`
	DbAddr string `yaml:"db_addr"`
	DbName string `yaml:"db_name"`

	SpRooms         string `yaml:"sp_rooms"`
	BadSounds       string `yaml:"bad_sounds"`
	PictureNames    string `yaml:"picture_names"`
	PicturePrefixes string `yaml:"picture_prefixes"`
	BattleAnimIds   string `yaml:"battle_anim_ids"`

	ChatWebhook       string `yaml:"chat_webhook"`
	ScreenshotWebhook string `yaml:"screenshot_webhook"`

	Moderation *struct {
		BotToken  string `yaml:"bot_token"`
		ChannelID string `yaml:"channel_id"`
		ModRoleID string `yaml:"mod_role_id"`
	} `yaml:"moderation"`

	Ipc *struct {
		DeadlineMs int `yaml:"deadline_ms"`
	} `yaml:"ipc"`

	VapidKeys struct {
		Private string `yaml:"private"`
		Public  string `yaml:"public"`
	} `yaml:"vapid_keys"`

	Logging struct {
		MaxSize    int `yaml:"max_size"`
		MaxBackups int `yaml:"max_backups"`
		MaxAge     int `yaml:"max_age"`
	} `yaml:"logging"`
}

type ConnTypeParams

type ConnTypeParams struct {
	Params   string `json:"params"`
	ParamsJP string `json:"paramsJP"`
}

type EventExp

type EventExp struct {
	WeekExp   int `json:"weekExp"`
	PeriodExp int `json:"periodExp"`
	TotalExp  int `json:"totalExp"`
}

type EventLocation

type EventLocation struct {
	Id         int       `json:"id"`
	Type       int       `json:"type"`
	Game       string    `json:"game"`
	LocationId int       `json:"locationId"`
	Title      string    `json:"title"`
	TitleJP    string    `json:"titleJP"`
	Depth      int       `json:"depth"`
	MinDepth   int       `json:"minDepth,omitempty"`
	Exp        int       `json:"exp"`
	EndDate    time.Time `json:"endDate"`
	Complete   bool      `json:"complete"`
}

type EventLocationData

type EventLocationData struct {
	Title    string   `json:"title"`
	TitleJP  string   `json:"titleJP,omitempty"`
	Depth    int      `json:"depth"`
	MinDepth int      `json:"minDepth"`
	FgColor  string   `json:"fgColor"`
	BgColor  string   `json:"bgColor"`
	MapIds   []string `json:"mapIds"`
	Ignored  bool     `json:"ignored"`
}

type EventPeriod

type EventPeriod struct {
	Id            int       `json:"-"`
	PeriodOrdinal int       `json:"periodOrdinal"`
	EndDate       time.Time `json:"endDate"`
	EnableVms     bool      `json:"enableVms"`
}

type EventVm

type EventVm struct {
	Id       int       `json:"id"`
	Game     string    `json:"game"`
	Exp      int       `json:"exp"`
	EndDate  time.Time `json:"endDate"`
	Complete bool      `json:"complete"`
}

type EventsData

type EventsData struct {
	Locations []*EventLocation `json:"locations"`
	Vms       []*EventVm       `json:"vms"`
}

type GameLocation

type GameLocation struct {
	Id     int      `json:"id"`
	Game   string   `json:"game"`
	Name   string   `json:"name"`
	MapIds []string `json:"mapIds"`
}

type IPC

type IPC struct{}

"Methods" can be defined on this actor which then can be called by sibling processes.

func (*IPC) SendReportLog

func (_ *IPC) SendReportLog(args SendReportLogArgs, _ *Void) error

func (*IPC) TryBan

func (_ *IPC) TryBan(args string, _ *Void) error

func (*IPC) TryMute

func (_ *IPC) TryMute(args string, _ *Void) error

type Location

type Location struct {
	Id                  int      `json:"id"`
	Title               string   `json:"title"`
	OriginalTitle       string   `json:"originalTitle"`
	Depth               int      `json:"depth"`
	MinDepth            int      `json:"minDepth"`
	Image               string   `json:"locationImage"`
	PrimaryAuthor       string   `json:"primaryAuthor,omitempty"`
	ContributingAuthors []string `json:"contributingAuthors,omitempty"`
	VersionAdded        string   `json:"versionAdded"`
	VersionsUpdated     []string `json:"versionsUpdated"`
	Secret              bool     `json:"secret"`
}

type LocationResponse

type LocationResponse struct {
	Title               string   `json:"title"`
	LocationImage       string   `json:"locationImage"`
	BackgroundColor     string   `json:"backgroundColor"`
	FontColor           string   `json:"fontColor"`
	OriginalName        string   `json:"originalName,omitempty"`
	PrimaryAuthor       string   `json:"primaryAuthor,omitempty"`
	ContributingAuthors []string `json:"contributingAuthors,omitempty"`
	VersionAdded        string   `json:"versionAdded"`
	VersionsUpdated     []string `json:"versionsUpdated"`
	VersionRemoved      string   `json:"versionRemoved,omitempty"`
	VersionGaps         []string `json:"versionGaps"`
}

type LocationsResponse

type LocationsResponse struct {
	Locations   []LocationResponse `json:"locations"`
	Game        string             `json:"game"`
	ContinueKey string             `json:"continueKey,omitempty"`
}

type Minigame

type Minigame struct {
	Id             string `json:"id"`
	VarId          int    `json:"varId"`
	InitialVarSync bool   `json:"initialVarSync"`
	SwitchId       int    `json:"switchId"`
	SwitchValue    bool   `json:"switchValue"`
	Dev            bool   `json:"dev"`
}

type Notification

type Notification struct {
	Title string `json:"title"`

	Metadata NotificationMetadata `json:"metadata"`

	Body string `json:"body,omitempty"`

	Icon string `json:"icon,omitempty"`
	// the image to be used on a phone's status bar
	Badge string `json:"badge,omitempty"`
	Image string `json:"image,omitempty"`

	Data *json.RawMessage `json:"data,omitempty"`

	// Unix timestamp, in milliseconds
	Timestamp int64 `json:"timestamp,omitempty"`
}

Mirrors the `options` parameter of https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification

func (*Notification) SetDefaults

func (n *Notification) SetDefaults()

type NotificationMetadata

type NotificationMetadata struct {
	// Necessary for client-side muting of notifications.
	Category string `json:"category"`
	Type     string `json:"type"`
	// Specify an icon predefined by frontend.
	YnoIcon string `json:"ynoIcon,omitempty"`
	// If set, this notification should not be relayed to an active frontend client
	NoRelay bool `json:"noRelay"`
	// If not set, by default toasts disappear after some time.
	Persist bool `json:"persist"`
}

type Party

type Party struct {
	Id          int                   `json:"id"`
	Name        string                `json:"name"`
	Public      bool                  `json:"public"`
	Pass        string                `json:"-"`
	SystemName  string                `json:"systemName"`
	Description string                `json:"description"`
	OwnerUuid   string                `json:"ownerUuid"`
	Members     []*PlayerListFullData `json:"members"`
}

type PathLocation

type PathLocation struct {
	Title      string                    `json:"title"`
	TitleJP    string                    `json:"titleJP"`
	ConnType   int                       `json:"connType"`
	TypeParams map[string]ConnTypeParams `json:"typeParams"`
	Depth      int                       `json:"depth"`
}

type PathLocations

type PathLocations struct {
	Locations []PathLocation `json:"locations"`
}

type Picture

type Picture struct {
	// contains filtered or unexported fields
}

type PlayerBadge

type PlayerBadge struct {
	BadgeId         string   `json:"badgeId"`
	Game            string   `json:"game"`
	Group           string   `json:"group"`
	Bp              int      `json:"bp"`
	MapId           int      `json:"mapId"`
	MapX            int      `json:"mapX"`
	MapY            int      `json:"mapY"`
	Seconds         int      `json:"seconds"`
	Secret          bool     `json:"secret"`
	SecretCondition bool     `json:"secretCondition"`
	Hidden          bool     `json:"hidden"`
	OverlayType     int      `json:"overlayType"`
	Art             string   `json:"art"`
	Animated        bool     `json:"animated"`
	Percent         float32  `json:"percent"`
	Goals           int      `json:"goals"`
	GoalsTotal      int      `json:"goalsTotal"`
	Tags            []string `json:"tags"`
	Unlocked        bool     `json:"unlocked"`
	NewUnlock       bool     `json:"newUnlock"`
}

type PlayerFriend

type PlayerFriend struct {
	PlayerListFullData
	Game     string `json:"game"`
	Incoming bool   `json:"incoming"`
	Accepted bool   `json:"accepted"`
}

type PlayerInfo

type PlayerInfo struct {
	Uuid            string `json:"uuid"`
	Name            string `json:"name"`
	Rank            int    `json:"rank"`
	Badge           string `json:"badge"`
	BadgeSlotRows   int    `json:"badgeSlotRows"`
	BadgeSlotCols   int    `json:"badgeSlotCols"`
	ScreenshotLimit int    `json:"screenshotLimit"`
	Medals          [5]int `json:"medals"`
	LocationIds     []int  `json:"locationIds"`
}

type PlayerListData

type PlayerListData struct {
	Uuid       string `json:"uuid"`
	Name       string `json:"name"`
	SystemName string `json:"systemName"`
	Rank       int    `json:"rank"`
	Account    bool   `json:"account"`
	Badge      string `json:"badge"`
	Medals     [5]int `json:"medals"`

	SpriteName  string `json:"spriteName"`
	SpriteIndex int    `json:"spriteIndex"`
}

type PlayerListFullData

type PlayerListFullData struct {
	PlayerListData

	MapId         string `json:"mapId,omitempty"`
	PrevMapId     string `json:"prevMapId,omitempty"`
	PrevLocations string `json:"prevLocations,omitempty"`
	X             int    `json:"x"`
	Y             int    `json:"y"`

	Online     bool      `json:"online"`
	LastActive time.Time `json:"lastActive"`
}

type PlayerScreenshotData

type PlayerScreenshotData struct {
	Id         string    `json:"id"`
	Uuid       string    `json:"uuid"`
	Game       string    `json:"game"`
	MapId      string    `json:"mapId"`
	MapX       int       `json:"mapX"`
	MapY       int       `json:"mapY"`
	SystemName string    `json:"systemName"`
	Timestamp  time.Time `json:"timestamp"`
	Public     bool      `json:"public"`
	Spoiler    bool      `json:"spoiler"`
	LikeCount  int       `json:"likeCount"`
	Liked      bool      `json:"liked"`
}

type Room

type Room struct {
	// contains filtered or unexported fields
}

type RoomClient

type RoomClient struct {
	// contains filtered or unexported fields
}

RoomClient

type SClientMap

type SClientMap struct {
	// contains filtered or unexported fields
}

func NewSCMap

func NewSCMap() *SClientMap

func (*SClientMap) Delete

func (m *SClientMap) Delete(uuid string)

func (*SClientMap) Exists

func (m *SClientMap) Exists(uuid string) bool

func (*SClientMap) Get

func (m *SClientMap) Get() []*SessionClient

func (*SClientMap) GetAmount

func (m *SClientMap) GetAmount() int

func (*SClientMap) Load

func (m *SClientMap) Load(uuid string) (*SessionClient, bool)

func (*SClientMap) Store

func (m *SClientMap) Store(uuid string, client *SessionClient)

type ScheduleDisplay

type ScheduleDisplay struct {
	ScheduleUpdate
	Id            int  `json:"id,omitempty"`
	FollowerCount int  `json:"followerCount"`
	PlayerLiked   bool `json:"playerLiked"`

	OwnerName       string `json:"ownerName"`
	OwnerRank       int    `json:"ownerRank"`
	OwnerSystemName string `json:"ownerSystemName"`
	OwnerBadge      string `json:"ownerString"`
}

type SchedulePlatforms

type SchedulePlatforms struct {
	Discord  string `json:"discord,omitempty"`
	Youtube  string `json:"youtube,omitempty"`
	Twitch   string `json:"twitch,omitempty"`
	Niconico string `json:"niconico,omitempty"`
	Openrec  string `json:"openrec,omitempty"`
	Bilibili string `json:"bilibili,omitempty"`
}

type ScheduleUpdate

type ScheduleUpdate struct {
	SchedulePlatforms
	Name          string    `json:"name"`
	Description   string    `json:"description"`
	OwnerUuid     string    `json:"ownerUuid"`
	PartyId       int       `json:"partyId"`
	Game          string    `json:"game"`
	Recurring     bool      `json:"recurring"`
	Official      bool      `json:"official"`
	IntervalValue int       `json:"interval"`
	IntervalType  string    `json:"intervalType"`
	Datetime      time.Time `json:"datetime"`
	SystemName    string    `json:"systemName"`
}

type ScreenshotData

type ScreenshotData struct {
	Id        string           `json:"id"`
	Owner     *ScreenshotOwner `json:"owner"`
	Game      string           `json:"game"`
	MapId     string           `json:"mapId"`
	MapX      int              `json:"mapX"`
	MapY      int              `json:"mapY"`
	Timestamp time.Time        `json:"timestamp"`
	Public    bool             `json:"public"`
	Spoiler   bool             `json:"spoiler"`
	LikeCount int              `json:"likeCount"`
	Liked     bool             `json:"liked"`
}

type ScreenshotOwner

type ScreenshotOwner struct {
	Uuid       string `json:"uuid"`
	Name       string `json:"name"`
	Rank       int    `json:"rank"`
	Badge      string `json:"badge"`
	SystemName string `json:"systemName"`
}

type SendReportLogArgs

type SendReportLogArgs struct {
	Uuid, YnoMsgId, OriginalMsg string
}

type SessionClient

type SessionClient struct {
	// contains filtered or unexported fields
}

SessionClient

type SimplePlayerBadge

type SimplePlayerBadge struct {
	BadgeId     string `json:"badgeId"`
	Game        string `json:"game"`
	Group       string `json:"group"`
	Bp          int    `json:"bp"`
	Hidden      bool   `json:"hidden"`
	OverlayType int    `json:"overlayType"`
	Animated    bool   `json:"animated"`
	Unlocked    bool   `json:"unlocked"`
	NewUnlock   bool   `json:"newUnlock"`
}

type TimeTrialRecord

type TimeTrialRecord struct {
	MapId   int `json:"mapId"`
	Seconds int `json:"seconds"`
}

type Void

type Void struct{}

type WebhookRequest

type WebhookRequest struct {
	Username        string `json:"username"`
	AvatarUrl       string `json:"avatar_url"`
	Content         string `json:"content"`
	AllowedMentions struct {
		Parse []string `json:"parse"`
	} `json:"allowed_mentions"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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