Documentation ¶
Index ¶
- Constants
- Variables
- func AppendPacket(data []byte, p Message) ([]byte, error)
- func DecodePacket(data []byte, p Message) (int, error)
- func EncodePacket(data []byte, p Message) (int, error)
- func EncodePacketSize(p Message) int
- func NewPipe(log *slog.Logger, buf int) (srv *PipeConn, cli *PipeConn)
- func RegisterMessage(p Message, dynamic bool)
- type Client
- func (c *Client) Close()
- func (c *Client) Connect(ctx context.Context, addr netip.AddrPort, req *MsgClientAccept) error
- func (c *Client) Discover(ctx context.Context, port int, out chan<- ServerInfoResp) error
- func (c *Client) LocalAddr() netip.AddrPort
- func (c *Client) Reset()
- func (c *Client) SetServerAddr(addr netip.AddrPort)
- func (c *Client) TryJoin(ctx context.Context, addr netip.AddrPort, req MsgServerTryJoin) error
- func (c *Client) TryPassword(ctx context.Context, pass string) error
- type ComplexObjectUpdate
- type Conn
- func (p *Conn) Ack() error
- func (p *Conn) CancelReliable(pid PacketID)
- func (p *Conn) Encrypt(key byte)
- func (p *Conn) OnMessage(fnc OnMessageFunc)
- func (p *Conn) Port() *Port
- func (p *Conn) QueueReliable(ctx context.Context, sid StreamID, data []byte, done, timeout func()) PacketID
- func (p *Conn) QueueReliableMsg(ctx context.Context, sid StreamID, arr []Message, done, timeout func()) (PacketID, error)
- func (p *Conn) QueuedFor(sid StreamID) int
- func (p *Conn) RemoteAddr() netip.AddrPort
- func (p *Conn) Reset()
- func (p *Conn) ResetFor(sid StreamID)
- func (p *Conn) SendQueue() error
- func (p *Conn) SendReliable(ctx context.Context, sid StreamID, data []byte) error
- func (p *Conn) SendReliableMsg(ctx context.Context, sid StreamID, m Message) error
- func (p *Conn) SendUnreliable(sid StreamID, data []byte) error
- func (p *Conn) SendUnreliableMsg(sid StreamID, m Message) error
- func (p *Conn) UpdateQueue(fnc func(pid PacketID, sid StreamID, data []byte) bool)
- func (p *Conn) ViewQueue(fnc func(sid StreamID, data []byte))
- func (p *Conn) WithID(sid StreamID) *Stream
- type ConnectError
- type CtrlCode
- type Encoded
- type Engine
- type ErrorMsg
- type Inform
- type InformClassChanged
- type InformCode
- type InformKill
- type InformObserver
- type InformPlayer
- type InformPlayerState
- type InformSpell
- type InformStringID
- type InformTeam
- type InformTeamPlayer
- type InformWarpWait
- type Mapper
- type Message
- type MsgAccept
- type MsgClientAccept
- type MsgClientPing
- type MsgClientPong
- type MsgConnect
- type MsgDiscover
- type MsgFadeBegin
- type MsgFullTimestamp
- type MsgFxJiggle
- type MsgImportant
- type MsgImportantAck
- type MsgInform
- type MsgJoinData
- type MsgJoinFailed
- type MsgJoinOK
- type MsgKeepAlive
- type MsgMapReceived
- type MsgMapSendAbort
- type MsgMapSendPacket
- type MsgMapSendStart
- type MsgMouse
- type MsgNewAlias
- type MsgPasswordRequired
- type MsgPlayerInput
- type MsgRateChange
- type MsgServerAccept
- type MsgServerCmd
- type MsgServerError
- type MsgServerInfo
- type MsgServerPass
- type MsgServerPing
- type MsgServerPong
- type MsgServerTryJoin
- type MsgSpeed
- type MsgStatMult
- type MsgText
- type MsgTimestamp
- type MsgUnknown
- type MsgUpdateStream
- type MsgUseMap
- type MsgWallDestroy
- type MsgXfer
- type ObjectUpdate
- type OnMessageFunc
- type Op
- type PacketConn
- type PacketID
- type PipeConn
- type Player
- type PlayerID
- type PlayerInput
- type PlayerInput0
- type PlayerInput1
- type PlayerInput4
- type Port
- func (p *Port) BroadcastMsg(port int, m Message) error
- func (p *Port) Close()
- func (p *Port) Conn(addr netip.AddrPort) *Conn
- func (p *Port) LocalAddr() netip.AddrPort
- func (p *Port) OnMessage(fnc OnMessageFunc)
- func (p *Port) Reset()
- func (p *Port) Start()
- func (p *Port) WriteMsg(addr netip.AddrPort, b1, b2 byte, m Message, xor byte) error
- type Server
- type ServerInfoResp
- type ServerOptions
- type Stream
- func (p *Stream) Addr() netip.AddrPort
- func (p *Stream) CancelReliable(id PacketID)
- func (p *Stream) Conn() *Conn
- func (p *Stream) OnMessage(fnc OnMessageFunc)
- func (p *Stream) QueueReliable(ctx context.Context, data []byte, done, timeout func()) PacketID
- func (p *Stream) QueueReliableMsg(ctx context.Context, arr []Message, done, timeout func()) (PacketID, error)
- func (p *Stream) Reset()
- func (p *Stream) SID() StreamID
- func (p *Stream) SendQueue() error
- func (p *Stream) SendReliable(ctx context.Context, data []byte) error
- func (p *Stream) SendReliableMsg(ctx context.Context, m Message) error
- func (p *Stream) SendUnreliable(data []byte) error
- func (p *Stream) SendUnreliableMsg(m Message) error
- type StreamID
- type TextFlags
- type Timestamp
- type UpdateAlias
- type UpdateID
- type UpdateObjectID
Constants ¶
View Source
const ( MSG_SERVER_CONNECT = Op(0) // 0x00 MSG_SERVER_ACCEPT = Op(1) // 0x01 MSG_CODE2 = Op(2) // 0x02 MSG_CODE3 = Op(3) // 0x03 MSG_CODE4 = Op(4) // 0x04 MSG_CODE5 = Op(5) // 0x05 MSG_CLIENT_PING = Op(6) // 0x06 MSG_CODE7 = Op(7) // 0x07 MSG_CLIENT_PONG = Op(8) // 0x08 MSG_CODE9 = Op(9) // 0x09 MSG_CLIENT_CLOSE = Op(10) // 0x0A MSG_SERVER_CLOSE = Op(11) // 0x0B MSG_SERVER_DISCOVER = Op(12) // 0x0C MSG_SERVER_INFO = Op(13) // 0x0D MSG_SERVER_TRY_JOIN = Op(14) // 0x0E MSG_PASSWORD_REQUIRED = Op(15) // 0x0F MSG_SERVER_PING = Op(16) // 0x10 MSG_SERVER_PASSWORD = Op(17) // 0x11 MSG_SERVER_PONG = Op(18) // 0x12 MSG_SERVER_ERROR = Op(19) // 0x13 MSG_SERVER_JOIN_OK = Op(20) // 0x14 MSG_SERVER_JOIN_FAIL = Op(21) // 0x15 MSG_CODE22 = Op(22) // 0x16 MSG_CODE23 = Op(23) // 0x17 MSG_CODE24 = Op(24) // 0x18 MSG_CODE25 = Op(25) // 0x19 MSG_CODE26 = Op(26) // 0x1A MSG_CODE27 = Op(27) // 0x1B MSG_CODE28 = Op(28) // 0x1C MSG_CODE29 = Op(29) // 0x1D MSG_CODE30 = Op(30) // 0x1E MSG_ACCEPTED = Op(31) // 0x1F MSG_CLIENT_ACCEPT = Op(32) // 0x20 MSG_SERVER_CLOSE_ACK = Op(33) // 0x21 MSG_CLIENT_CLOSE_ACK = Op(34) // 0x22 MSG_SPEED = Op(35) // 0x23 MSG_PING = Op(36) // 0x24 MSG_CODE37 = Op(37) // 0x25 MSG_CODE38 = Op(38) // 0x26 MSG_TIMESTAMP = Op(39) // 0x27 MSG_FULL_TIMESTAMP = Op(40) // 0x28 MSG_NEED_TIMESTAMP = Op(41) // 0x29 MSG_SIMULATED_TIMESTAMP = Op(42) // 0x2A MSG_USE_MAP = Op(43) // 0x2B MSG_JOIN_DATA = Op(44) // 0x2C MSG_NEW_PLAYER = Op(45) // 0x2D MSG_PLAYER_QUIT = Op(46) // 0x2E MSG_SIMPLE_OBJ = Op(47) // 0x2F MSG_COMPLEX_OBJ = Op(48) // 0x30 MSG_DESTROY_OBJECT = Op(49) // 0x31 MSG_OBJECT_OUT_OF_SIGHT = Op(50) // 0x32 MSG_OBJECT_IN_SHADOWS = Op(51) // 0x33 MSG_OBJECT_FRIEND_ADD = Op(52) // 0x34 MSG_OBJECT_FRIEND_REMOVE = Op(53) // 0x35 MSG_RESET_FRIENDS = Op(54) // 0x36 MSG_ENABLE_OBJECT = Op(55) // 0x37 MSG_DISABLE_OBJECT = Op(56) // 0x38 MSG_DRAW_FRAME = Op(57) // 0x39 MSG_DESTROY_WALL = Op(58) // 0x3A MSG_OPEN_WALL = Op(59) // 0x3B MSG_CLOSE_WALL = Op(60) // 0x3C MSG_CHANGE_OR_ADD_WALL_MAGIC = Op(61) // 0x3D MSG_REMOVE_WALL_MAGIC = Op(62) // 0x3E MSG_PLAYER_INPUT = Op(63) // 0x3F MSG_PLAYER_SET_WAYPOINT = Op(64) // 0x40 MSG_REPORT_HEALTH = Op(65) // 0x41 MSG_REPORT_HEALTH_DELTA = Op(66) // 0x42 MSG_REPORT_PLAYER_HEALTH = Op(67) // 0x43 MSG_REPORT_ITEM_HEALTH = Op(68) // 0x44 MSG_REPORT_MANA = Op(69) // 0x45 MSG_REPORT_POISON = Op(70) // 0x46 MSG_REPORT_STAMINA = Op(71) // 0x47 MSG_REPORT_STATS = Op(72) // 0x48 MSG_REPORT_ARMOR_VALUE = Op(73) // 0x49 MSG_REPORT_GOLD = Op(74) // 0x4A MSG_REPORT_PICKUP = Op(75) // 0x4B MSG_REPORT_MODIFIABLE_PICKUP = Op(76) // 0x4C MSG_REPORT_DROP = Op(77) // 0x4D MSG_REPORT_LESSON = Op(78) // 0x4E MSG_REPORT_MUNDANE_ARMOR_EQUIP = Op(79) // 0x4F MSG_REPORT_MUNDANE_WEAPON_EQUIP = Op(80) // 0x50 MSG_REPORT_MODIFIABLE_WEAPON_EQUIP = Op(81) // 0x51 MSG_REPORT_MODIFIABLE_ARMOR_EQUIP = Op(82) // 0x52 MSG_REPORT_ARMOR_DEQUIP = Op(83) // 0x53 MSG_REPORT_WEAPON_DEQUIP = Op(84) // 0x54 MSG_REPORT_TREASURE_COUNT = Op(85) // 0x55 MSG_REPORT_FLAG_BALL_WINNER = Op(86) // 0x56 MSG_REPORT_FLAG_WINNER = Op(87) // 0x57 MSG_REPORT_DEATHMATCH_WINNER = Op(88) // 0x58 MSG_REPORT_DEATHMATCH_TEAM_WINNER = Op(89) // 0x59 MSG_REPORT_ENCHANTMENT = Op(90) // 0x5A MSG_REPORT_ITEM_ENCHANTMENT = Op(91) // 0x5B MSG_REPORT_LIGHT_COLOR = Op(92) // 0x5C MSG_REPORT_LIGHT_INTENSITY = Op(93) // 0x5D MSG_REPORT_Z_PLUS = Op(94) // 0x5E MSG_REPORT_Z_MINUS = Op(95) // 0x5F MSG_REPORT_EQUIP = Op(96) // 0x60 MSG_REPORT_DEQUIP = Op(97) // 0x61 MSG_REPORT_ACQUIRE_SPELL = Op(98) // 0x62 MSG_REPORT_TARGET = Op(99) // 0x63 MSG_REPORT_CHARGES = Op(100) // 0x64 MSG_REPORT_X_STATUS = Op(101) // 0x65 MSG_REPORT_PLAYER_STATUS = Op(102) // 0x66 MSG_REPORT_MODIFIER = Op(103) // 0x67 MSG_REPORT_STAT_MODIFIER = Op(104) // 0x68 MSG_REPORT_NPC = Op(105) // 0x69 MSG_REPORT_CLIENT_STATUS = Op(106) // 0x6A MSG_REPORT_ANIMATION_FRAME = Op(107) // 0x6B MSG_REPORT_ACQUIRE_CREATURE = Op(108) // 0x6C MSG_REPORT_LOSE_CREATURE = Op(109) // 0x6D MSG_REPORT_EXPERIENCE = Op(110) // 0x6E MSG_REPORT_SPELL_AWARD = Op(111) // 0x6F MSG_REPORT_SPELL_START = Op(112) // 0x70 MSG_REPORT_INVENTORY_LOADED = Op(113) // 0x71 MSG_TRY_DROP = Op(114) // 0x72 MSG_TRY_GET = Op(115) // 0x73 MSG_TRY_USE = Op(116) // 0x74 MSG_TRY_EQUIP = Op(117) // 0x75 MSG_TRY_DEQUIP = Op(118) // 0x76 MSG_TRY_TARGET = Op(119) // 0x77 MSG_TRY_CREATURE_COMMAND = Op(120) // 0x78 MSG_TRY_SPELL = Op(121) // 0x79 MSG_TRY_ABILITY = Op(122) // 0x7A MSG_TRY_COLLIDE = Op(123) // 0x7B MSG_FX_PARTICLEFX = Op(124) // 0x7C MSG_FX_PLASMA = Op(125) // 0x7D MSG_FX_SUMMON = Op(126) // 0x7E MSG_FX_SUMMON_CANCEL = Op(127) // 0x7F MSG_FX_SHIELD = Op(128) // 0x80 MSG_FX_BLUE_SPARKS = Op(129) // 0x81 MSG_FX_YELLOW_SPARKS = Op(130) // 0x82 MSG_FX_CYAN_SPARKS = Op(131) // 0x83 MSG_FX_VIOLET_SPARKS = Op(132) // 0x84 MSG_FX_EXPLOSION = Op(133) // 0x85 MSG_FX_LESSER_EXPLOSION = Op(134) // 0x86 MSG_FX_COUNTERSPELL_EXPLOSION = Op(135) // 0x87 MSG_FX_THIN_EXPLOSION = Op(136) // 0x88 MSG_FX_TELEPORT = Op(137) // 0x89 MSG_FX_SMOKE_BLAST = Op(138) // 0x8A MSG_FX_DAMAGE_POOF = Op(139) // 0x8B MSG_FX_LIGHTNING = Op(140) // 0x8C MSG_FX_ENERGY_BOLT = Op(141) // 0x8D MSG_FX_CHAIN_LIGHTNING_BOLT = Op(142) // 0x8E MSG_FX_DRAIN_MANA = Op(143) // 0x8F MSG_FX_CHARM = Op(144) // 0x90 MSG_FX_GREATER_HEAL = Op(145) // 0x91 MSG_FX_MAGIC = Op(146) // 0x92 MSG_FX_SPARK_EXPLOSION = Op(147) // 0x93 MSG_FX_DEATH_RAY = Op(148) // 0x94 MSG_FX_SENTRY_RAY = Op(149) // 0x95 MSG_FX_RICOCHET = Op(150) // 0x96 MSG_FX_JIGGLE = Op(151) // 0x97 MSG_FX_GREEN_BOLT = Op(152) // 0x98 MSG_FX_GREEN_EXPLOSION = Op(153) // 0x99 MSG_FX_WHITE_FLASH = Op(154) // 0x9A MSG_FX_GENERATING_MAP = Op(155) // 0x9B MSG_FX_ASSEMBLING_MAP = Op(156) // 0x9C MSG_FX_POPULATING_MAP = Op(157) // 0x9D MSG_FX_DURATION_SPELL = Op(158) // 0x9E MSG_FX_DELTAZ_SPELL_START = Op(159) // 0x9F MSG_FX_TURN_UNDEAD = Op(160) // 0xA0 MSG_FX_ARROW_TRAP = Op(161) // 0xA1 MSG_FX_VAMPIRISM = Op(162) // 0xA2 MSG_FX_MANA_BOMB_CANCEL = Op(163) // 0xA3 MSG_UPDATE_STREAM = Op(164) // 0xA4 MSG_NEW_ALIAS = Op(165) // 0xA5 MSG_AUDIO_EVENT = Op(166) // 0xA6 MSG_AUDIO_PLAYER_EVENT = Op(167) // 0xA7 MSG_TEXT_MESSAGE = Op(168) // 0xA8 MSG_INFORM = Op(169) // 0xA9 MSG_IMPORTANT = Op(170) // 0xAA MSG_IMPORTANT_ACK = Op(171) // 0xAB MSG_MOUSE = Op(172) // 0xAC MSG_INCOMING_CLIENT = Op(173) // 0xAD MSG_OUTGOING_CLIENT = Op(174) // 0xAE MSG_GAME_SETTINGS = Op(175) // 0xAF MSG_GAME_SETTINGS_2 = Op(176) // 0xB0 MSG_UPDATE_GUI_GAME_SETTINGS = Op(177) // 0xB1 MSG_DOOR_ANGLE = Op(178) // 0xB2 MSG_OBELISK_CHARGE = Op(179) // 0xB3 MSG_PENTAGRAM_ACTIVATE = Op(180) // 0xB4 MSG_CLIENT_PREDICT_LINEAR = Op(181) // 0xB5 MSG_REQUEST_MAP = Op(182) // 0xB6 MSG_CANCEL_MAP = Op(183) // 0xB7 MSG_MAP_SEND_START = Op(184) // 0xB8 MSG_MAP_SEND_PACKET = Op(185) // 0xB9 MSG_MAP_SEND_ABORT = Op(186) // 0xBA MSG_SERVER_CMD = Op(187) // 0xBB MSG_SYSOP_PW = Op(188) // 0xBC MSG_SYSOP_RESULT = Op(189) // 0xBD MSG_KEEP_ALIVE = Op(190) // 0xBE MSG_RECEIVED_MAP = Op(191) // 0xBF MSG_CLIENT_READY = Op(192) // 0xC0 MSG_REQUEST_SAVE_PLAYER = Op(193) // 0xC1 MSG_XFER_MSG = Op(194) // 0xC2 MSG_PLAYER_OBJ = Op(195) // 0xC3 MSG_TEAM_MSG = Op(196) // 0xC4 MSG_KICK_NOTIFICATION = Op(197) // 0xC5 MSG_TIMEOUT_NOTIFICATION = Op(198) // 0xC6 MSG_SERVER_QUIT = Op(199) // 0xC7 MSG_SERVER_QUIT_ACK = Op(200) // 0xC8 MSG_TRADE = Op(201) // 0xC9 MSG_CHAT_KILL = Op(202) // 0xCA MSG_MESSAGES_KILL = Op(203) // 0xCB MSG_SEQ_IMPORTANT = Op(204) // 0xCC MSG_REPORT_ABILITY_AWARD = Op(205) // 0xCD MSG_REPORT_ABILITY_STATE = Op(206) // 0xCE MSG_REPORT_ACTIVE_ABILITIES = Op(207) // 0xCF MSG_DIALOG = Op(208) // 0xD0 MSG_REPORT_GUIDE_AWARD = Op(209) // 0xD1 MSG_INTERESTING_ID = Op(210) // 0xD2 MSG_TIMER_STATUS = Op(211) // 0xD3 MSG_REQUEST_TIMER_STATUS = Op(212) // 0xD4 MSG_JOURNAL_MSG = Op(213) // 0xD5 MSG_CHAPTER_END = Op(214) // 0xD6 MSG_REPORT_ALL_LATENCY = Op(215) // 0xD7 MSG_REPORT_FLAG_STATUS = Op(216) // 0xD8 MSG_REPORT_BALL_STATUS = Op(217) // 0xD9 MSG_REPORT_OBJECT_POISON = Op(218) // 0xDA MSG_REPORT_MONITOR_CREATURE = Op(219) // 0xDB MSG_REPORT_UNMONITOR_CREATURE = Op(220) // 0xDC MSG_REPORT_TOTAL_HEALTH = Op(221) // 0xDD MSG_REPORT_TOTAL_MANA = Op(222) // 0xDE MSG_REPORT_SPELL_STAT = Op(223) // 0xDF MSG_REPORT_SECONDARY_WEAPON = Op(224) // 0xE0 MSG_REPORT_LAST_QUIVER = Op(225) // 0xE1 MSG_INFO_BOOK_DATA = Op(226) // 0xE2 MSG_SOCIAL = Op(227) // 0xE3 MSG_FADE_BEGIN = Op(228) // 0xE4 MSG_MUSIC_EVENT = Op(229) // 0xE5 MSG_MUSIC_PUSH_EVENT = Op(230) // 0xE6 MSG_MUSIC_POP_EVENT = Op(231) // 0xE7 MSG_PLAYER_DIED = Op(232) // 0xE8 MSG_PLAYER_RESPAWN = Op(233) // 0xE9 MSG_FORGET_DRAWABLES = Op(234) // 0xEA MSG_RESET_ABILITIES = Op(235) // 0xEB MSG_RATE_CHANGE = Op(236) // 0xEC MSG_REPORT_CREATURE_CMD = Op(237) // 0xED MSG_VOTE = Op(238) // 0xEE MSG_STAT_MULTIPLIERS = Op(239) // 0xEF MSG_GAUNTLET = Op(240) // 0xF0 MSG_INVENTORY_FAIL = Op(241) // 0xF1 )
View Source
const ( InfoSpellErr = InformCode(0) InfoSpellOK = InformCode(1) InfoAbility = InformCode(2) InfoPlayerTimeout = InformCode(3) InfoFlagRetrieve = InformCode(4) InfoFlagCapture = InformCode(5) InfoFlagPickup = InformCode(6) InfoFlagDrop = InformCode(7) InfoFlagRespawn = InformCode(8) InfoBallScore = InformCode(9) InfoCrownPickup = InformCode(10) InfoCrownDrop = InformCode(11) InfoObserver = InformCode(12) InfoPlayerState = InformCode(13) InfoKill = InformCode(14) InfoStringID = InformCode(15) InfoWrongTeam = InformCode(16) InfoClassChanged = InformCode(17) InfoPlayerExit = InformCode(18) InfoPlayerWarp = InformCode(19) InfoPlayerSecret = InformCode(20) InfoPlayerWarpWait = InformCode(21) )
View Source
const ( CCOrientation = CtrlCode(1) CCMoveForward = CtrlCode(2) CCMoveBackward = CtrlCode(3) CCMoveLeft = CtrlCode(4) CCMoveRight = CtrlCode(5) CCAction = CtrlCode(6) CCJump = CtrlCode(7) CCChat = CtrlCode(8) CCTeamChat = CtrlCode(9) CCReadSpellbook = CtrlCode(10) CCToggleConsole = CtrlCode(11) CCIncreaseWindowSize = CtrlCode(12) CCDecreaseWindowSize = CtrlCode(13) CCIncreaseGamma = CtrlCode(14) CCDecreaseGamma = CtrlCode(15) CCQuit = CtrlCode(16) CCQuitMenu = CtrlCode(17) CCReadMap = CtrlCode(18) CCInventory = CtrlCode(19) CCSpellGestureUp = CtrlCode(20) CCSpellGestureDown = CtrlCode(21) CCSpellGestureLeft = CtrlCode(22) CCSpellGestureRight = CtrlCode(23) CCSpellGestureUpperRight = CtrlCode(24) CCSpellGestureUpperLeft = CtrlCode(25) CCSpellGestureLowerRight = CtrlCode(26) CCSpellGestureLowerLeft = CtrlCode(27) CCSpellPatternEnd = CtrlCode(28) CCCastQueuedSpell = CtrlCode(29) CCCastMostRecentSpell = CtrlCode(30) CCCastSpell1 = CtrlCode(31) CCCastSpell2 = CtrlCode(32) CCCastSpell3 = CtrlCode(33) CCCastSpell4 = CtrlCode(34) CCCastSpell5 = CtrlCode(35) CCMapZoomIn = CtrlCode(36) CCMapZoomOut = CtrlCode(37) CCNextWeapon = CtrlCode(38) CCQuickHealthPotion = CtrlCode(39) CCQuickManaPotion = CtrlCode(40) CCQuickCurePoisonPotion = CtrlCode(41) CCNextSpellSet = CtrlCode(42) CCPreviousSpellSet = CtrlCode(43) CCSelectSpellSet = CtrlCode(44) CCBuildTrap = CtrlCode(45) CCServerOptions = CtrlCode(46) CCTaunt = CtrlCode(47) CCLaugh = CtrlCode(48) CCPoint = CtrlCode(49) CCInvertSpellTarget = CtrlCode(50) CCToggleRank = CtrlCode(51) CCToggleNetstat = CtrlCode(52) CCToggleGUI = CtrlCode(53) CCAutoSave = CtrlCode(54) CCAutoLoad = CtrlCode(55) CCScreenShot = CtrlCode(56) )
View Source
const ( ErrLowPing = ConnectError(iota) ErrHighPing ErrLowLevel ErrHighLevel ErrClosed ErrBanned ErrWrongPassword ErrIllegalClass ErrTimeOut ErrFindFailed ErrNeedRefresh ErrFull ErrDupSerial ErrWrongVer )
View Source
const ( TextTeam = TextFlags(0x1) TextUTF8 = TextFlags(0x2) TextFlag4 = TextFlags(0x2) TextLocalized = TextFlags(0x8) TextNotice = TextFlags(0x10) TextFlag20 = TextFlags(0x20) TextFlag40 = TextFlags(0x40) TextExt = TextFlags(0x80) // unused in vanilla )
View Source
const ( DefaultPort = 18590 ProtoVersion = 0x1039a // 0.1.922 ProtoVersionHD = 0xf039a // 0.15.922 )
View Source
const ( MaxStreams = 128 ServerStreamID = StreamID(0) MaxStreamID = StreamID(MaxStreams - 1) )
Variables ¶
View Source
var ( ErrPasswordRequired = errors.New("password required") ErrJoinFailed = errors.New("join failed") )
Functions ¶
func EncodePacketSize ¶
func RegisterMessage ¶
Types ¶
type Client ¶
type Client struct { Port *Port // contains filtered or unexported fields }
func (*Client) SetServerAddr ¶
type ComplexObjectUpdate ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) CancelReliable ¶
func (*Conn) OnMessage ¶
func (p *Conn) OnMessage(fnc OnMessageFunc)
func (*Conn) QueueReliable ¶
func (*Conn) QueueReliableMsg ¶
func (*Conn) RemoteAddr ¶
func (*Conn) SendReliable ¶
func (*Conn) SendReliableMsg ¶
func (*Conn) UpdateQueue ¶
type ConnectError ¶
type ConnectError byte
func (ConnectError) Error ¶
func (e ConnectError) Error() string
func (ConnectError) Name ¶
func (e ConnectError) Name() string
type ErrorMsg ¶
func ErrorToMsg ¶
type Inform ¶
type Inform interface { InformCode() InformCode Encoded }
type InformClassChanged ¶
type InformClassChanged struct { }
func (*InformClassChanged) EncodeSize ¶
func (*InformClassChanged) EncodeSize() int
func (*InformClassChanged) InformCode ¶
func (*InformClassChanged) InformCode() InformCode
type InformCode ¶
type InformCode byte
type InformKill ¶
func (*InformKill) EncodeSize ¶
func (*InformKill) EncodeSize() int
func (*InformKill) InformCode ¶
func (*InformKill) InformCode() InformCode
type InformObserver ¶
type InformObserver struct {
Prompt uint32
}
func (*InformObserver) EncodeSize ¶
func (*InformObserver) EncodeSize() int
func (*InformObserver) InformCode ¶
func (*InformObserver) InformCode() InformCode
type InformPlayer ¶
type InformPlayer struct { Code InformCode PlayerID uint32 }
func (*InformPlayer) EncodeSize ¶
func (*InformPlayer) EncodeSize() int
func (*InformPlayer) InformCode ¶
func (m *InformPlayer) InformCode() InformCode
type InformPlayerState ¶
type InformPlayerState struct {
State uint32
}
func (*InformPlayerState) EncodeSize ¶
func (*InformPlayerState) EncodeSize() int
func (*InformPlayerState) InformCode ¶
func (*InformPlayerState) InformCode() InformCode
type InformSpell ¶
type InformSpell struct { Code InformCode Ind uint32 }
func (*InformSpell) EncodeSize ¶
func (*InformSpell) EncodeSize() int
func (*InformSpell) InformCode ¶
func (m *InformSpell) InformCode() InformCode
type InformStringID ¶
func (*InformStringID) EncodeSize ¶
func (m *InformStringID) EncodeSize() int
func (*InformStringID) InformCode ¶
func (*InformStringID) InformCode() InformCode
type InformTeam ¶
type InformTeam struct { Code InformCode TeamID uint32 }
func (*InformTeam) EncodeSize ¶
func (*InformTeam) EncodeSize() int
func (*InformTeam) InformCode ¶
func (m *InformTeam) InformCode() InformCode
type InformTeamPlayer ¶
type InformTeamPlayer struct { Code InformCode PlayerID uint32 TeamID uint32 }
func (*InformTeamPlayer) EncodeSize ¶
func (*InformTeamPlayer) EncodeSize() int
func (*InformTeamPlayer) InformCode ¶
func (m *InformTeamPlayer) InformCode() InformCode
type InformWarpWait ¶
type InformWarpWait struct {
Stage uint32
}
func (*InformWarpWait) EncodeSize ¶
func (*InformWarpWait) EncodeSize() int
func (*InformWarpWait) InformCode ¶
func (*InformWarpWait) InformCode() InformCode
type Mapper ¶
type MsgClientAccept ¶
type MsgClientAccept struct { PlayerName string // 0-65 PlayerClass byte // 66 IsFemale byte // 67 Unk70 [29]byte Screen image.Point // 97-104 Serial string // 105-126 Unk129 [26]byte }
func (*MsgClientAccept) EncodeSize ¶
func (*MsgClientAccept) EncodeSize() int
func (*MsgClientAccept) NetOp ¶
func (*MsgClientAccept) NetOp() Op
type MsgClientPing ¶
func (*MsgClientPing) EncodeSize ¶
func (*MsgClientPing) EncodeSize() int
func (*MsgClientPing) NetOp ¶
func (*MsgClientPing) NetOp() Op
func (*MsgClientPing) Pong ¶
func (m *MsgClientPing) Pong() *MsgClientPong
type MsgClientPong ¶
func (*MsgClientPong) EncodeSize ¶
func (*MsgClientPong) EncodeSize() int
func (*MsgClientPong) NetOp ¶
func (*MsgClientPong) NetOp() Op
type MsgConnect ¶
type MsgConnect struct { }
func (*MsgConnect) EncodeSize ¶
func (*MsgConnect) EncodeSize() int
func (*MsgConnect) NetOp ¶
func (*MsgConnect) NetOp() Op
type MsgDiscover ¶
func (*MsgDiscover) EncodeSize ¶
func (*MsgDiscover) EncodeSize() int
func (*MsgDiscover) NetOp ¶
func (*MsgDiscover) NetOp() Op
type MsgFadeBegin ¶
func (*MsgFadeBegin) EncodeSize ¶
func (*MsgFadeBegin) EncodeSize() int
func (*MsgFadeBegin) NetOp ¶
func (*MsgFadeBegin) NetOp() Op
type MsgFullTimestamp ¶
type MsgFullTimestamp struct {
T Timestamp
}
func (*MsgFullTimestamp) EncodeSize ¶
func (*MsgFullTimestamp) EncodeSize() int
func (*MsgFullTimestamp) NetOp ¶
func (*MsgFullTimestamp) NetOp() Op
type MsgFxJiggle ¶
type MsgFxJiggle struct {
Val byte
}
func (*MsgFxJiggle) EncodeSize ¶
func (*MsgFxJiggle) EncodeSize() int
func (*MsgFxJiggle) NetOp ¶
func (*MsgFxJiggle) NetOp() Op
type MsgImportant ¶
type MsgImportant struct {
ID uint32
}
func (*MsgImportant) EncodeSize ¶
func (*MsgImportant) EncodeSize() int
func (*MsgImportant) NetOp ¶
func (*MsgImportant) NetOp() Op
type MsgImportantAck ¶
type MsgImportantAck struct {
ID uint32
}
func (*MsgImportantAck) EncodeSize ¶
func (*MsgImportantAck) EncodeSize() int
func (*MsgImportantAck) NetOp ¶
func (*MsgImportantAck) NetOp() Op
type MsgJoinData ¶
func (*MsgJoinData) EncodeSize ¶
func (*MsgJoinData) EncodeSize() int
func (*MsgJoinData) NetOp ¶
func (*MsgJoinData) NetOp() Op
type MsgJoinFailed ¶
type MsgJoinFailed struct { }
func (*MsgJoinFailed) EncodeSize ¶
func (*MsgJoinFailed) EncodeSize() int
func (*MsgJoinFailed) Error ¶
func (*MsgJoinFailed) Error() error
func (*MsgJoinFailed) NetOp ¶
func (*MsgJoinFailed) NetOp() Op
type MsgKeepAlive ¶
type MsgKeepAlive struct { }
func (*MsgKeepAlive) EncodeSize ¶
func (*MsgKeepAlive) EncodeSize() int
func (*MsgKeepAlive) NetOp ¶
func (*MsgKeepAlive) NetOp() Op
type MsgMapReceived ¶
type MsgMapReceived struct { }
func (*MsgMapReceived) EncodeSize ¶
func (*MsgMapReceived) EncodeSize() int
func (*MsgMapReceived) NetOp ¶
func (*MsgMapReceived) NetOp() Op
type MsgMapSendAbort ¶
type MsgMapSendAbort struct {
Code byte
}
func (*MsgMapSendAbort) EncodeSize ¶
func (*MsgMapSendAbort) EncodeSize() int
func (*MsgMapSendAbort) NetOp ¶
func (*MsgMapSendAbort) NetOp() Op
type MsgMapSendPacket ¶
func (*MsgMapSendPacket) EncodeSize ¶
func (p *MsgMapSendPacket) EncodeSize() int
func (*MsgMapSendPacket) NetOp ¶
func (*MsgMapSendPacket) NetOp() Op
type MsgMapSendStart ¶
func (*MsgMapSendStart) EncodeSize ¶
func (*MsgMapSendStart) EncodeSize() int
func (*MsgMapSendStart) NetOp ¶
func (*MsgMapSendStart) NetOp() Op
type MsgNewAlias ¶
type MsgNewAlias struct { Alias UpdateAlias ID UpdateObjectID Deadline Timestamp }
func (*MsgNewAlias) EncodeSize ¶
func (*MsgNewAlias) EncodeSize() int
func (*MsgNewAlias) NetOp ¶
func (*MsgNewAlias) NetOp() Op
type MsgPasswordRequired ¶
type MsgPasswordRequired struct { }
func (*MsgPasswordRequired) EncodeSize ¶
func (*MsgPasswordRequired) EncodeSize() int
func (*MsgPasswordRequired) Error ¶
func (*MsgPasswordRequired) Error() error
func (*MsgPasswordRequired) NetOp ¶
func (*MsgPasswordRequired) NetOp() Op
type MsgPlayerInput ¶
type MsgPlayerInput struct {
Inputs []PlayerInput
}
func (*MsgPlayerInput) EncodeSize ¶
func (m *MsgPlayerInput) EncodeSize() int
func (*MsgPlayerInput) NetOp ¶
func (*MsgPlayerInput) NetOp() Op
type MsgRateChange ¶
type MsgRateChange struct {
Rate byte
}
func (*MsgRateChange) EncodeSize ¶
func (*MsgRateChange) EncodeSize() int
func (*MsgRateChange) NetOp ¶
func (*MsgRateChange) NetOp() Op
type MsgServerAccept ¶
func (*MsgServerAccept) EncodeSize ¶
func (*MsgServerAccept) EncodeSize() int
func (*MsgServerAccept) NetOp ¶
func (*MsgServerAccept) NetOp() Op
type MsgServerCmd ¶
func (*MsgServerCmd) EncodeSize ¶
func (p *MsgServerCmd) EncodeSize() int
func (*MsgServerCmd) NetOp ¶
func (*MsgServerCmd) NetOp() Op
type MsgServerError ¶
type MsgServerError struct {
Err ConnectError
}
func (*MsgServerError) EncodeSize ¶
func (*MsgServerError) EncodeSize() int
func (*MsgServerError) Error ¶
func (p *MsgServerError) Error() error
func (*MsgServerError) NetOp ¶
func (*MsgServerError) NetOp() Op
type MsgServerInfo ¶
type MsgServerInfo struct { PlayersCur byte // 0 PlayersMax byte // 1 Unk2 [5]byte // 2-6 MapName string // 7-15 Status1 byte // 16 Status2 byte // 17 Unk19 [7]byte // 18-24 Flags uint16 // 25-26 Unk27 [2]byte // 27-28 Unk29 [8]byte // 29-36 Unk37 [4]byte // 37-40 Token uint32 // 41-44 Unk45 [20]byte // 45-64 Unk65 [4]byte // 65-68 ServerName string // 69+ }
func (*MsgServerInfo) EncodeSize ¶
func (p *MsgServerInfo) EncodeSize() int
func (*MsgServerInfo) NetOp ¶
func (*MsgServerInfo) NetOp() Op
type MsgServerPass ¶
func (*MsgServerPass) EncodeSize ¶
func (*MsgServerPass) EncodeSize() int
func (*MsgServerPass) NetOp ¶
func (*MsgServerPass) NetOp() Op
type MsgServerPing ¶
func (*MsgServerPing) EncodeSize ¶
func (*MsgServerPing) EncodeSize() int
func (*MsgServerPing) NetOp ¶
func (*MsgServerPing) NetOp() Op
func (*MsgServerPing) Pong ¶
func (m *MsgServerPing) Pong() *MsgServerPong
type MsgServerPong ¶
func (*MsgServerPong) EncodeSize ¶
func (*MsgServerPong) EncodeSize() int
func (*MsgServerPong) NetOp ¶
func (*MsgServerPong) NetOp() Op
type MsgServerTryJoin ¶
type MsgServerTryJoin struct { Unk0 byte // 0 PlayerName string // 1-50 PlayerClass byte // 51 PlayerLevel byte // 52 Serial string // 53-76 Version uint32 // 77-80 Team uint32 // 81-84 Unk85 [10]byte // 85-88 Unk95 byte // 95 Unk96 byte // 96 }
func (*MsgServerTryJoin) EncodeSize ¶
func (*MsgServerTryJoin) EncodeSize() int
func (*MsgServerTryJoin) NetOp ¶
func (*MsgServerTryJoin) NetOp() Op
type MsgSpeed ¶
type MsgSpeed struct {
Speed int32 // 256 KB / T ms (or -1)
}
func (*MsgSpeed) EncodeSize ¶
type MsgStatMult ¶
func (*MsgStatMult) EncodeSize ¶
func (*MsgStatMult) EncodeSize() int
func (*MsgStatMult) NetOp ¶
func (*MsgStatMult) NetOp() Op
type MsgText ¶
type MsgText struct { NetCode uint16 Flags TextFlags PosX uint16 PosY uint16 Size byte Dur uint16 Data []byte // max: 510 }
func (*MsgText) EncodeSize ¶
type MsgTimestamp ¶
type MsgTimestamp struct {
T uint16
}
func (*MsgTimestamp) EncodeSize ¶
func (*MsgTimestamp) EncodeSize() int
func (*MsgTimestamp) NetOp ¶
func (*MsgTimestamp) NetOp() Op
type MsgUnknown ¶
func (*MsgUnknown) EncodeSize ¶
func (p *MsgUnknown) EncodeSize() int
func (*MsgUnknown) NetOp ¶
func (p *MsgUnknown) NetOp() Op
type MsgUpdateStream ¶
type MsgUpdateStream struct { ID UpdateID Pos image.Point Flags byte Unk4 byte // anim frame? Unk5 byte Objects []ObjectUpdate }
func (*MsgUpdateStream) EncodeSize ¶
func (*MsgUpdateStream) EncodeSize() int
func (*MsgUpdateStream) NetOp ¶
func (*MsgUpdateStream) NetOp() Op
type MsgUseMap ¶
func (*MsgUseMap) EncodeSize ¶
type MsgWallDestroy ¶
type MsgWallDestroy struct {
ID uint16
}
func (*MsgWallDestroy) EncodeSize ¶
func (*MsgWallDestroy) EncodeSize() int
func (*MsgWallDestroy) NetOp ¶
func (*MsgWallDestroy) NetOp() Op
type MsgXfer ¶
func (*MsgXfer) EncodeSize ¶
type ObjectUpdate ¶
type ObjectUpdate struct { ID UpdateID Pos image.Point Complex *ComplexObjectUpdate }
type PacketConn ¶
type PipeConn ¶
type PipeConn struct { Log *slog.Logger Addr netip.AddrPort Port *Port Drop func(data []byte) bool Debug bool // contains filtered or unexported fields }
func (*PipeConn) ReadFromUDPAddrPort ¶
type PlayerInput ¶
type PlayerInput0 ¶
type PlayerInput0 struct {
Code CtrlCode
}
func (*PlayerInput0) CtrlCode ¶
func (p *PlayerInput0) CtrlCode() CtrlCode
func (*PlayerInput0) EncodeSize ¶
func (*PlayerInput0) EncodeSize() int
type PlayerInput1 ¶
func (*PlayerInput1) CtrlCode ¶
func (p *PlayerInput1) CtrlCode() CtrlCode
func (*PlayerInput1) EncodeSize ¶
func (*PlayerInput1) EncodeSize() int
type PlayerInput4 ¶
func (*PlayerInput4) CtrlCode ¶
func (p *PlayerInput4) CtrlCode() CtrlCode
func (*PlayerInput4) EncodeSize ¶
func (*PlayerInput4) EncodeSize() int
type Server ¶
type Server struct { Port *Port // contains filtered or unexported fields }
func NewServer ¶
func NewServer(log *slog.Logger, conn PacketConn, e Engine, opts *ServerOptions) *Server
func NewServerWithPort ¶
type ServerInfoResp ¶
type ServerInfoResp struct { Addr netip.AddrPort Info MsgServerInfo }
type ServerOptions ¶
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
func (*Stream) CancelReliable ¶
func (*Stream) OnMessage ¶
func (p *Stream) OnMessage(fnc OnMessageFunc)
func (*Stream) QueueReliable ¶
func (*Stream) QueueReliableMsg ¶
func (*Stream) SendReliableMsg ¶
func (*Stream) SendUnreliable ¶
func (*Stream) SendUnreliableMsg ¶
type UpdateAlias ¶
type UpdateAlias byte
type UpdateObjectID ¶
Source Files ¶
- client.go
- codes.go
- message.go
- msg_accept.go
- msg_discover.go
- msg_fade.go
- msg_fx_jiggle.go
- msg_important.go
- msg_inform.go
- msg_join_data.go
- msg_map_send.go
- msg_ping.go
- msg_player_input.go
- msg_server_cmd.go
- msg_server_error.go
- msg_server_join.go
- msg_server_pass.go
- msg_stat_mult.go
- msg_text.go
- msg_timestamp.go
- msg_update_stream.go
- msg_use_map.go
- msg_wall_destroy.go
- msg_xfer.go
- object_types.go
- op_string.go
- server.go
- udpconn.go
- updpipe.go
Click to show internal directories.
Click to hide internal directories.