packet

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CombatActionTypeNone     = 0x00
	CombatActionTypeTakeHit  = 0x01 // 뚜둘겨 맞음
	CombatActionTypeAttacker = 0x02 // 공격했음 or 디펜스 or 카운터어택
	// CombatActionTypeUnknown = 0x04
	CombatActionTypeSkillActive          = 0x10
	CombatActionTypeSkillSuccess         = 0x20
	CombatActionTypeSkillPlayerCharacter = 0x40
)
View Source
const (
	CombatActionHitOptionsCritical = 0x01
	CombatActionHitOptionsMultiHit = 0x200_0000
)
View Source
const (
	OpCodeSystemError   = 0xFFFFFFFF
	OpCodeSystemWarning = 0xFFFFFFFE
)
View Source
const (
	CombatActionAttackerOptionsUseEffect = 0x400
)

Variables

View Source
var ErrTooShortPacket = errors.New("too short packet")

Functions

func ConfigureLoggerOutput

func ConfigureLoggerOutput(w io.Writer)

func ParseEntitiesDisappearPacket

func ParseEntitiesDisappearPacket(p *GamePacket) ([]uint64, error)

EntitiesDisappearPacket (Batch): OpCode: 0x5335 Structure: Short (Count) [Short, Long (EntityID), Byte] repeated Count times

func ParseEntityDisappearPacket

func ParseEntityDisappearPacket(p *GamePacket) (uint64, error)

EntityDisappearPacket is usually just the ID of the entity that disappeared. However, the packet structure can vary. Based on user feedback: EntityDisappear (Single): First element is Long (Entity ID).

Types

type CharacterConditionPacket

type CharacterConditionPacket struct {
	Id       uint64
	IsEnable bool
	EntityCharacterCondition
}

func ParseCharacterConditionPacket

func ParseCharacterConditionPacket(p *GamePacket) (*CharacterConditionPacket, error)

type CombatActionAttackerOptions

type CombatActionAttackerOptions uint32

type CombatActionHitOptions

type CombatActionHitOptions uint32

type CombatActionPackPacket

type CombatActionPackPacket struct {
	Id                 uint64 // packet target id
	CombatActionId     uint32
	PrevCombatActionId uint32
	Hit                bool
	Type               uint8
	Unk1               uint8
	Flag               uint8

	SubPackets []*CombatActionPacket
}

func ParseCombatActionPackPacket

func ParseCombatActionPackPacket(p *GamePacket) (*CombatActionPackPacket, error)

type CombatActionPacket

type CombatActionPacket struct {
	Id             uint64 // packet target id
	CombatActionId uint32
	EntityId       uint64
	Type           CombatActionType
	Stun           uint16
	SkillId        uint16
	SubSkillId     uint16 // ?
	Unk1           uint16 // ?
	Attacker       *CombatActionPacketAttackerInfo
	Hit            *CombatActionPacketHitInfo
}

type CombatActionPacketAttackerInfo

type CombatActionPacketAttackerInfo struct {
	TargetId            uint64
	Options             CombatActionAttackerOptions
	UsedWeaponSet       uint8
	WeaponParameterType uint8
	Unk1                uint32
	PosX                uint32
	PosY                uint32
}

type CombatActionPacketHitInfo

type CombatActionPacketHitInfo struct {
	Options    CombatActionHitOptions
	Damage     float32
	Wound      float32
	ManaDamage uint32
	AttackerId uint64
}

type CombatActionType

type CombatActionType uint8

type EntityCharacterCondition

type EntityCharacterCondition struct {
	CCId       uint32
	DisableAt  int64
	MetaData   string
	AttackerId uint64
}

type EntityInfo

