packets

package
Version: v0.0.0-...-1047d84 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: ISC Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CannotLogout = NewOutgoingPacket(183)

CannotLogout Message that you can not logout right now.

View Source
var ChangeAppearance = NewOutgoingPacket(59)

ChangeAppearance The appearance changing window.

View Source
var Death = NewOutgoingPacket(83)

Death The 'Oh dear...You are dead' fade-to-black graphic effect when you die.

View Source
var DefaultActionMessage = ServerMessage("Nothing interesting happens.")

DefaultActionMessage This is a message to inform the player that the action they were trying to perform didn't do anything.

View Source
var LogWarning = log.New(os.Stdout, "[WARNING] ", log.Ltime|log.Lshortfile)

LogWarning An output log for warnings.

View Source
var Logout = NewOutgoingPacket(4)

Logout Resets client to login welcome screen

View Source
var ResponsePong = NewOutgoingPacket(9)

ResponsePong Response to a RSC protocol ping packet

View Source
var WelcomeMessage = ServerMessage("Welcome to RuneScape")

WelcomeMessage Welcome to the game on login

Functions

This section is empty.

Types

type Packet

type Packet struct {
	Opcode  byte
	Payload []byte
	Bare    bool
	// contains filtered or unexported fields
}

Packet The definition of a game packet. Generally, these are commands, indexed by their Opcode(0-255), with

a 5000-byte buffer for arguments, stored in Payload.  If the packet is bare, raw data is intended to be
transmitted when writing the packet stucture to a socket, otherwise we put a 2-byte unsigned short for the
length of the arguments buffer(plus one because the opcode is included in the payload size), and the 1-byte
opcode at the start of the packet, as a header for the client to easily parse the information for each frame.

func BigInformationBox

func BigInformationBox(msg string) (p *Packet)

BigInformationBox Builds a packet to trigger the opening of a large black text window with msg as its contents

func BoundaryLocations

func BoundaryLocations(player *world.Player, newObjects []*world.Object) (p *Packet)

BoundaryLocations Builds a packet with the view-area boundary positions in it, relative to the player. If no new objects are available and no existing local boundarys are removed from area, returns nil.

func ClientSettings

func ClientSettings(player *world.Player) (p *Packet)

ClientSettings Builds a packet containing the players client settings, e.g camera mode, mouse mode, sound fx...

func EquipmentStats

func EquipmentStats(player *world.Player) (p *Packet)

EquipmentStats Builds a packet with the players equipment statistics in it.

func Fatigue

func Fatigue(player *world.Player) (p *Packet)

Fatigue Builds a packet with the players fatigue percentage in it.

func FightMode

func FightMode(player *world.Player) (p *Packet)

FightMode Builds a packet with the players fight mode information in it.

func FriendList

func FriendList(player *world.Player) (p *Packet)

FriendList Builds a packet with the players friend list information in it.

func FriendUpdate

func FriendUpdate(hash uint64, online bool) (p *Packet)

FriendUpdate Builds a packet with an online status update for the player with the specified hash

func IgnoreList

func IgnoreList(player *world.Player) (p *Packet)

IgnoreList Builds a packet with the players ignore list information in it.

func InventoryItems

func InventoryItems(player *world.Player) (p *Packet)

InventoryItems Builds a packet containing the players inventory items.

func LoginBox

func LoginBox(inactiveDays int, lastIP string) (p *Packet)

LoginBox Builds a packet to create a welcome box on the client with the inactiveDays since login, and lastIP connected from.

func LoginResponse

func LoginResponse(v int) *Packet

LoginResponse Builds a bare packet with the login response code.

func NPCPositions

func NPCPositions(player *world.Player) (p *Packet)

NPCPositions Builds a packet containing view area NPC position and sprite information

func NewBarePacket

func NewBarePacket(src []byte) *Packet

NewBarePacket Creates a new packet instance intended for sending raw data to the client.

func NewOutgoingPacket

func NewOutgoingPacket(opcode byte) *Packet

NewOutgoingPacket Creates a new packet instance intended for sending formatted data to the client.

func NewPacket

