gmcp

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

Variables

View Source
var (
	///////////////////////////
	// GMCP COMMANDS
	///////////////////////////
	GmcpEnable  = term.TerminalCommand{Chars: []byte{term.TELNET_IAC, term.TELNET_WILL, TELNET_GMCP}, EndChars: []byte{}} // Indicates the server wants to enable GMCP.
	GmcpDisable = term.TerminalCommand{Chars: []byte{term.TELNET_IAC, term.TELNET_WONT, TELNET_GMCP}, EndChars: []byte{}} // Indicates the server wants to disable GMCP.

	GmcpAccept = term.TerminalCommand{Chars: []byte{term.TELNET_IAC, term.TELNET_DO, TELNET_GMCP}, EndChars: []byte{}}   // Indicates the client accepts GMCP sub-negotiations.
	GmcpRefuse = term.TerminalCommand{Chars: []byte{term.TELNET_IAC, term.TELNET_DONT, TELNET_GMCP}, EndChars: []byte{}} // Indicates the client refuses GMCP sub-negotiations.

	GmcpPayload    = term.TerminalCommand{Chars: []byte{term.TELNET_IAC, term.TELNET_SB, TELNET_GMCP}, EndChars: []byte{term.TELNET_IAC, term.TELNET_SE}} // Wrapper for sending GMCP payloads
	GmcpWebPayload = term.TerminalCommand{Chars: []byte("!!GMCP("), EndChars: []byte{')'}}                                                                // Wrapper for sending GMCP payloads

)

Functions

This section is empty.

Types

type GMCPCharModule

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

func (*GMCPCharModule) GetCharNode

func (g *GMCPCharModule) GetCharNode(user *users.UserRecord, gmcpModule string) (data any, moduleName string)

type GMCPCharModule_Enemy

type GMCPCharModule_Enemy struct {
	Id      string `json:"id"`
	Name    string `json:"name"`
	Level   int    `json:"level"`
	Hp      int    `json:"hp"`
	MaxHp   int    `json:"hp_max"`
	Engaged bool   `json:"engaged"`
}

///////////////// Char.Enemies /////////////////

type GMCPCharModule_Payload

type GMCPCharModule_Payload struct {
	Info      *GMCPCharModule_Payload_Info             `json:"Info,omitempty"`
	Affects   map[string]GMCPCharModule_Payload_Affect `json:"Affects,omitempty"`
	Enemies   []GMCPCharModule_Enemy                   `json:"Enemies,omitempty"`
	Inventory *GMCPCharModule_Payload_Inventory        `json:"Inventory,omitempty"`
	Stats     *GMCPCharModule_Payload_Stats            `json:"Stats,omitempty"`
	Vitals    *GMCPCharModule_Payload_Vitals           `json:"Vitals,omitempty"`
	Worth     *GMCPCharModule_Payload_Worth            `json:"Worth,omitempty"`
	Quests    []GMCPCharModule_Payload_Quest           `json:"Quests,omitempty"`
	Pets      []GMCPCharModule_Payload_Pet             `json:"Pets,omitempty"`
}

type GMCPCharModule_Payload_Affect

type GMCPCharModule_Payload_Affect struct {
	Name         string         `json:"name"`
	Description  string         `json:"description"`
	DurationMax  int            `json:"duration_max"`
	DurationLeft int            `json:"duration_cur"`
	Type         string         `json:"type"`
	Mods         map[string]int `json:"affects"`
}

///////////////// Char.Affects /////////////////

type GMCPCharModule_Payload_Info

type GMCPCharModule_Payload_Info struct {
	Account   string `json:"account,omitempty"`
	Name      string `json:"name,omitempty"`
	Class     string `json:"class,omitempty"`
	Race      string `json:"race,omitempty"`
	Alignment string `json:"alignment,omitempty"`
	Level     int    `json:"level,omitempty"`
}

///////////////// Char.Info /////////////////

type GMCPCharModule_Payload_Inventory

type GMCPCharModule_Payload_Inventory struct {
	Backpack *GMCPCharModule_Payload_Inventory_Backpack `json:"Backpack,omitempty"`
	Worn     *GMCPCharModule_Payload_Inventory_Worn     `json:"Worn"`
}

