serverpacket

package
v0.0.0-...-b0deb01 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StartingLocations = []StartingLocation{
	{"New Haven", "New Haven Bank"},
	{"Yew", "The Empath Abbey"},
	{"Minoc", "The Barnacle"},
	{"Britain", "The Wayfarer's Inn"},
	{"Moonglow", "The Scholars Inn"},
	{"Trinsic", "The Traveler's Inn"},
	{"Jhelom", "The Mercenary Inn"},
	{"Skara Brae", "The Falconer's Inn"},
	{"Vesper", "The Ironwood Inn"},
}

StartingLocations is the list of starting locations in correct order.

Functions

This section is empty.

Types

type AddItemToContainer

type AddItemToContainer struct {
	// The ID of the item being added to the container
	Item uo.Serial
	// Graphic of the item being added to the container
	Graphic uo.Graphic
	// Graphic offset of the item
	GraphicOffset int
	// Stack amount, truncated to 0-0xFFFF inclusive
	Amount int
	// Location of the item in the container. X=Y=0xFFFF means random location.
	Location uo.Location
	// The ID of the container and container gump to add this item to
	Container uo.Serial
	// Hue of the item
	Hue uo.Hue
}

AddItemToContainer adds an item to an already-open container gump.

func (*AddItemToContainer) Write

func (p *AddItemToContainer) Write(w io.Writer)

Write implements the Packet interface.

type Animation

type Animation struct {
	// Serial of the mobile to animate
	Serial uo.Serial
	// Animation type
	AnimationType uo.AnimationType
	// Animation action
	AnimationAction uo.AnimationAction
}

Animation tells the client to animate a mobile.

func (*Animation) Write

func (p *Animation) Write(w io.Writer)

Write implements the Packet interface.

type BuyWindow

type BuyWindow struct {
	// Serial of the container of the buy window.
	Serial uo.Serial
	// The list of items in the container in normal order. The Write method
	// takes care of reversing the order.
	Items []ContentsItem
}

BuyWindow transfers the buy window details to the client.

func (*BuyWindow) Write

func (p *BuyWindow) Write(w io.Writer)

Write implements the Packet interface.

type CharacterList

type CharacterList struct {
	// Names of all of the characters, empty string for open slots.
	Names []string
}

CharacterList is sent on game server login and lists all characters on the account as well as the new character starting locations.

func (*CharacterList) Write

func (p *CharacterList) Write(w io.Writer)

Write implements the Packet interface.

type ClientViewRange

type ClientViewRange struct {
	// The demanded range
	Range byte
}

ClientViewRange sets the client's view range

func (*ClientViewRange) Write

func (p *ClientViewRange) Write(w io.Writer)

Write implements the Packet interface.

type ClilocMessage

type ClilocMessage struct {
	// Serial of the speaker
	Speaker uo.Serial
	// Body of the speaker
	Body uo.Body
	// Hue of the text
	Hue uo.Hue
	// Font of the text
	Font uo.Font
	// Cliloc message number
	Cliloc uo.Cliloc
	// Name of the speaker
	Name string
	// List of arguments for the message
	Arguments []string
}

ClilocMessage sends a localized message to the client.

func (*ClilocMessage) Write

func (p *ClilocMessage) Write(w io.Writer)

Write implements the Packet interface.

type CloseGump

type CloseGump struct {
	// Serial of the gump to close
	Gump uo.Serial
	// Button response for the gump response packet, use 0 for close gump
	Button int
}

CloseGump sends a force gump close BF subcommand to forcefully close a gump on the client.

func (*CloseGump) Write

func (p *CloseGump) Write(w io.Writer)

Write implements the Packet interface.

type CompressedWriter

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

CompressedWriter wraps the process of writting compressed server packets.

func NewCompressedWriter

func NewCompressedWriter() *CompressedWriter

NewCompressedWriter returns a CompressedWriter ready for use.

func (*CompressedWriter) Write

func (c *CompressedWriter) Write(p Packet, w io.Writer) error

Write writes p to w with compression and returns any error from w.Write().

type ConnectToGameServer

