game_engine

package
v0.0.0-...-227081a Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: Unlicense Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const ServerUser string = "server"
View Source
const SpaceGame string = "./content/space/entities.yml"
View Source
const SpaceGameTest string = "../../content/space/entities.yml"

Variables

This section is empty.

Functions

func SendManagementError

func SendManagementError(title string, message string, pool CampaignPool) error

Types

type ActiveMapBackground

type ActiveMapBackground struct {
	ImageId string `json:"ImageId"`
	MapId   string `json:"MapId"`
}

type AddMapItem

type AddMapItem struct {
	EntityId string `json:"EntityId"`
	MapId    string `json:"MapId"`
}

type CampaignClient

type CampaignClient interface {
	GetId() string
	IsLead() bool
}

type CampaignPool

type CampaignPool interface {
	GetId() uint
	GetLeadId() string
	GetEngine() Engine
	TransmitEventMessage(message EventMessage)
	GetAllClientIds(filterOut ...string) []string
}

type Engine

type Engine interface {
	GetWorld() ecs.World
	SaveWorld(campaignId uint) error
	GetEventMessageHandler() EventMessageHandler
}

func InitGameEngine

func InitGameEngine(campaign models.Campaign) Engine

type EventMessage

type EventMessage struct {
	Id           uuid.UUID `json:"-"`
	Source       string    `json:"source"`
	Destinations []string  `json:"-"`
	Type         EventType `json:"type"`
	Body         string    `json:"body"`
	DateTime     string    `json:"dateTime"`
}

func NewEventMessage

func NewEventMessage() EventMessage

func (*EventMessage) ReloadDateTime

func (m *EventMessage) ReloadDateTime()

type EventMessageHandler

type EventMessageHandler interface {
	HandleEventMessage(message EventMessage, pool CampaignPool) error
}

type EventMessageIdBody

type EventMessageIdBody struct {
	Id   string `json:"Id"`
	Html string `json:"Html"`
}

func (*EventMessageIdBody) ToBodyString

func (midBody *EventMessageIdBody) ToBodyString() string

type EventType

type EventType int
const (
	TypeGameClose EventType = 0
	TypeGameStart EventType = 1
	TypeGameSave  EventType = 2

	TypeUserJoin  EventType = 400
	TypeUserLeave EventType = 401

	TypeLoadFullGame EventType = 500

	TypeLoadCharacters        EventType = 501
	TypeLoadCharactersDetails EventType = 504

	TypeUpdateCharacterHealth EventType = 511
	TypeUpdateCharacterUsers  EventType = 512

	TypeLoadItemDetails EventType = 521

	TypeLoadMap         EventType = 531
	TypeLoadMapEntities EventType = 532
	TypeLoadMapEntity   EventType = 533

	TypeUpdateMapEntity          EventType = 543
	TypeUpdateMapVisibility      EventType = 544
	TypeAddMapItem               EventType = 545
	TypeRemoveMapItem            EventType = 546
	TypeSignalMapItem            EventType = 547
	TypeChangeMapBackgroundImage EventType = 548

	// Management Events
	TypeManagementOverviewStart EventType = 550
	TypeManageMaps              EventType = 551
	TypeManageCharacters        EventType = 552
	TypeManageInventory         EventType = 553
	TypeManageItems             EventType = 554
	TypeManageCampaign          EventType = 555
	TypeManageImages            EventType = 556
	TypeManagementOverviewEnd   EventType = 560

	TypeManagementCrudStart EventType = 5500

	TypeLoadUpsertMap EventType = 5511
	TypeRemoveMap     EventType = 5512
	TypeUpsertMap     EventType = 5513

	TypeLoadUpsertItem EventType = 5541
	TypeUpsertItem     EventType = 5542
	TypeRemoveItem     EventType = 5543

	TypeLoadUpsertCharacter EventType = 5521
	TypeUpsertCharacter     EventType = 5522
	TypeRemoveCharacter     EventType = 5523
	TypeCloneCharacter      EventType = 5524

	TypeLoadUpsertInventory             EventType = 5531
	TypeUpsertInventory                 EventType = 5532
	TypeRemoveInventory                 EventType = 5533
	TypeCloneInventory                  EventType = 5534
	TypeAddItemToInventory              EventType = 5535
	TypeRemoveItemFromInventory         EventType = 5536
	TypeUpdateItemCountInventory        EventType = 5537
	TypeMoveItemCountBetweenInventories EventType = 5538

	TypeManagementCrudEnd EventType = 5600

	TypeManagementError EventType = 5999

	TypeChatBroadcast   EventType = 800
	TypeChatServerMsg   EventType = 801
	TypeChatCommandRoll EventType = 802
	TypeChatWhisper     EventType = 803
)

type OverviewFilter

type OverviewFilter struct {
	Filter string `json:"filter"`
}

type RemoveMapItem

type RemoveMapItem struct {
	MapId     string `json:"MapId"`
	MapItemId string `json:"Id"`
}

type SendNewMapBackgroundImage

type SendNewMapBackgroundImage struct {
	Id    string `json:"Id"`
	MapId string `json:"MapId"`
	Url   string `json:"Url"`
}

type SendSignal

type SendSignal struct {
	Id   string `json:"Id"`
	X    string `json:"X"`
	Y    string `json:"Y"`
	Type string `json:"Type"`
	Html string `json:"Html"`
}

type SetActivity

type SetActivity struct {
	Id     string `json:"Id"`
	Active bool   `json:"Active"`
}

Jump to

Keyboard shortcuts

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