///////////////// Char.Inventory /////////////////

type GMCPCharModule_Payload_Inventory_Backpack

type GMCPCharModule_Payload_Inventory_Backpack struct {
	Items   []GMCPCharModule_Payload_Inventory_Item           `json:"items,omitempty"`
	Summary GMCPCharModule_Payload_Inventory_Backpack_Summary `json:"Summary,omitempty"`
}

type GMCPCharModule_Payload_Inventory_Backpack_Summary

type GMCPCharModule_Payload_Inventory_Backpack_Summary struct {
	Count int `json:"count,omitempty"`
	Max   int `json:"max,omitempty"`
}

type GMCPCharModule_Payload_Inventory_Item

type GMCPCharModule_Payload_Inventory_Item struct {
	Id      string   `json:"id"`
	Name    string   `json:"name"`
	Type    string   `json:"type"`
	SubType string   `json:"subtype"`
	Uses    int      `json:"uses"`
	Details []string `json:"details"`
}

type GMCPCharModule_Payload_Inventory_Worn

type GMCPCharModule_Payload_Inventory_Worn struct {
	Weapon  GMCPCharModule_Payload_Inventory_Item `json:"weapon,omitempty"`
	Offhand GMCPCharModule_Payload_Inventory_Item `json:"offhand,omitempty"`
	Head    GMCPCharModule_Payload_Inventory_Item `json:"head,omitempty"`
	Neck    GMCPCharModule_Payload_Inventory_Item `json:"neck,omitempty"`
	Body    GMCPCharModule_Payload_Inventory_Item `json:"body,omitempty"`
	Belt    GMCPCharModule_Payload_Inventory_Item `json:"belt,omitempty"`
	Gloves  GMCPCharModule_Payload_Inventory_Item `json:"gloves,omitempty"`
	Ring    GMCPCharModule_Payload_Inventory_Item `json:"ring,omitempty"`
	Legs    GMCPCharModule_Payload_Inventory_Item `json:"legs,omitempty"`
	Feet    GMCPCharModule_Payload_Inventory_Item `json:"feet,omitempty"`
}

type GMCPCharModule_Payload_Pet

type GMCPCharModule_Payload_Pet struct {
	Name   string `json:"name"`
	Type   string `json:"type"`
	Hunger string `json:"hunger"`
}

///////////////// Char.Pets /////////////////

type GMCPCharModule_Payload_Quest

type GMCPCharModule_Payload_Quest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Completion  int    `json:"completion"`
}

///////////////// Char.Quests /////////////////

type GMCPCharModule_Payload_Stats

type GMCPCharModule_Payload_Stats struct {
	Strength   int `json:"strength,omitempty"`
	Speed      int `json:"speed,omitempty"`
	Smarts     int `json:"smarts,omitempty"`
	Vitality   int `json:"vitality,omitempty"`
	Mysticism  int `json:"mysticism,omitempty"`
	Perception int `json:"perception,omitempty"`
}

///////////////// Char.Stats /////////////////

type GMCPCharModule_Payload_Vitals

type GMCPCharModule_Payload_Vitals struct {
	Hp    int `json:"hp,omitempty"`
	HpMax int `json:"hp_max,omitempty"`
	Sp    int `json:"sp,omitempty"`
	SpMax int `json:"sp_max,omitempty"`
}

///////////////// Char.Vitals /////////////////

type GMCPCharModule_Payload_Worth

type GMCPCharModule_Payload_Worth struct {
	Gold           int `json:"gold_carry,omitempty"`
	Bank           int `json:"gold_bank,omitempty"`
	SkillPoints    int `json:"skillpoints,omitempty"`
	TrainingPoints int `json:"trainingpoints,omitempty"`
	TNL            int `json:"tnl,omitempty"`
	XP             int `json:"xp,omitempty"`
}

///////////////// Char.Worth /////////////////

type GMCPCharUpdate

type GMCPCharUpdate struct {
	UserId     int
	Identifier string
}

Tell the system a wish to send specific GMCP Update data

func (GMCPCharUpdate) Type

func (g GMCPCharUpdate) Type() string