type EntityInfo struct {
	Id                    uint64
	Name                  string
	RaceId                uint32
	SkinColor             uint8
	EyeType               uint16
	LeftEyeColor          uint8
	RightEyeColor         uint8
	MouthType             uint16
	Height                float32
	Weight                float32
	Upper                 float32
	Lower                 float32
	TitleId               uint32
	SubTitleId            uint32
	StyleTitleId          uint32
	StyleSubTitleId       uint32
	EquipItemMap          map[uint32]*EntityItem
	CharacterConditionMap map[uint32]*EntityCharacterCondition
	GuildName             string
	OwnerId               uint64 // 펫, 마리오네트 등

	CombatPower       float32 // From element[26]
	CurrentLevel      uint16  // From element[30]
	TotalLevel        uint32  // From element[31]
	Age               uint16  // From element[32]
	CurrentHP         float32 // From element[33]
	BaseHP            float32 // From element[34]
	AdditionalHP      float32 // From element[35]
	OverflowMaxHP     float32 // From element[36]
	CurrentVitalSurge float32 // From element[37]
	MaxVitalSurge     float32 // From element[38]
	MaxHP             float32 // Calculated as BaseHP + AdditionalHP
}

func ParseEntitiesAppearPacket

func ParseEntitiesAppearPacket(p *GamePacket) ([]*EntityInfo, error)

func ParseEntityAppearPacket

func ParseEntityAppearPacket(msg Message) (*EntityInfo, error)

type EntityItem

type EntityItem struct {
	// public data
	PocketType uint32
	ItemId     uint32
	Color1     uint32
	Color2     uint32
	Color3     uint32
	Color4     uint32
	Color5     uint32
	Color6     uint32
	Color7     uint32
	Amount     uint16
	UniqueId   uint64 // Added UniqueId
}

func EntityItemReader

func EntityItemReader(b []byte) (*EntityItem, error)

type GamePacket

type GamePacket struct {
	At     time.Time
	Sign   uint8
	Length uint32
	Flag   uint8

	// raw packet
	IsShortPacket bool
	ShortBody     []byte

	// normal packet
	Op  uint32
	Id  uint64
	Msg Message

	RawPacket       []byte
	PacketDedupeKey string
	PacketFlowKey   string
}

func ParseGamePacket

func ParseGamePacket(buffer *bytes.Buffer, at time.Time) (*GamePacket, error)

type GameServerPacketReader

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

func (*GameServerPacketReader) Close

func (t *GameServerPacketReader) Close()

func (*GameServerPacketReader) PacketCh

func (t *GameServerPacketReader) PacketCh() <-chan *GamePacket

type GameServerPacketReaderOpt

type GameServerPacketReaderOpt struct {
	Ctx             context.Context
	FileName        string
	NicName         string
	ClientIp        string
	Sm              pcapWriter
	ExitLagEnabled  bool   // New: To control ExitLag processing
	Filter          string // New: To pass in the dynamic BPF filter
	PromiscuousMode bool   // New: To control Promiscuous capture
}

type IMessageElem

type IMessageElem interface {
	Type() MessageElemType
	Data() interface{}
	Bytes() []byte
	Len() uint64
	String() string
}

func NewMessageElemBin

func NewMessageElemBin(v []byte) IMessageElem

func NewMessageElemByte

func NewMessageElemByte(v uint8) IMessageElem

func NewMessageElemFloat

func NewMessageElemFloat(v float32) IMessageElem

func NewMessageElemInt

func NewMessageElemInt(v uint32) IMessageElem

func NewMessageElemLong

func NewMessageElemLong(v uint64) IMessageElem

func NewMessageElemShort

func NewMessageElemShort(v uint16) IMessageElem

func NewMessageElemString

func NewMessageElemString(v string) IMessageElem

type Message

type Message []IMessageElem

func GamePacketBodyReader

func GamePacketBodyReader(r io.Reader) (uint32, uint64, Message, error)

func NewMessage

func NewMessage(r io.Reader) (Message, error)

func (*Message) Bytes

func (t *Message) Bytes() []byte

func (*Message) DebugPrint

func (t *Message) DebugPrint()

func (*Message) Len

func (t *Message) Len() uint64

func (*Message) Write

func (t *Message) Write(w io.Writer) error

type MessageElemBin

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

func (*MessageElemBin) Bytes