type ConnectToGameServer struct {
	// IP is the IP address of the server.
	IP net.IP
	// Port is the port the server listens on.
	Port uint16
	// Key is the connection key.
	Key uo.Serial
}

ConnectToGameServer is sent to instruct the client how to connect to a game server.

func (*ConnectToGameServer) Write

func (p *ConnectToGameServer) Write(w io.Writer)

Write implements the Packet interface.

type Contents

type Contents struct {
	// The items in the container
	Items []ContentsItem
	// If true items are listed in reverse order
	ReverseOrder bool
}

Contents sends the contents of a container to the client.

func (*Contents) Write

func (p *Contents) Write(w io.Writer)

Write implements the Packet interface.

type ContentsItem

type ContentsItem struct {
	// Serial of the item
	Serial uo.Serial
	// Item graphic
	Graphic uo.Graphic
	// Item graphic offset, this gets truncated between 0-255 inclusive
	GraphicOffset int
	// Stack amount
	Amount int
	// Location of the item in the container
	Location uo.Location
	// Serial of the container to add the item to
	Container uo.Serial
	// Hue of the item
	Hue uo.Hue
	// Price of the item if it is being sold
	Price uint32
	// Shop description if it is being sold
	Description string
}

ContentsItem represents one item in a Contents packet.

type ContextMenu

type ContextMenu struct {
	// Serial of the object this context menu is to appear over
	Serial uo.Serial
	// Entries of the menu
	Entries []ctxMenuEntry
}

ContextMenu sends a context menu to the client.

func (*ContextMenu) Add

func (p *ContextMenu) Add(id uint16, cliloc uo.Cliloc)

Add adds an entry to the context menu. The cliloc parameter must be in the range 3,000,000 - 3,060,000 inclusive.

func (*ContextMenu) Write

func (p *ContextMenu) Write(w io.Writer)

Write implements the Packet interface.

type DeleteObject

type DeleteObject struct {
	// Serial of the object to remove
	Serial uo.Serial
}

DeleteObject tells the client to forget about an object

func (*DeleteObject) Write

func (p *DeleteObject) Write(w io.Writer)

Write implements the Packet interface.

type DragItem

type DragItem struct {
	// Graphic is the graphic of the item being moved
	Graphic uo.Graphic
	// Graphic offset, used for stacked graphics. This is truncated to 8-bits
	// and must be positive.
	GraphicOffset int
	// Hue of the item being moved
	Hue uo.Hue
	// Amount in the stack
	Amount int
	// Source mobile serial, uo.SerialSystem for the map
	Source uo.Serial
	// Source position
	SourceLocation uo.Location
	// Destination mobile serial, uo.SerialSystem for the map
	Destination uo.Serial
	// Destination position
	DestinationLocation uo.Location
}

DragItem makes the client play an animation of the item being dragged from the source to the destination.

func (*DragItem) Write

func (p *DragItem) Write(w io.Writer)

Write implements the Packet interface.

type DrawPlayer

type DrawPlayer struct {
	// Serial of the player
	ID uo.Serial
	// Body graphic
	Body uo.Body
	// Skin hue
	Hue uo.Hue
	// Flags field
	Flags uo.MobileFlags
	// Location of the mobile
	Location uo.Location
	// Direction the mobile is facing
	Facing uo.Direction
}

DrawPlayer updates the player's location and appearance

func (*DrawPlayer) Write

func (p *DrawPlayer) Write(w io.Writer)

Write implements the Packet interface.

type DropApproved

type DropApproved struct{}

DropApproved is sent to the client to acknowledge a drop or equip request.

func (*DropApproved) Write

func (p *DropApproved) Write(w io.Writer)

Write implements the Packet interface.

type EnterWorld

type EnterWorld struct {
	// Player serial
	Player uo.Serial
	// Body graphic
	Body uo.Body
	// Position
	Location uo.Location
	// Direction the player is facing and if running.
	Facing uo.Direction
	// Server dimensions
	Width, Height int
}

EnterWorld is sent just after character login to bring them into the world.

func (*EnterWorld) Write

func (p *EnterWorld) Write(w io.Writer)

Write implements the Packet interface.

type EquippedMobile

type EquippedMobile struct {
	// ID of the mobile
	ID uo.Serial
	// Body of the mobile
	Body uo.Body
	// Position of the mobile
	Location uo.Location
	// Direction the mobile is facing
	Facing uo.Direction
	// Running flag
	IsRunning bool
	// Hue of the mobile
	Hue uo.Hue
	// Flags
	Flags uo.MobileFlags
	// Notoriety type
	Notoriety uo.Notoriety
	// List of equipped items
	Equipment []*EquippedMobileItem
}

EquippedMobile is sent to add or update a mobile with equipment graphics.

func (*EquippedMobile) Write

func (p *EquippedMobile) Write(w io.Writer)

Write implements the Packet interface.

type EquippedMobileItem

type EquippedMobileItem struct {
	// ID of the item
	ID uo.Serial
	// Graphic of the item
	Graphic uo.Graphic
	// Layer of the item
	Layer uo.Layer
	// Hue of the item
	Hue uo.Hue
}

EquippedMobileItem is used to send information about the equipment a mobile is wearing.

type FullSkillUpdate

type FullSkillUpdate struct {
	// Slice of all skill values
	SkillValues []int16
}

FullSkillUpdate sends an update for all skills.

func (*FullSkillUpdate) Write

func (p *FullSkillUpdate) Write(w io.Writer)

Write implements the Packet interface.

type GUMP

type GUMP struct {
	// Sender code of the GUMP layout
	Sender uo.Serial
	// TypeCode of the GUMP returned in reply packets
	TypeCode uo.Serial
	// Layout string for the GUMP
	Layout string
	// Location of the GUMP on screen
	Location uo.Location
	// Text lines
	Lines []string
	// If true the GUMP data will be sent uncompressed
	DoNotCompress bool
}

GUMP sends a non-compressed generic GUMP to the client.

func (*GUMP) Write

func (p *GUMP) Write(w io.Writer)

Write implements the Packet interface.

type GlobalLightLevel

type GlobalLightLevel struct {
	// Light level to set
	LightLevel uo.LightLevel
}

GlobalLightLevel sets the overall light level for the client.

func (*GlobalLightLevel) Write

func (p *GlobalLightLevel) Write(w io.Writer)

Write implements the Packet interface.

type GraphicalEffect

type GraphicalEffect struct {
	// Behavior of the effect
	GFXType uo.GFXType
	// Serial of the source object
	Source uo.Serial
	// Serial of the target object
	Target uo.Serial
	// First frame of the effect
	Graphic uo.Graphic
	// Source location
	SourceLocation uo.Location
	// Target location
	TargetLocation uo.Location
	// Speed of the animation in FPS?
	Speed uint8
	// Duration of the animation 1=Slowest, 0=Even slower for some reason
	Duration uint8
	// If true the projectile will not attempt to change facing during flight
	Fixed bool
	// If true the projectile will explode on impact
	Explodes bool
	// Hue of the effect
	Hue uo.Hue
	// Render mode of the effect
	GFXBlendMode uo.GFXBlendMode
}

GraphicalEffect sends a graphical effect packet to the client

func (*GraphicalEffect) Write

func (p *GraphicalEffect) Write(w io.Writer)

Write implements the Packet interface.

type LoginComplete

type LoginComplete struct{}

LoginComplete is sent after character login is successful.

func (*LoginComplete) Write

func (p *LoginComplete) Write(w io.Writer)

Write implements the Packet interface.

type LoginDenied

type LoginDenied struct {
	// The reason for the login denial
	Reason uo.LoginDeniedReason
}

LoginDenied is sent when character login is denied for any reason.

func (*LoginDenied) Write

func (p *LoginDenied) Write(w io.Writer)

Write implements the Packet interface.

type MoveAcknowledge

type MoveAcknowledge struct {
	// Sequence number of the move from the client
	Sequence int
	// Notoriety of the player
	Notoriety uo.Notoriety
}

MoveAcknowledge acknowledges a ClientWalkRequest packet.

func (*MoveAcknowledge) Write

func (p *MoveAcknowledge) Write(w io.Writer)

Write implements the Packet interface.

type MoveItemReject

type MoveItemReject struct {
	Reason uo.MoveItemRejectReason
}