type GMCPCommModule

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

type GMCPCommModule_Payload

type GMCPCommModule_Payload struct {
	Channel string `json:"channel"`
	Sender  string `json:"sender"`
	Source  string `json:"source"`
	Text    string `json:"text"`
}

type GMCPDiscordMessage

type GMCPDiscordMessage struct {
	ConnectionId uint64
	Command      string
	Payload      []byte
}

GMCPDiscordMessage is an event fired when a client sends a Discord-related GMCP message

func (GMCPDiscordMessage) Type

func (g GMCPDiscordMessage) Type() string

type GMCPDiscordStatusRequest

type GMCPDiscordStatusRequest struct {
	UserId int
}

GMCPDiscordStatusRequest is an event fired when a client requests Discord status information

func (GMCPDiscordStatusRequest) Type

type GMCPGameModule

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

type GMCPHello

type GMCPHello struct {
	Client  string
	Version string
}

type GMCPLogin

type GMCPLogin struct {
	Name     string
	Password string
}

type GMCPModule

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

/////////////////// END EVENTS ///////////////////

func (*GMCPModule) HandleIAC

func (g *GMCPModule) HandleIAC(connectionId uint64, iacCmd []byte) bool

func (*GMCPModule) IsMudletExportedFunction

func (g *GMCPModule) IsMudletExportedFunction(connectionId uint64) bool

type GMCPMudletDetected

type GMCPMudletDetected struct {
	ConnectionId uint64
	UserId       int
}

GMCPMudletDetected is an event fired when a Mudlet client is detected

func (GMCPMudletDetected) Type

func (g GMCPMudletDetected) Type() string

type GMCPMudletModule

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

GMCPMudletModule handles Mudlet-specific GMCP functionality

type GMCPOut

type GMCPOut struct {
	UserId  int
	Module  string
	Payload any
}

func (GMCPOut) Type

func (g GMCPOut) Type() string

type GMCPPartyModule

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

func (*GMCPPartyModule) GetPartyNode

func (g *GMCPPartyModule) GetPartyNode(party *parties.Party, gmcpModule string) (data any, moduleName string)

type GMCPPartyModule_Payload

type GMCPPartyModule_Payload struct {
	Leader  string
	Members []GMCPPartyModule_Payload_User
	Invited []GMCPPartyModule_Payload_User
	Vitals  map[string]GMCPPartyModule_Payload_Vitals
}

type GMCPPartyModule_Payload_User

type GMCPPartyModule_Payload_User struct {
	Name     string `json:"name"`
	Status   string `json:"status"`   // party/leader/invited
	Position string `json:"position"` // frontrank/middle/backrank
}

type GMCPPartyModule_Payload_Vitals

type GMCPPartyModule_Payload_Vitals struct {
	Level         int    `json:"level"`    // level of user
	HealthPercent int    `json:"health"`   // 1 = 1%, 23 = 23% etc.
	Location      string `json:"location"` // Title of room they are in
}

type GMCPRoomModule

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

func (*GMCPRoomModule) GetRoomNode

func (g *GMCPRoomModule) GetRoomNode(user *users.UserRecord, gmcpModule string) (data any, moduleName string)

type GMCPRoomModule_Payload

type GMCPRoomModule_Payload struct {
	Id          int                                                 `json:"num"`
	Name        string                                              `json:"name"`
	Area        string                                              `json:"area"`
	Environment string                                              `json:"environment"`
	Coordinates string                                              `json:"coords"`
	Exits       map[string]int                                      `json:"exits"`
	ExitsV2     map[string]GMCPRoomModule_Payload_Contents_ExitInfo `json:"exitsv2"`
	Details     []string                                            `json:"details"`
	Contents    GMCPRoomModule_Payload_Contents                     `json:"Contents"`
}

type GMCPRoomModule_Payload_Contents

type GMCPRoomModule_Payload_Contents struct {
	Players    []GMCPRoomModule_Payload_Contents_Character `json:"Players"`
	Npcs       []GMCPRoomModule_Payload_Contents_Character `json:"Npcs"`
	Items      []GMCPRoomModule_Payload_Contents_Item      `json:"Items"`
	Containers []GMCPRoomModule_Payload_Contents_Container `json:"Containers"`
}