func (t *MessageElemBin) Bytes() []byte

func (*MessageElemBin) Data

func (t *MessageElemBin) Data() interface{}

func (*MessageElemBin) Len

func (t *MessageElemBin) Len() uint64

func (*MessageElemBin) String

func (t *MessageElemBin) String() string

func (*MessageElemBin) Type

func (t *MessageElemBin) Type() MessageElemType

type MessageElemByte

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

func (*MessageElemByte) Bytes

func (t *MessageElemByte) Bytes() []byte

func (*MessageElemByte) Data

func (t *MessageElemByte) Data() interface{}

func (*MessageElemByte) Len

func (t *MessageElemByte) Len() uint64

func (*MessageElemByte) String

func (t *MessageElemByte) String() string

func (*MessageElemByte) Type

func (t *MessageElemByte) Type() MessageElemType

type MessageElemFloat

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

func (*MessageElemFloat) Bytes

func (t *MessageElemFloat) Bytes() []byte

func (*MessageElemFloat) Data

func (t *MessageElemFloat) Data() interface{}

func (*MessageElemFloat) Len

func (t *MessageElemFloat) Len() uint64

func (*MessageElemFloat) String

func (t *MessageElemFloat) String() string

func (*MessageElemFloat) Type

type MessageElemInt

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

func (*MessageElemInt) Bytes

func (t *MessageElemInt) Bytes() []byte

func (*MessageElemInt) Data

func (t *MessageElemInt) Data() interface{}

func (*MessageElemInt) Len

func (t *MessageElemInt) Len() uint64

func (*MessageElemInt) String

func (t *MessageElemInt) String() string

func (*MessageElemInt) Type

func (t *MessageElemInt) Type() MessageElemType

type MessageElemLong

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

func (*MessageElemLong) Bytes

func (t *MessageElemLong) Bytes() []byte

func (*MessageElemLong) Data

func (t *MessageElemLong) Data() interface{}

func (*MessageElemLong) Len

func (t *MessageElemLong) Len() uint64

func (*MessageElemLong) String

func (t *MessageElemLong) String() string

func (*MessageElemLong) Type

func (t *MessageElemLong) Type() MessageElemType

type MessageElemShort

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

func (*MessageElemShort) Bytes

func (t *MessageElemShort) Bytes() []byte

func (*MessageElemShort) Data

func (t *MessageElemShort) Data() interface{}

func (*MessageElemShort) Len

func (t *MessageElemShort) Len() uint64

func (*MessageElemShort) String

func (t *MessageElemShort) String() string

func (*MessageElemShort) Type

type MessageElemString

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

func (*MessageElemString) Bytes

func (t *MessageElemString) Bytes() []byte

func (*MessageElemString) Data

func (t *MessageElemString) Data() interface{}

func (*MessageElemString) Len

func (t *MessageElemString) Len() uint64

func (*MessageElemString) String

func (t *MessageElemString) String() string

func (*MessageElemString) Type

type MessageElemType

type MessageElemType uint8
const (
	MessageElemTypeByte MessageElemType = 1 + iota
	MessageElemTypeShort
	MessageElemTypeInt
	MessageElemTypeLong
	MessageElemTypeFloat
	MessageElemTypeString
	MessageElemTypeBin
)

type PublicStatUpdatePacket

type PublicStatUpdatePacket struct {
	EntityId uint64
	Stats    map[uint32]float32
}

PublicStatUpdatePacket represents a parsed public stat update.

func ParsePublicStatUpdatePacket

func ParsePublicStatUpdatePacket(p *GamePacket) (*PublicStatUpdatePacket, error)

ParsePublicStatUpdatePacket parses opcode 0x7532 packets. Layout: - Message element 0 is a Byte whose value must be 4. - Message element 1 is an Int (or other integer representation) representing the count of pairs N. - Followed by N pairs of [Stat ID, Stat Value].

  • Stat ID is an Int, Short, or Byte.
  • Stat Value is a Float.

Jump to

Keyboard shortcuts

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