MoveItemReject rejects a pick-up, drop, or equip request

func (*MoveItemReject) Write

func (p *MoveItemReject) Write(w io.Writer)

Write implements the Packet interface.

type MoveMobile

type MoveMobile struct {
	// Serial of the mobile to update
	ID uo.Serial
	// Body of the mobile
	Body uo.Body
	// Location of the mobile
	Location uo.Location
	// Facing
	Facing uo.Direction
	// Running flag
	Running bool
	// Hue
	Hue uo.Hue
	// Mobile flags
	Flags uo.MobileFlags
	// Notoriety
	Notoriety uo.Notoriety
}

MoveMobile moves an existing mobile on the client side

func (*MoveMobile) Write

func (p *MoveMobile) Write(w io.Writer)

Write implements the Packet interface.

type MoveReject

type MoveReject struct {
	// Sequence number of the movement request rejected
	Sequence byte
	// Location of the mobile after the rejection
	Location uo.Location
	// Facing of the mobile
	Facing uo.Direction
}

MoveReject sends a movement rejection packet to the client.

func (*MoveReject) Write

func (p *MoveReject) Write(w io.Writer)

Write implements the Packet interface.

type MoveSpeed

type MoveSpeed struct {
	MoveSpeed uo.MoveSpeed
}

MoveSpeed sets the movement speed of the player on the client. This is a psuedo-packet for General Information packet 0xBF-0x0026. Note that this does NOT set the walk/run/mount state of the client. This is for God mode stuff I guess.

func (*MoveSpeed) Write

func (p *MoveSpeed) Write(w io.Writer)

Write implements the Packet interface.

type Music

type Music struct {
	Song uo.Music // Which song to play
}

Music tells the client to start playing the given song.

func (*Music) Write

func (p *Music) Write(w io.Writer)

Write implements the Packet interface.

type NameResponse

type NameResponse struct {
	Serial uo.Serial // Serial of the object who's name we are sending.
	Name   string    // Name of the object
}

NameResponse is sent to the client in response to a NameRequest.

func (*NameResponse) Write

func (p *NameResponse) Write(w io.Writer)

Write implements the Packet interface.

type OPLInfo

type OPLInfo struct {
	Serial uo.Serial // Serial of the object this packet pertains to.
	Hash   uint32    // Hash of the OPL packet
}

OPLInfo is sent to notify the client of OPL revision changes.

func (*OPLInfo) Write

func (p *OPLInfo) Write(w io.Writer)

Write implements the Packet interface.

type OPLPacket

type OPLPacket struct {
	Serial      uo.Serial // Serial of the object this packet is for
	Hash        uint32    // Hash of the packet
	Entries     []string  // List of all tooltip entries
	TailEntries []string  // List of all tooltip entries that should be appended to the tail
	// contains filtered or unexported fields
}

OPLPacket is sent in response to generic packet 0x10 and populates object tooltips.

func (*OPLPacket) Append

func (p *OPLPacket) Append(text string, tail bool)

Append adds an entry to the OPLPacket in the default font and color.

func (*OPLPacket) AppendColor

func (p *OPLPacket) AppendColor(c color.Color, text string, tail bool)

AppendColor adds an entry to the OPLPacket in the given color.

func (*OPLPacket) Compile

func (p *OPLPacket) Compile()

Compile compiles the packet into the internal buffer if needed.

func (*OPLPacket) Write

func (p *OPLPacket) Write(w io.Writer)

Write implements the Packet interface.

type ObjectInfo

type ObjectInfo struct {
	// If true we are sending information about a multi
	IsMulti bool
	// Serial of the item or multi
	Serial uo.Serial
	// Graphic of the item or index of the multi into multi.mul
	Graphic uo.Graphic
	// Add this number to the graphic index if amount > 1
	GraphicIncrement int
	// Amount, must be at least 1, no greater than 60000 - always 1 for multi
	Amount int
	// Location of the item or multi
	Location uo.Location
	// Facing of the item - always 0 for multi
	Facing uo.Direction
	// Layer of the item or 0 if not equipable or multi
	Layer uo.Layer
	// Hue - 0 if multi
	Hue uo.Hue
	// If true the object will be moveable even if normally not. Note that even
	// when this is false the client may still treat the object as movable
	// depending on the contents of the tile definition for the graphic.
	Movable bool
}

ObjectInfo sends information about a single item or multi to the client.

func (*ObjectInfo) Write

func (p *ObjectInfo) Write(w io.Writer)

Write implements the Packet interface.

type OpenContainerGump

type OpenContainerGump struct {
	// The ID of the Gump
	GumpSerial uo.Serial
	// The gump graphic
	Gump uo.GUMP
}

OpenContainerGump opens a container gump on the client.

func (*OpenContainerGump) Write

func (p *OpenContainerGump) Write(w io.Writer)

Write implements the Packet interface.

type OpenPaperDoll

type OpenPaperDoll struct {
	// Serial of the mobile to display the paper doll of
	Serial uo.Serial
	// Text displayed in the name and title area. Note this gets truncated to
	// 60 characters when sent to the client.
	Text string
	// If true the character is currently in war mode
	WarMode bool
	// If true the player may alter the paper doll
	Alterable bool
}

OpenPaperDoll tells the client to open the paper doll window for a mobile

func (*OpenPaperDoll) Write

func (p *OpenPaperDoll) Write(w io.Writer)

Write implements the Packet interface.

type Packet

type Packet interface {
	// Write writes the packet data to w.
	Write(w io.Writer)
}

Packet is the interface all server packets implement.

type PersonalLightLevel

type PersonalLightLevel struct {
	// Serial of the mobile
	Serial uo.Serial
	// Light level to set
	LightLevel uo.LightLevel
}

PersonalLightLevel sets the personal light level for the mobile.

func (*PersonalLightLevel) Write

func (p *PersonalLightLevel) Write(w io.Writer)

Write implements the Packet interface.

type Ping

type Ping struct {
	// Key byte of the client ping request
	Key byte
}

Ping is sent to the client in response to a client ping packet.

func (*Ping) Write

func (p *Ping) Write(w io.Writer)

Write implements the Packet interface.

type SellWindow

type SellWindow struct {
	// Serial of the vendor we are buying from
	Vendor uo.Serial
	// List of items the player is allowed to sell to the vendor
	Items []ContentsItem
}

SellWindow is sent to the client to open the vendor sell window.

func (*SellWindow) Write

func (p *SellWindow) Write(w io.Writer)

Write implements the Packet interface.

type ServerList

type ServerList struct {
	// Entries in the server list (order is important!)
	Entries []ServerListEntry
}

ServerList lists all of the available game servers during login.

func (*ServerList) Write

func (p *ServerList) Write(w io.Writer)

Write implements the Packet interface.

type ServerListEntry

type ServerListEntry struct {
	// Name of the server
	Name string
	// IP address of the server to ping
	IP net.IP
}

ServerListEntry represents one entry in the server list.

type SingleSkillUpdate

type SingleSkillUpdate struct {
	// Which skill changed
	Skill uo.Skill
	// New raw value of the skill (0-1000)
	Value int
	// Lock state
	Lock uo.SkillLock
}

SingleSkillUpdate sends an update for a single skill.

func (*SingleSkillUpdate) Write

func (p *SingleSkillUpdate) Write(w io.Writer)

Write implements the Packet interface.

type Sound

type Sound struct {
	// Which sound to play
	Sound uo.Sound
	// Where the sound is coming from
	Location uo.Location
}

Sound tells the client to play a sound from a specific location.

func (*Sound) Write

func (p *Sound) Write(w io.Writer)

Write implements the Packet interface.

type Speech

type Speech struct {
	// Serial of the speaker
	Speaker uo.Serial
	// Body of the speaker
	Body uo.Body
	// Type of speech
	Type uo.SpeechType
	// Hue of the text
	Hue uo.Hue
	// Font of the text
	Font uo.Font
	// Name of the speaker (truncated to 30 bytes) (empty for system)
	Name string
	// Text of the message spoken
	Text string
}

Speech is sent to the client for all kinds of speech including system messages and prompts.

func (*Speech) Write

func (p *Speech) Write(w io.Writer)

Write implements the Packet interface.

type StartingLocation

type StartingLocation struct {
	// Name of the city.
	City string
	// Name of the building or area.
	Area string
}

StartingLocation represents one starting location for new character creation.

type StatusBarInfo

type StatusBarInfo struct {
	// Serial of the mobile this status applies to
	Mobile uo.Serial
	// Name of the mobile (this gets truncated to 30 characters)
	Name string
	// Current hit points
	HP int
	// Max hit points
	MaxHP int
	// Can the player change the name of this mobile?
	NameChangeFlag bool
	// If true the mobile is female
	Female bool
	// Strength
	Strength int
	// Dexterity
	Dexterity int
	// Intelligence
	Intelligence int
	// Current stamina
	Stamina int
	// Max stamina
	MaxStamina int
	// Current mana
	Mana int
	// Max mana
	MaxMana int
	// Total amount of gold this mobile is currently holding
	Gold int
	// Armor rating
	ArmorRating int
	// Current weight of all equipment and inventory
	Weight int
	// Total stats cap
	StatsCap int
	// Current number of follower slots used
	Followers int
	// Maximum number of follower slots
	MaxFollowers int
}

StatusBarInfo sends basic status info to the client.

func (*StatusBarInfo) Write

func (p *StatusBarInfo) Write(w io.Writer)

Write implements the Packet interface.

type Target

type Target struct {
	// Serial of the targeting cursor
	Serial uo.Serial
	// Type of targeting request
	TargetType uo.TargetType
	// Cursor display type
	CursorType uo.CursorType
}

Target is used to send and recieve targeting commands to the client

func (*Target) Write

func (p *Target) Write(w io.Writer)

Write implements the Packet interface.

type TextEntryGUMP

type TextEntryGUMP struct {
	Serial      uo.Serial // Serial of the GUMP
	Value       string    // Current value of the text entry field
	Description string    // Description of the text requested
	CanCancel   bool      // If true allow the client to cancel the GUMP
	MaxLength   int       // Maximum response length
}

TextEntryGUMP is sent to request a string of text from the client via a client-side GUMP.

func (*TextEntryGUMP) Write

func (p *TextEntryGUMP) Write(w io.Writer)

Write implements the Packet interface.

type Time

type Time struct {
	// Server time
	Time time.Time
}

Time tells the client the server time.

func (*Time) Write

func (p *Time) Write(w io.Writer)

Write implements the Packet interface.

type UpdateHealth

type UpdateHealth struct {
	Serial  uo.Serial // Serial of the object this packet pertains to.
	Hits    int       // Current hit points
	MaxHits int       // Maximum hit points
}

UpdateHealth is sent to notify the client of the current HP levels of another mobile. The health is normalized to a 4% resolution.

func (*UpdateHealth) Write

func (p *UpdateHealth) Write(w io.Writer)

Write implements the Packet interface.

type VendorBuySequence

type VendorBuySequence struct {
	// Serial of the vendor
	Vendor uo.Serial
	// Serial of the sell container
	ForSale uo.Serial
	// Serial of the bought container
	Bought uo.Serial
	// List of items in the sell container
	ForSaleItems []ContentsItem
	// List of items in the bought container
	BoughtItems []ContentsItem
}

VendorBuySequence implements the required sequence of packets to open an NPC buy window.

func (*VendorBuySequence) Write

func (p *VendorBuySequence) Write(w io.Writer)

Write implements the Packet interface.

type Version

type Version struct{}

Version is sent to the client to request the client version of the packet.

func (*Version) Write

func (p *Version) Write(w io.Writer)

Write implements the Packet interface.

type WornItem

type WornItem struct {
	// The item being worn
	Item uo.Serial
	// Graphic of the item
	Graphic uo.Graphic
	// Layer of the item
	Layer uo.Layer
	// Mobile wearing the item
	Wearer uo.Serial
	// Hue of the item
	Hue uo.Hue
}

WornItem is sent to clients to inform them of an item added to a mobile's equipment.

func (*WornItem) Write

func (p *WornItem) Write(w io.Writer)

Write implements the Packet interface.

Jump to

Keyboard shortcuts

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