///////////////// Room.Contents /////////////////

type GMCPRoomModule_Payload_Contents_Character

type GMCPRoomModule_Payload_Contents_Character struct {
	Id         string   `json:"id"`
	Name       string   `json:"name"`
	Adjectives []string `json:"adjectives"`
	Aggro      bool     `json:"aggro"`
	QuestFlag  bool     `json:"quest_flag"`
}

type GMCPRoomModule_Payload_Contents_Container

type GMCPRoomModule_Payload_Contents_Container struct {
	Name         string `json:"name"`
	Locked       bool   `json:"locked"`
	HasKey       bool   `json:"haskey"`
	HasPickCombo bool   `json:"haspickcombo"`
	Usable       bool   `json:"usable"`
}

type GMCPRoomModule_Payload_Contents_ExitInfo

type GMCPRoomModule_Payload_Contents_ExitInfo struct {
	RoomId  int      `json:"num"`
	DeltaX  int      `json:"dx"`
	DeltaY  int      `json:"dy"`
	DeltaZ  int      `json:"dz"`
	Details []string `json:"details"`
}

type GMCPRoomModule_Payload_Contents_Item

type GMCPRoomModule_Payload_Contents_Item struct {
	Id        string `json:"id"`
	Name      string `json:"name"`
	QuestFlag bool   `json:"quest_flag"`
}

type GMCPRoomUpdate

type GMCPRoomUpdate struct {
	UserId     int
	Identifier string
}

Tell the system a wish to send specific GMCP Update data

func (GMCPRoomUpdate) Type

func (g GMCPRoomUpdate) Type() string

type GMCPSettings

type GMCPSettings struct {
	Client struct {
		Name     string
		Version  string
		IsMudlet bool // Knowing whether is a mudlet client can be useful, since Mudlet hates certain ANSI/Escape codes.
	}
	GMCPAccepted   bool           // Do they accept GMCP data?
	EnabledModules map[string]int // What modules/versions are accepted? Might not be used properly by clients.
}

/ SETTINGS

func (*GMCPSettings) IsMudlet

func (gs *GMCPSettings) IsMudlet() bool

type GMCPSupportsRemove

type GMCPSupportsRemove = []string

type GMCPSupportsSet

type GMCPSupportsSet []string

func (GMCPSupportsSet) GetSupportedModules

func (s GMCPSupportsSet) GetSupportedModules() map[string]int

Returns a map of module name to version number

type MudletConfig

type MudletConfig struct {
	// Mapper configuration
	MapperVersion string `json:"mapper_version" yaml:"mapper_version"`
	MapperURL     string `json:"mapper_url" yaml:"mapper_url"`

	// UI configuration
	UIVersion string `json:"ui_version" yaml:"ui_version"`
	UIURL     string `json:"ui_url" yaml:"ui_url"`

	// Map data configuration
	MapVersion string `json:"map_version" yaml:"map_version"`
	MapURL     string `json:"map_url" yaml:"map_url"`

	// Discord Rich Presence configuration
	DiscordApplicationID string `json:"discord_application_id" yaml:"discord_application_id"`
	DiscordInviteURL     string `json:"discord_invite_url" yaml:"discord_invite_url"`
	DiscordLargeImageKey string `json:"discord_large_image_key" yaml:"discord_large_image_key"`
	DiscordDetails       string `json:"discord_details" yaml:"discord_details"`
	DiscordState         string `json:"discord_state" yaml:"discord_state"`
	DiscordSmallImageKey string `json:"discord_small_image_key" yaml:"discord_small_image_key"`
}

MudletConfig holds the configuration for Mudlet clients

type PartyUpdateVitals

type PartyUpdateVitals struct {
	LeaderId int
}

This is a uniqu event so that multiple party members moving thorugh an area all at once don't queue up a bunch for just one party

func (PartyUpdateVitals) Type

func (g PartyUpdateVitals) Type() string

func (PartyUpdateVitals) UniqueID

func (g PartyUpdateVitals) UniqueID() string

Jump to

Keyboard shortcuts

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