Documentation
¶
Index ¶
- Constants
- Variables
- type GMCPBiomeColor
- type GMCPBiomeEntry
- type GMCPCharModule
- type GMCPCharModule_Enemy
- type GMCPCharModule_Payload
- type GMCPCharModule_Payload_Affect
- type GMCPCharModule_Payload_Info
- type GMCPCharModule_Payload_Inventory
- type GMCPCharModule_Payload_Inventory_Backpack
- type GMCPCharModule_Payload_Inventory_Backpack_Summary
- type GMCPCharModule_Payload_Inventory_Item
- type GMCPCharModule_Payload_Inventory_Worn
- type GMCPCharModule_Payload_Job
- type GMCPCharModule_Payload_Kills
- type GMCPCharModule_Payload_Kills_PvpEntry
- type GMCPCharModule_Payload_Kills_PvpSection
- type GMCPCharModule_Payload_Kills_Section
- type GMCPCharModule_Payload_Pet
- type GMCPCharModule_Payload_Pet_Ability
- type GMCPCharModule_Payload_Quest
- type GMCPCharModule_Payload_Skill
- type GMCPCharModule_Payload_Stats
- type GMCPCharModule_Payload_Vitals
- type GMCPCharModule_Payload_Worth
- type GMCPCharUpdate
- type GMCPCommModule
- type GMCPCommModule_Payload
- type GMCPDiscordMessage
- type GMCPDiscordStatusRequest
- type GMCPGameModule
- type GMCPGamePlayer
- type GMCPGameRequest
- type GMCPGametimeModule
- type GMCPGametimeModule_Payload
- type GMCPHello
- type GMCPHelpModule
- type GMCPHelpPayload
- type GMCPHelpRequest
- type GMCPLogin
- type GMCPModule
- type GMCPMudletDetected
- type GMCPMudletModule
- type GMCPOut
- type GMCPPartyModule
- type GMCPPartyModule_Payload
- type GMCPPartyModule_Payload_User
- type GMCPPartyModule_Payload_Vitals
- type GMCPRequest
- type GMCPRoomModule
- type GMCPRoomModule_Payload
- type GMCPRoomModule_Payload_Contents
- type GMCPRoomModule_Payload_Contents_Character
- type GMCPRoomModule_Payload_Contents_Container
- type GMCPRoomModule_Payload_Contents_ExitInfo
- type GMCPRoomModule_Payload_Contents_Item
- type GMCPRoomUpdate
- type GMCPSettings
- type GMCPSuggestionModule
- type GMCPSuggestionPayload
- type GMCPSuggestionRequest
- type GMCPSupportsRemove
- type GMCPSupportsSet
- type GMCPWorldMap_Payload
- type GMCPWorldMap_RoomEntry
- type GMCPWorldModule
- type GMCPWorldUpdate
- type MudletConfig
- type PartyUpdateVitals
Constants ¶
const (
TELNET_GMCP term.IACByte = 201 // https://tintin.mudhalla.net/protocols/gmcp/
)
Variables ¶
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 GMCPBiomeColor ¶ added in v0.9.8
type GMCPBiomeColor struct {
FG string `json:"fg"` // e.g. "#00aa00", "" = no override
BG string `json:"bg"` // e.g. "#003300", "" = no override
}
GMCPBiomeColor holds pre-converted CSS hex colors for a biome or symbol override. An empty string means no color override is set.
type GMCPBiomeEntry ¶ added in v0.9.8
type GMCPBiomeEntry struct {
Name string `json:"name"`
Symbol string `json:"symbol"`
Color GMCPBiomeColor `json:"color"`
SymbolOverrides map[string]GMCPBiomeColor `json:"overrides,omitempty"`
}
GMCPBiomeEntry is the per-biome record included in the World.Map biomes lookup table. It contains everything window-map.js needs to colorize rooms without making any additional API calls.
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"`
Skills []GMCPCharModule_Payload_Skill `json:"Skills,omitempty"`
Jobs []GMCPCharModule_Payload_Job `json:"Jobs,omitempty"`
Kills *GMCPCharModule_Payload_Kills `json:"Kills,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_left"`
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"`
Role string `json:"role"`
SkillPoints int `json:"skillpoints"`
TrainingPoints int `json:"trainingpoints"`
}
///////////////// 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_Worn ¶
type GMCPCharModule_Payload_Inventory_Worn map[string]GMCPCharModule_Payload_Inventory_Item
GMCPCharModule_Payload_Inventory_Worn is keyed by slot name (e.g. "weapon", "head") and serialises to the same JSON object shape that the named-struct version produced. Using a map means the field set tracks items.AllEquipSlots() automatically; no manual update is needed when slots are added or removed.
type GMCPCharModule_Payload_Job ¶ added in v0.9.8
type GMCPCharModule_Payload_Job struct {
Name string `json:"name"`
Completion int `json:"completion"`
Proficiency string `json:"proficiency"`
}
///////////////// Char.Jobs /////////////////
type GMCPCharModule_Payload_Kills ¶ added in v0.9.8
type GMCPCharModule_Payload_Kills struct {
Mob GMCPCharModule_Payload_Kills_Section `json:"mob"`
Pvp GMCPCharModule_Payload_Kills_PvpSection `json:"pvp"`
}
///////////////// Char.Kills /////////////////
type GMCPCharModule_Payload_Kills_PvpEntry ¶ added in v0.9.8
type GMCPCharModule_Payload_Kills_PvpEntry struct {
Count int `json:"count"`
}
type GMCPCharModule_Payload_Kills_PvpSection ¶ added in v0.9.8
type GMCPCharModule_Payload_Kills_PvpSection struct {
Total int `json:"total"`
Deaths int `json:"deaths"`
KDRatio float64 `json:"kd_ratio"`
Players map[string]GMCPCharModule_Payload_Kills_PvpEntry `json:"players"`
}
type GMCPCharModule_Payload_Kills_Section ¶ added in v0.9.8
type GMCPCharModule_Payload_Kills_Section struct {
Total int `json:"total"`
Deaths int `json:"deaths"`
KDRatio float64 `json:"kd_ratio"`
EliteKills int `json:"elite_kills"`
ByName map[string]int `json:"by_name"`
ByElite map[string]int `json:"by_elite"`
ByRace map[string]int `json:"by_race"`
ByArea map[string]int `json:"by_area"`
}
type GMCPCharModule_Payload_Pet ¶
type GMCPCharModule_Payload_Pet struct {
Name string `json:"name"`
Type string `json:"type"`
Level int `json:"level"`
Hunger string `json:"hunger"`
Ability *GMCPCharModule_Payload_Pet_Ability `json:"ability,omitempty"`
Buffs []string `json:"buffs"`
Items []GMCPCharModule_Payload_Inventory_Item `json:"items"`
Capacity int `json:"capacity"`
}
///////////////// Char.Pets /////////////////
type GMCPCharModule_Payload_Pet_Ability ¶ added in v0.9.8
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_Skill ¶ added in v0.9.8
type GMCPCharModule_Payload_Skill struct {
Name string `json:"name"`
Level int `json:"level"`
Maximum bool `json:"maximum,omitempty"`
}
///////////////// Char.Skills /////////////////
type GMCPCharModule_Payload_Stats ¶
type GMCPCharModule_Payload_Stats struct {
Strength int `json:"strength,omitempty"`
StrengthMod int `json:"strengthmod,omitempty"`
Speed int `json:"speed,omitempty"`
SpeedMod int `json:"speedmod,omitempty"`
Smarts int `json:"smarts,omitempty"`
SmartsMod int `json:"smartsmod,omitempty"`
Vitality int `json:"vitality,omitempty"`
VitalityMod int `json:"vitalitymod,omitempty"`
Mysticism int `json:"mysticism,omitempty"`
MysticismMod int `json:"mysticismmod,omitempty"`
Perception int `json:"perception,omitempty"`
PerceptionMod int `json:"perceptionmod,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"`
TNL int `json:"tnl,omitempty"`
XP int `json:"xp,omitempty"`
}
///////////////// Char.Worth /////////////////
type GMCPCharUpdate ¶
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 GMCPDiscordMessage ¶
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 ¶
func (g GMCPDiscordStatusRequest) Type() string
type GMCPGameModule ¶
type GMCPGameModule struct {
// contains filtered or unexported fields
}
type GMCPGamePlayer ¶ added in v0.9.8
type GMCPGameRequest ¶ added in v0.9.8
type GMCPGameRequest struct {
UserId int
}
func (GMCPGameRequest) Type ¶ added in v0.9.8
func (g GMCPGameRequest) Type() string
type GMCPGametimeModule ¶ added in v0.9.8
type GMCPGametimeModule struct {
// contains filtered or unexported fields
}
type GMCPGametimeModule_Payload ¶ added in v0.9.8
type GMCPGametimeModule_Payload struct {
Calendar string `json:"calendar"`
Hour int `json:"hour"`
Hour24 int `json:"hour24"`
Minute int `json:"minute"`
AmPm string `json:"ampm"`
Day int `json:"day"`
Month int `json:"month"`
MonthName string `json:"month_name"`
Year int `json:"year"`
Zodiac string `json:"zodiac"`
Night bool `json:"night"`
DayStart int `json:"day_start"`
NightStart int `json:"night_start"`
SunCount int `json:"sun_count"` // expected to be 1 or 2
MoonCount int `json:"moon_count"` // expected to be 0 - 3
}
///////////////// Gametime payload /////////////////
type GMCPHelpModule ¶ added in v0.9.8
type GMCPHelpModule struct {
// contains filtered or unexported fields
}
type GMCPHelpPayload ¶ added in v0.9.8
type GMCPHelpPayload struct {
Title string `json:"title"`
Body string `json:"body"`
Format string `json:"format"` // "terminal" or "html"
}
GMCPHelpPayload is the GMCP payload sent back to the client.
type GMCPHelpRequest ¶ added in v0.9.8
GMCPHelpRequest is fired when the web client sends !!GMCP(Help <topic>)
func (GMCPHelpRequest) Type ¶ added in v0.9.8
func (g GMCPHelpRequest) Type() 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) HandleWebGMCP ¶ added in v0.9.8
func (g *GMCPModule) HandleWebGMCP(connectionId uint64, webGMCP []byte) bool
func (*GMCPModule) IsMudletExportedFunction ¶
func (g *GMCPModule) IsMudletExportedFunction(connectionId uint64) bool
type GMCPMudletDetected ¶
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 GMCPPartyModule ¶
type GMCPPartyModule struct {
// contains filtered or unexported fields
}
func (*GMCPPartyModule) GetPartyNode ¶
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_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
RoomId int `json:"roomid"` // Room ID they are in (0 if unknown/invited)
MapX int `json:"mapx"` // World X coordinate of the room
MapY int `json:"mapy"` // World Y coordinate of the room
MapZ int `json:"mapz"` // World Z coordinate of the room
HasCoordinates bool `json:"hascoordinates"` // Whether the room has map coordinates
Aggro bool `json:"aggro"` // Whether the user is currently in aggro state
}
type GMCPRequest ¶ added in v0.9.8
type GMCPRequest struct {
Name string
}
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"`
MapSymbol string `json:"mapsymbol"`
MapLegend string `json:"maplegend"`
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 GMCPRoomUpdate ¶
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 GMCPSuggestionModule ¶ added in v0.9.8
type GMCPSuggestionModule struct {
// contains filtered or unexported fields
}
type GMCPSuggestionPayload ¶ added in v0.9.8
type GMCPSuggestionPayload struct {
Input string `json:"input"`
Suggestions []string `json:"suggestions"`
}
GMCPSuggestionPayload is the GMCP payload sent back to the client. Input is the original partial text the user typed. Suggestions is the list of fully-completed strings the client may cycle through.
type GMCPSuggestionRequest ¶ added in v0.9.8
GMCPSuggestionRequest is fired when the web client sends !!GMCP(Suggestion <partial-text>)
func (GMCPSuggestionRequest) Type ¶ added in v0.9.8
func (g GMCPSuggestionRequest) Type() string
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 GMCPWorldMap_Payload ¶ added in v0.9.8
type GMCPWorldMap_Payload struct {
Rooms []GMCPWorldMap_RoomEntry `json:"rooms"`
Biomes map[string]GMCPBiomeEntry `json:"biomes"`
}
GMCPWorldMap_Payload is the top-level object sent for World.Map. It bundles the visited-room list with a full biome color lookup table so the client can colorize rooms without any additional API calls.
type GMCPWorldMap_RoomEntry ¶ added in v0.9.8
type GMCPWorldMap_RoomEntry struct {
Id int `json:"num"`
Name string `json:"name"`
Area string `json:"area"`
Environment string `json:"environment"`
Coordinates string `json:"coords"`
MapSymbol string `json:"mapsymbol"`
MapLegend string `json:"maplegend"`
Exits map[string]int `json:"exits"`
ExitsV2 map[string]GMCPRoomModule_Payload_Contents_ExitInfo `json:"exitsv2"`
Details []string `json:"details"`
}
GMCPWorldMap_RoomEntry mirrors the shape of GMCPRoomModule_Payload but omits the live Contents (players, npcs, items) since this is a static visited-rooms snapshot.
type GMCPWorldModule ¶ added in v0.9.8
type GMCPWorldModule struct {
// contains filtered or unexported fields
}
type GMCPWorldUpdate ¶ added in v0.9.8
GMCPWorldUpdate is fired when a client explicitly requests World data.
func (GMCPWorldUpdate) Type ¶ added in v0.9.8
func (g GMCPWorldUpdate) Type() string
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