func NewPacket(opcode byte, payload []byte) *Packet

NewPacket Creates a new packet instance.

func ObjectLocations

func ObjectLocations(player *world.Player, newObjects []*world.Object) (p *Packet)

ObjectLocations Builds a packet with the view-area object positions in it, relative to the player. If no new objects are available and no existing local objects are removed from area, returns nil.

func PlaneInfo

func PlaneInfo(player *world.Player) *Packet

PlaneInfo Builds a packet to update information about the clients environment, e.g height, player index...

func PlayerAppearances

func PlayerAppearances(ourPlayer *world.Player) (p *Packet)

PlayerAppearances Builds a packet with the view-area player appearance profiles in it.

func PlayerChat

func PlayerChat(sender int, msg string) *Packet

PlayerChat Builds a packet containing a view-area chat message from the player with the index sender and returns it.

func PlayerPositions

func PlayerPositions(player *world.Player) (p *Packet)

PlayerPositions Builds a packet containing view area player position and sprite information, including ones own information, and returns it. If no players need to be updated, returns nil.

func PlayerStat

func PlayerStat(player *world.Player, idx int) *Packet

PlayerStat Builds a packet containing player's stat information for skill at idx and returns it.

func PlayerStats

func PlayerStats(player *world.Player) *Packet

PlayerStats Builds a packet containing all the player's stat information and returns it.

func PrivateMessage

func PrivateMessage(hash uint64, msg string) (p *Packet)

PrivateMessage Builds a packet with a private message from hash with content msg.

func ServerInfo

func ServerInfo(onlineCount int) (p *Packet)

ServerInfo Builds a packet with the server information in it.

func ServerMessage

func ServerMessage(msg string) (p *Packet)

ServerMessage Builds a packet containing a server message to display in the chat box.

func TeleBubble

func TeleBubble(offsetX, offsetY int) (p *Packet)

TeleBubble Builds a packet to draw a teleport bubble at the specified offsets.

func (*Packet) AddBits

func (p *Packet) AddBits(value int, numBits int) *Packet

AddBits Packs value into the numBits next bits of the packets byte buffer.

func (*Packet) AddByte

func (p *Packet) AddByte(b uint8) *Packet

AddByte Adds an 8-bit integer to the packet payload.

func (*Packet) AddBytes

func (p *Packet) AddBytes(b []byte) *Packet

AddBytes Adds byte array to packet payload

func (*Packet) AddInt

func (p *Packet) AddInt(i uint32) *Packet

AddInt Adds a 32-bit integer to the packet payload.

func (*Packet) AddInt2

func (p *Packet) AddInt2(i uint32) *Packet

AddInt2 Adds a 32-bit integer or an 8-byte integer to the packet payload, depending on value.

func (*Packet) AddLong

func (p *Packet) AddLong(l uint64) *Packet

AddLong Adds a 64-bit integer to the packet payload.

func (*Packet) AddShort

func (p *Packet) AddShort(s uint16) *Packet

AddShort Adds a 16-bit integer to the packet payload.

func (*Packet) ReadBool

func (p *Packet) ReadBool() bool

ReadBool Reads the next byte, if it is 1 returns true, else returns false.

func (*Packet) ReadByte

func (p *Packet) ReadByte() byte

ReadByte Read the next 8-bit integer from the packet payload.

func (*Packet) ReadInt

func (p *Packet) ReadInt() int

ReadInt Read the next 32-bit integer from the packet payload.

func (*Packet) ReadLong

func (p *Packet) ReadLong() uint64

ReadLong Read the next 64-bit integer from the packet payload.

func (*Packet) ReadSByte

func (p *Packet) ReadSByte() int8

ReadSByte Read the next 8-bit integer from the packet payload, as a signed byte.

func (*Packet) ReadShort

func (p *Packet) ReadShort() int

ReadShort Read the next 16-bit integer from the packet payload.

func (*Packet) ReadString

func (p *Packet) ReadString(n int) (val string)

ReadString Read the next n bytes from the packet payload and return it as a Go-string.

func (*Packet) String

func (p *Packet) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL