update

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package update provides functions for serializing and deserializing SMSG_UPDATE_OBJECT. update also contains structures and functions pertaining to movement packets, which can be encoded inside of SMSG_UPDATE_OBJECT. SMSG_UPDATE_OBJECT notifies the game client of incremental state changes, or updates, to in-world objects. The structure of this packet varies extremely across protocol revisions, so this package incorporates several descriptor packages for storing fields.

Index

Constants

View Source
const (
	DescriptorOptionClassicGUIDs = 1 << iota
	DescriptorOptionHasHasTransport
	DescriptorOptionAlpha
)

Variables

View Source
var (
	UpdateFlagDescriptors = map[vsn.BuildRange]UpdateFlagDescriptor{
		vsn.Range(0, 5875): {
			UpdateFlagSelf:               0x0001,
			UpdateFlagTransport:          0x0002,
			UpdateFlagHasAttackingTarget: 0x0004,
			UpdateFlagHighGUID:           0x0008,
			UpdateFlagAll:                0x0010,
			UpdateFlagLiving:             0x0020,
			UpdateFlagHasPosition:        0x0040,
		},

		vsn.Range(6180, 12340): {
			UpdateFlagSelf:               0x0001,
			UpdateFlagTransport:          0x0002,
			UpdateFlagHasAttackingTarget: 0x0004,
			UpdateFlagLowGUID:            0x0008,
			UpdateFlagHighGUID:           0x0010,
			UpdateFlagLiving:             0x0020,
			UpdateFlagHasPosition:        0x0040,
			UpdateFlagVehicle:            0x0080,
			UpdateFlagPosition:           0x0100,
			UpdateFlagRotation:           0x0200,
		},
	}

	MoveFlagDescriptors = map[vsn.BuildRange]MoveFlagDescriptor{
		vsn.Range(0, 3368): {
			MoveFlagForward:         0x1,
			MoveFlagBackward:        0x2,
			MoveFlagStrafeLeft:      0x4,
			MoveFlagStrafeRight:     0x8,
			MoveFlagTurnLeft:        0x10,
			MoveFlagTurnRight:       0x20,
			MoveFlagPitchUp:         0x40,
			MoveFlagPitchDown:       0x80,
			MoveFlagWalkMode:        0x100,
			MoveFlagTimeValid:       0x200,
			MoveFlagImmobilized:     0x400,
			MoveFlagDontCollide:     0x800,
			MoveFlagRedirected:      0x1000,
			MoveFlagRoot:            0x2000,
			MoveFlagFalling:         0x4000,
			MoveFlagFallingFar:      0x8000,
			MoveFlagPendingStop:     0x10000,
			MoveFlagPendingUnstrafe: 0x20000,
			MoveFlagPendingFall:     0x40000,
			MoveFlagPendingForward:  0x80000,
			MoveFlagPendingBackward: 0x100000,
			MoveFlagPendingStrLeft:  0x200000,
			MoveFlagPendingStrRight: 0x400000,
			MoveFlagMoved:           0x800000,
			MoveFlagSliding:         0x1000000,
			MoveFlagSwimming:        0x2000000,
			MoveFlagSplineEnabled:   0x4000000,
		},

		vsn.Range(vsn.V1_12_1, 6005): {
			MoveFlagForward:     0x00000001,
			MoveFlagBackward:    0x00000002,
			MoveFlagStrafeLeft:  0x00000004,
			MoveFlagStrafeRight: 0x00000008,
			MoveFlagTurnLeft:    0x00000010,
			MoveFlagTurnRight:   0x00000020,
			MoveFlagPitchUp:     0x00000040,
			MoveFlagPitchDown:   0x00000080,
			MoveFlagWalkMode:    0x00000100,

			MoveFlagLevitating:    0x00000400,
			MoveFlagFlying:        0x00000800,
			MoveFlagFalling:       0x00002000,
			MoveFlagFallingFar:    0x00004000,
			MoveFlagSwimming:      0x00200000,
			MoveFlagSplineEnabled: 0x00400000,
			MoveFlagCanFly:        0x00800000,
			MoveFlagFlyingOld:     0x01000000,

			MoveFlagOnTransport:     0x02000000,
			MoveFlagSplineElevation: 0x04000000,
			MoveFlagRoot:            0x08000000,
			MoveFlagWaterwalking:    0x10000000,
			MoveFlagSafeFall:        0x20000000,
			MoveFlagHover:           0x40000000,
		},

		vsn.Range(vsn.V2_0_1, vsn.V2_4_3): {
			MoveFlagForward:         0x00000001,
			MoveFlagBackward:        0x00000002,
			MoveFlagStrafeLeft:      0x00000004,
			MoveFlagStrafeRight:     0x00000008,
			MoveFlagTurnLeft:        0x00000010,
			MoveFlagTurnRight:       0x00000020,
			MoveFlagPitchUp:         0x00000040,
			MoveFlagPitchDown:       0x00000080,
			MoveFlagWalkMode:        0x00000100,
			MoveFlagOnTransport:     0x00000200,
			MoveFlagLevitating:      0x00000400,
			MoveFlagRoot:            0x00000800,
			MoveFlagFalling:         0x00001000,
			MoveFlagFallingFar:      0x00004000,
			MoveFlagSwimming:        0x00200000,
			MoveFlagAscending:       0x00400000,
			MoveFlagCanFly:          0x00800000,
			MoveFlagFlyingOld:       0x01000000,
			MoveFlagFlying:          0x02000000,
			MoveFlagSplineElevation: 0x04000000,
			MoveFlagSplineEnabled:   0x08000000,
			MoveFlagWaterwalking:    0x10000000,
			MoveFlagSafeFall:        0x20000000,
			MoveFlagHover:           0x40000000,
		},

		vsn.Range(vsn.V3_0_2, vsn.V3_3_5a): {
			MoveFlagForward:         0x00000001,
			MoveFlagBackward:        0x00000002,
			MoveFlagStrafeLeft:      0x00000004,
			MoveFlagStrafeRight:     0x00000008,
			MoveFlagTurnLeft:        0x00000010,
			MoveFlagTurnRight:       0x00000020,
			MoveFlagPitchUp:         0x00000040,
			MoveFlagPitchDown:       0x00000080,
			MoveFlagWalkMode:        0x00000100,
			MoveFlagOnTransport:     0x00000200,
			MoveFlagLevitating:      0x00000400,
			MoveFlagRoot:            0x00000800,
			MoveFlagFalling:         0x00001000,
			MoveFlagFallingFar:      0x00004000,
			MoveFlagSwimming:        0x00200000,
			MoveFlagAscending:       0x00400000,
			MoveFlagCanFly:          0x00800000,
			MoveFlagFlyingOld:       0x01000000,
			MoveFlagFlying:          0x02000000,
			MoveFlagSplineElevation: 0x04000000,
			MoveFlagSplineEnabled:   0x08000000,
			MoveFlagWaterwalking:    0x10000000,
			MoveFlagSafeFall:        0x20000000,
			MoveFlagHover:           0x40000000,

			MoveFlagNoStrafe:            0x10000000,
			MoveFlagFullSpeedTurning:    0x800000000,
			MoveFlagFullSpeedPitching:   0x1000000000,
			MoveFlagAllowPitching:       0x2000000000,
			MoveFlagInterpolateMovement: 0x40000000000,
			MoveFlagInterpolateTurning:  0x80000000000,
			MoveFlagInterpolatePitching: 0x100000000000,
		},
	}

	SpeedLists = map[vsn.BuildRange][]SpeedType{
		vsn.Range(0, vsn.Alpha): {
			Walk,
			Run,
			Swim,
			Turn,
		},

		vsn.Range(vsn.V1_12_1, 6005): {
			Walk,
			Run,
			RunBackward,
			Swim,
			SwimBackward,
			Turn,
		},

		vsn.Range(vsn.V2_0_1, vsn.V2_4_3): {
			Walk,
			Run,
			RunBackward,
			Swim,
			SwimBackward,
			Flight,
			FlightBackward,
			Turn,
		},

		vsn.Range(vsn.V3_0_2, vsn.Max): {
			Walk,
			Run,
			RunBackward,
			Swim,
			SwimBackward,
			Flight,
			FlightBackward,
			Turn,
			Pitch,
		},
	}
)
View Source
var BlockTypeDescriptors = map[vsn.BuildRange]BlockTypeDescriptor{
	{0, 3368}: {
		Values:            0,
		Movement:          1,
		CreateObject:      2,
		SpawnObject:       2,
		DeleteFarObjects:  3,
		DeleteNearObjects: 4,
	},

	{5875, 6005}: {
		Values:            0,
		Movement:          1,
		CreateObject:      2,
		SpawnObject:       3,
		DeleteFarObjects:  4,
		DeleteNearObjects: 5,
	},

	{8606, vsn.Max}: {
		Values:            0,
		Movement:          1,
		CreateObject:      2,
		SpawnObject:       3,
		DeleteFarObjects:  4,
		DeleteNearObjects: 5,
	},
}
View Source
var (
	Descriptors = map[vsn.BuildRange]*Descriptor{}
)
View Source
var (
	ErrNotAStruct = errors.New("update: not a struct")
)
View Source
var ItemFlagLookup = map[string]ItemFlag{}
View Source
var ItemFlagNames = map[ItemFlag]string{}/* 107 elements not displayed */
View Source
var (
	MaxBlockCount uint32 = 2048
)
View Source
var (
	SplineFlagDescriptors = map[vsn.BuildRange]SplineFlagDescriptor{
		{0, 5875}: {
			SplineDone:        0x00000001,
			SplineFalling:     0x00000002,
			SplineFlying:      0x00000200,
			SplineNoSpline:    0x00000400,
			SplineFinalPoint:  0x00010000,
			SplineFinalTarget: 0x00020000,
			SplineFinalAngle:  0x00040000,
			SplineCyclic:      0x00100000,
			SplineEnterCycle:  0x00200000,
			SplineFrozen:      0x00400000,
		},

		{vsn.V2_0_1, vsn.V3_3_5a}: {

			SplineDone:                0x00000100,
			SplineFalling:             0x00000200,
			SplineNoSpline:            0x00000400,
			SplineParabolic:           0x00000800,
			SplineWalkmode:            0x00001000,
			SplineFlying:              0x00002000,
			SplineOrientationFixed:    0x00004000,
			SplineFinalPoint:          0x00008000,
			SplineFinalTarget:         0x00010000,
			SplineFinalAngle:          0x00020000,
			SplineCatmullrom:          0x00040000,
			SplineCyclic:              0x00080000,
			SplineEnterCycle:          0x00100000,
			SplineAnimation:           0x00200000,
			SplineFrozen:              0x00400000,
			SplineBoardVehicle:        0x00800000,
			SplineExitVehicle:         0x01000000,
			SplineOrientationInverted: 0x08000000,
		},
	}
)

Functions

func EncodeMoveSpline

func EncodeMoveSpline(version vsn.Build, out io.Writer, ms *MoveSpline) error

func EncodeMovementInfo

func EncodeMovementInfo(version vsn.Build, out io.Writer, mi *MovementInfo) error

func SetAuraFlag

func SetAuraFlag(flagarray *Value, index int, value AuraFlags) error

func WriteBitmask

func WriteBitmask(mask *Bitmask, descriptor *Descriptor, writer io.Writer) error

Types

type AlignPad

type AlignPad struct{}

AlignPad is equivalent to ChunkPad except it always is included and encoded as zero.

type AuraFlags

type AuraFlags uint8
const (
	AuraCancelable AuraFlags = 1 << iota
	AuraUnk2
	AuraUnk3
	AuraUnk4
)
const AuraMaskAll AuraFlags = 0x0F

type BitPad

type BitPad struct{}

BitPad will move the bit offset 1 forward. If a detected value is 1 at this location, it will not return an error.

type Bitmask

type Bitmask []uint32

Bitmask stores a bit-packed list of boolean values.

func NewBitmask

func NewBitmask() *Bitmask

func ReadBitmask

func ReadBitmask(descriptor *Descriptor, reader io.Reader) (*Bitmask, error)

func (Bitmask) Clear

func (b Bitmask) Clear()

func (Bitmask) Copy

func (b Bitmask) Copy() Bitmask

func (*Bitmask) Enabled

func (b *Bitmask) Enabled(offset uint32) bool

func (Bitmask) Len

func (mask Bitmask) Len() int

func (*Bitmask) Set

func (b *Bitmask) Set(offset uint32, value bool)

func (Bitmask) String

func (b Bitmask) String() string

type BlockData

type BlockData interface {
	Type() BlockType
	WriteData(*Encoder, VisibilityFlags, bool) error
}

type BlockType

type BlockType int
const (
	Values BlockType = iota
	Movement
	CreateObject
	SpawnObject
	DeleteFarObjects
	DeleteNearObjects
)

func (BlockType) String

func (i BlockType) String() string

type BlockTypeDescriptor

type BlockTypeDescriptor map[BlockType]uint8

type BytePad

type BytePad struct{}

BytePad will move the bit offset 1 byte (8 bits) forward, or to the next byte. In other words, it will re-align your bit stream to the next offset divisible by 8.

type ChunkPad

type ChunkPad struct{}

ChunkPad will move the chunk offset 1 forward. If the decoder detects an enabled value at a ChunkPad's offset, it will return an error.

type CreateBlock

type CreateBlock struct {
	BlockType     BlockType
	ObjectType    guid.TypeID
	MovementBlock *MovementBlock
	ValuesBlock   *ValuesBlock
}

CreateBlock is sent when the server notifies the client of a new game object. (Player, Unit, Item, etc.) It contains with it a MovementBlock and a ValuesBlock, which are later updated as individual blocks.

func (*CreateBlock) Type

func (cb *CreateBlock) Type() BlockType

func (*CreateBlock) WriteData

func (cb *CreateBlock) WriteData(e *Encoder, mask VisibilityFlags, create bool) error

type Decoder

type Decoder struct {
	*Descriptor
	Build                  vsn.Build
	HasTransport           bool
	Map                    uint16
	SmoothDeleteStartIndex uint16
	BlockCount             uint32
	CurrentBlockIndex      uint32
	CurrentBlockType       BlockType
	Reader                 io.Reader
}

Decoder decodes an SMSG_UPDATE_OBJECT input stream into various sub-structures.

func NewDecoder

func NewDecoder(version vsn.Build, reader io.Reader) (*Decoder, error)

Start chewing up blocks.

func (*Decoder) DecodeBlockType

func (decoder *Decoder) DecodeBlockType() (BlockType, error)

DecodeBlockType decodes the BlockType. This function tries to resolve differences between protocol revisions.

func (*Decoder) DecodeCreateBlock

func (decoder *Decoder) DecodeCreateBlock() (*CreateBlock, error)

func (*Decoder) DecodeDeleteObjectsBlock

func (dec *Decoder) DecodeDeleteObjectsBlock() (*DeleteObjectsBlock, error)

func (*Decoder) DecodeGUID

func (decoder *Decoder) DecodeGUID() (guid.GUID, error)

func (*Decoder) DecodeMovementBlock

func (decoder *Decoder) DecodeMovementBlock() (*MovementBlock, error)

only supports 5875 so far

func (*Decoder) DecodeValuesBlockData

func (decoder *Decoder) DecodeValuesBlockData(valuesBlock *ValuesBlock) error

func (*Decoder) IsCreateBlock

func (decoder *Decoder) IsCreateBlock() bool

func (*Decoder) MoreBlocks

func (decoder *Decoder) MoreBlocks() bool

if true, more blocks lie ahead for us to eat

func (*Decoder) NextBlock

func (decoder *Decoder) NextBlock() (BlockType, error)

What is this next block tagged as? It tells us which data to decode after this

type DeleteObjectsBlock

type DeleteObjectsBlock struct {
	BlockType BlockType
	GUIDs     []guid.GUID
}

func (*DeleteObjectsBlock) Type

func (f *DeleteObjectsBlock) Type() BlockType

func (*DeleteObjectsBlock) WriteAll

func (f *DeleteObjectsBlock) WriteAll(e *Encoder) error

type Descriptor

type Descriptor struct {
	DescriptorOptions
	ObjectDescriptors map[guid.TypeMask]reflect.Type
}

Descriptor describes all the info about a particular version's SMSG_UPDATE_OBJECT structure. Descriptor's underlying Types are backed by a Go structure However,

func GetDescriptor

func GetDescriptor(build vsn.Build) *Descriptor

type DescriptorOptions

type DescriptorOptions uint32

type Destroy

type Destroy struct {
	Object guid.GUID
}

func (*Destroy) Decode

func (d *Destroy) Decode(build vsn.Build, in *packet.WorldPacket) (err error)

func (*Destroy) Encode

func (d *Destroy) Encode(build vsn.Build, out *packet.WorldPacket) error

type Encoder

type Encoder struct {
	io.Writer
	Build      vsn.Build
	Descriptor *Descriptor
	// contains filtered or unexported fields
}

func NewEncoder

func NewEncoder(version vsn.Build, writer io.Writer, numBlocks int) (*Encoder, error)

func (*Encoder) AddBlock

func (enc *Encoder) AddBlock(id guid.GUID, data BlockData, viewMask VisibilityFlags) error

func (*Encoder) EncodeBlockType

func (enc *Encoder) EncodeBlockType(bt BlockType) error

func (*Encoder) EncodeGUID

func (enc *Encoder) EncodeGUID(id guid.GUID) error

type FieldRef

type FieldRef struct {
	ChunkOffset uint32
	reflect.Value
}

type FieldTag

type FieldTag string

func (FieldTag) IsParty

func (ft FieldTag) IsParty() bool

func (FieldTag) IsPrivate

func (ft FieldTag) IsPrivate() bool

type FlyState

type FlyState struct {
	GUID guid.GUID
	On   bool
}

func (*FlyState) Decode

func (f *FlyState) Decode(build vsn.Build, in *packet.WorldPacket) error

func (*FlyState) Encode

func (f *FlyState) Encode(build vsn.Build, out *packet.WorldPacket) error

type ForceSpeedChange

type ForceSpeedChange struct {
	Type     SpeedType
	ID       guid.GUID
	Counter  uint32
	NewSpeed float32
}

func (*ForceSpeedChange) Encode

func (fs *ForceSpeedChange) Encode(build vsn.Build, out *packet.WorldPacket) (err error)

type ItemFlag

type ItemFlag uint32
const (
	ItemFlagNoPickup ItemFlag = iota
	ItemFlagConjured
	ItemFlagHasLoot
	ItemFlagHeroicTooltip
	ItemFlagDeprecated
	ItemFlagNoUserDestroy
	ItemFlagPlayerCast
	ItemFlagNoEquipCooldown
	ItemFlagMultiLootQuest
	ItemFlagIsWrapper
	ItemFlagUsesResources
	ItemFlagMultiDrop
	ItemFlagItemPurchaseRecord
	ItemFlagPetition
	ItemFlagHasText
	ItemFlagNoDisenchant
	ItemFlagRealDuration
	ItemFlagNoCreator
	ItemFlagIsProspectable
	ItemFlagUniqueEquippable
	ItemFlagIgnoreForAuras
	ItemFlagIgnoreDefaultArenaRestrictions
	ItemFlagNoDurabilityLoss
	ItemFlagUseWhenShapeshifted
	ItemFlagHasQuestGlow
	ItemFlagHideUnusableRecipe
	ItemFlagNotUseableInArena
	ItemFlagBindsToAccount
	ItemFlagNoReagentCost
	ItemFlagIsMillable
	ItemFlagReportToGuildChat
	ItemFlagNoProgressiveLoot
	ItemFlagFactionHorde
	ItemFlagFactionAlliance
	ItemFlagDontIgnoreBuyPrice
	ItemFlagClassifyAsCaster
	ItemFlagClassifyAsPhysical
	ItemFlagEveryoneCanRollNeed
	ItemFlagNoTradeBindOnAcquire
	ItemFlagCanTradeBindOnAcquire
	ItemFlagCanOnlyRollGreed
	ItemFlagCasterWeapon
	ItemFlagDeleteOnLogin
	ItemFlagInternalItem
	ItemFlagNoVendorValue
	ItemFlagShowBeforeDiscovered
	ItemFlagOverrideGoldCost
	ItemFlagIgnoreDefaultRatedBgRestrictions
	ItemFlagNotUsableInRatedBg
	ItemFlagBnetAccountTradeOk
	ItemFlagConfirmBeforeUse
	ItemFlagReevaluateBondingOnTransform
	ItemFlagNoTransformOnChargeDepletion
	ItemFlagNoAlterItemVisual
	ItemFlagNoSourceForItemVisual
	ItemFlagIgnoreQualityForItemVisualSource
	ItemFlagNoDurability
	ItemFlagRoleTank
	ItemFlagRoleHealer
	ItemFlagRoleDamage
	ItemFlagCanDropInChallengeMode
	ItemFlagNeverStackInLootUi
	ItemFlagDisenchantToLootTable
	ItemFlagUsedInATradeskill
	ItemFlagDontDestroyOnQuestAccept
	ItemFlagItemCanBeUpgraded
	ItemFlagUpgradeFromItemOverridesDropUpgrade
	ItemFlagAlwaysFfaInLoot
	ItemFlagHideUpgradeLevelsIfNotUpgraded
	ItemFlagUpdateInteractions
	ItemFlagUpdateDoesntLeaveProgressiveWinHistory
	ItemFlagIgnoreItemHistoryTracker
	ItemFlagIgnoreItemLevelCapInPvp
	ItemFlagDisplayAsHeirloom
	ItemFlagSkipUseCheckOnPickup
	ItemFlagObsolete
	ItemFlagDontDisplayInGuildNews
	ItemFlagPvpTournamentGear
	ItemFlagRequiresStackChangeLog
	ItemFlagUnusedFlag
	ItemFlagHideNameSuffix
	ItemFlagPushLoot
	ItemFlagDontReportLootLogToParty
	ItemFlagAlwaysAllowDualWield
	ItemFlagObliteratable
	ItemFlagActsAsTransmogHiddenVisualOption
	ItemFlagExpireOnWeeklyReset
	ItemFlagDoesntShowUpInTransmogUntilCollected
	ItemFlagCanStoreEnchants
	ItemFlagHideQuestItemFromObjectTooltip
	ItemFlagDoNotToast
	ItemFlagIgnoreCreationContextForProgressiveWinHistory
	ItemFlagForceAllSpecsForItemHistory
	ItemFlagSaveOnConsume
	ItemFlagContainerSavesPlayerData
	ItemFlagNoVoidStorage
	ItemFlagHandleOnUseEffectImmediately
	ItemFlagAlwaysShowItemLevelInTooltip
	ItemFlagShowsGenerationWithRandomStats
	ItemFlagActivateOnEquipEffectsWhenTransmogrified
	ItemFlagEnforceTransmogWithChildItem
	ItemFlagScrapable
	ItemFlagBypassRepRequirementsForTransmog
	ItemFlagDisplayOnlyOnDefinedRaces
	ItemFlagRegulatedCommodity
	ItemFlagCreateLootImmediately
	ItemFlagGenerateLootSpecItem
	ItemFlagEnd
)

func (ItemFlag) String

func (x ItemFlag) String() string

type ItemFlags

type ItemFlags struct {
	Bitmask Bitmask
}

func DecodeItemFlags

func DecodeItemFlags(build vsn.Build, in io.Reader) (ItemFlags, error)

func (*ItemFlags) DecodeWord

func (it *ItemFlags) DecodeWord(str string) error

func (*ItemFlags) Encode

func (iflg *ItemFlags) Encode(build vsn.Build, out io.Writer) error

func (*ItemFlags) EncodeWord

func (it *ItemFlags) EncodeWord() (string, error)

func (ItemFlags) HasFlag

func (it ItemFlags) HasFlag(flag ItemFlag) bool

type MoveFlagDescriptor

type MoveFlagDescriptor map[MoveFlags]uint64

type MoveFlags

type MoveFlags uint64
const (
	MoveFlagForward MoveFlags = 1 << iota
	MoveFlagBackward
	MoveFlagStrafeLeft
	MoveFlagStrafeRight
	MoveFlagTurnLeft
	MoveFlagTurnRight
	MoveFlagPitchUp
	MoveFlagPitchDown
	MoveFlagWalkMode
	MoveFlagLevitating
	MoveFlagFlying
	MoveFlagFalling
	MoveFlagFallingFar
	MoveFlagSwimming
	MoveFlagSplineEnabled
	MoveFlagCanFly
	MoveFlagFlyingOld
	MoveFlagOnTransport
	MoveFlagSplineElevation
	MoveFlagRoot
	MoveFlagWaterwalking
	MoveFlagSafeFall
	MoveFlagHover
	// Alpha
	MoveFlagTimeValid
	MoveFlagImmobilized
	MoveFlagDontCollide
	MoveFlagRedirected
	MoveFlagPendingStop
	MoveFlagPendingUnstrafe
	MoveFlagPendingFall
	MoveFlagPendingForward
	MoveFlagPendingBackward
	MoveFlagPendingStrLeft
	MoveFlagPendingStrRight
	MoveFlagMoved
	MoveFlagSliding
	// TBC
	MoveFlagAscending
	// WOTLK
	MoveFlagNoStrafe
	MoveFlagFullSpeedTurning
	MoveFlagFullSpeedPitching
	MoveFlagAllowPitching
	MoveFlagInterpolateMovement
	MoveFlagInterpolateTurning
	MoveFlagInterpolatePitching
)

func (MoveFlags) String

func (mf MoveFlags) String() string

type MoveSpline

type MoveSpline struct {
	Flags                SplineFlags
	Facing               tempest.C3Vector
	FacingTarget         guid.GUID
	FacingAngle          float32
	TimePassed           int32
	Duration             int32
	ID                   uint32
	DurationMod          float32
	DurationModNext      float32
	VerticalAcceleration float32
	EffectStartTime      int32
	Spline               []tempest.C3Vector
	SplineMode           uint8
	Endpoint             tempest.C3Vector
}

func DecodeMoveSpline

func DecodeMoveSpline(version vsn.Build, in io.Reader) (*MoveSpline, error)

type MovementBlock

type MovementBlock struct {
	ID              guid.GUID
	UpdateFlags     UpdateFlags
	Info            *MovementInfo
	Speeds          Speeds
	Spline          *MoveSpline
	Position        tempest.C4Vector
	All             uint32
	LowGUID         uint32
	HighGUID        uint32
	Victim          guid.GUID
	WorldTime       uint32
	VehicleID       uint32
	VehicleRotation float32
	Rotation        tempest.C4Quaternion
	Player          bool
}

func (*MovementBlock) Type

func (mBlock *MovementBlock) Type() BlockType

func (*MovementBlock) WriteData

func (mb *MovementBlock) WriteData(e *Encoder, mask VisibilityFlags, create bool) error

type MovementInfo

type MovementInfo struct {
	Flags    MoveFlags
	Time     uint32
	Position tempest.C4Vector

	TransportGUID            guid.GUID
	TransportPosition        tempest.C4Vector
	TransportTime            uint32
	TransportSeat            int8
	TransportInterpolateTime uint32

	Pitch        float32
	FallTime     uint32
	FallVelocity float32
	FallSin      float32
	FallCos      float32
	FallXYSpeed  float32

	SplineElevation float32
}

func DecodeMovementInfo

func DecodeMovementInfo(version vsn.Build, in io.Reader) (*MovementInfo, error)

type MovementPacket

type MovementPacket struct {
	Type   packet.WorldType
	Server bool
	GUID   guid.GUID
	Info   *MovementInfo
}

func (*MovementPacket) Decode

func (mp *MovementPacket) Decode(build vsn.Build, in *packet.WorldPacket) error

func (*MovementPacket) Encode

func (mp *MovementPacket) Encode(build vsn.Build, out *packet.WorldPacket) error

type SetActiveMover

type SetActiveMover struct {
	ID guid.GUID
}

func (*SetActiveMover) Decode

func (sam *SetActiveMover) Decode(build vsn.Build, in *packet.WorldPacket) (err error)

func (*SetActiveMover) Encode

func (sam *SetActiveMover) Encode(build vsn.Build, out *packet.WorldPacket) (err error)

type SetSheathe

type SetSheathe struct {
	Mode uint32
}

func (*SetSheathe) Decode

func (swm *SetSheathe) Decode(build vsn.Build, in *packet.WorldPacket) error

func (*SetSheathe) Encode

func (swm *SetSheathe) Encode(build vsn.Build, out *packet.WorldPacket) error

type SetStandState

type SetStandState struct {
	State StandState
}

func (*SetStandState) Decode

func (sss *SetStandState) Decode(build vsn.Build, in *packet.WorldPacket) (err error)

func (*SetStandState) Encode

func (sss *SetStandState) Encode(build vsn.Build, out *packet.WorldPacket) (err error)

type SetWeaponMode

type SetWeaponMode struct {
	Mode uint32
}

func (*SetWeaponMode) Decode

func (swm *SetWeaponMode) Decode(build vsn.Build, in *packet.WorldPacket) error

func (*SetWeaponMode) Encode

func (swm *SetWeaponMode) Encode(build vsn.Build, out *packet.WorldPacket) error

type SpeedList

type SpeedList []SpeedType

func GetSpeedList

func GetSpeedList(v vsn.Build) SpeedList

type SpeedOpcodePair

type SpeedOpcodePair struct {
	Force  packet.WorldType
	Spline packet.WorldType
}

type SpeedType

type SpeedType uint8
const (
	Walk SpeedType = iota
	Run
	RunBackward
	Swim
	SwimBackward
	Flight
	FlightBackward
	Turn
	Pitch
)

func (SpeedType) String

func (i SpeedType) String() string

type Speeds

type Speeds map[SpeedType]float32

type SplineFlagDescriptor

type SplineFlagDescriptor map[SplineFlags]uint32

type SplineFlags

type SplineFlags uint32
const (
	SplineNone SplineFlags = 1 << iota
	// x00-xFF(first byte) used as animation Ids storage in pair with Animation flag
	SplineDone
	SplineFalling // Affects elevation computation, can't be combined with Parabolic flag
	SplineNoSpline
	SplineParabolic // Affects elevation computation, can't be combined with Falling flag
	SplineCanSwim
	SplineFlying           // Smooth movement(Catmullrom interpolation mode), flying animation
	SplineOrientationFixed // Model ori    = 0x00008000,
	SplineFinalTarget
	SplineFinalPoint
	SplineFinalAngle
	SplineCatmullrom // Used Catmullrom interpolation mode
	SplineCyclic     // Movement by cycled spline
	SplineEnterCycle // Everytimes appears with cyclic flag in monster move packet, erases first spline vertex after first cycle done
	SplineAnimation  // Plays animation after some time passed
	SplineFrozen     // Will never arrive
	SplineTransportEnter
	SplineTransportExit
	SplineBackward
	SplineWalkmode
	SplineBoardVehicle
	SplineExitVehicle
	SplineOrientationInverted
)

type SplineSpeedChange

type SplineSpeedChange struct {
	Type     SpeedType
	ID       guid.GUID
	NewSpeed float32
}

func (*SplineSpeedChange) Encode

func (ss *SplineSpeedChange) Encode(build vsn.Build, out *packet.WorldPacket) (err error)

type StandState

type StandState uint8
const (
	StateStand StandState = iota
	StateSit
	StateSitChair
	StateSleep
	StateSitLowChair
	StateSitMediumChair
	StateSitHighChair
	StateDead
	StateKneel
	StateCustom
)

type Target

type Target struct {
	ID guid.GUID
}

func (*Target) Decode

func (t *Target) Decode(build vsn.Build, in *packet.WorldPacket) (err error)

func (*Target) Encode

func (t *Target) Encode(build vsn.Build, out *packet.WorldPacket) (err error)

type UpdateFlagDescriptor

type UpdateFlagDescriptor map[UpdateFlags]uint32

map serverside storage codes to per-version client codes

type UpdateFlags

type UpdateFlags uint32
const (
	UpdateFlagNone UpdateFlags = 1 << iota
	UpdateFlagSelf
	UpdateFlagTransport
	UpdateFlagHasAttackingTarget
	UpdateFlagLowGUID
	UpdateFlagHighGUID
	UpdateFlagAll
	UpdateFlagLiving
	UpdateFlagHasPosition
	UpdateFlagVehicle
	UpdateFlagPosition
	UpdateFlagRotation
)

func (UpdateFlags) String

func (uf UpdateFlags) String() string

type Value

type Value struct {
	Block            *ValuesBlock
	Bitmask          *Bitmask
	ChangeMaskOffset uint32
	Value            reflect.Value
}

func (*Value) Byte

func (v *Value) Byte() uint8

func (*Value) Field

func (v *Value) Field(name string) *Value

func (*Value) FieldIndex

func (v *Value) FieldIndex(n int) *Value

Take a value with an already computed base changemask offset, building until the index is reached

func (*Value) FieldNames

func (v *Value) FieldNames() []string

Returns a list of fields contained within a Struct value.

func (*Value) Find

func (v *Value) Find(field string) *Value

Returns any substructure with a reflect Name == field

func (*Value) GUID

func (v *Value) GUID() guid.GUID

func (*Value) Index

func (v *Value) Index(index int) *Value

func (*Value) Int32

func (v *Value) Int32() int32

func (*Value) Len

func (v *Value) Len() int

func (*Value) SetBit

func (v *Value) SetBit(value bool)

func (*Value) SetByte

func (v *Value) SetByte(value uint8)

func (*Value) SetFloat32

func (v *Value) SetFloat32(value float32)

func (*Value) SetGUID

func (v *Value) SetGUID(value guid.GUID)

func (*Value) SetInt16

func (v *Value) SetInt16(value int16)

func (*Value) SetInt32

func (v *Value) SetInt32(value int32)

func (*Value) SetUint16

func (v *Value) SetUint16(value uint16)

func (*Value) SetUint32

func (v *Value) SetUint32(value uint32)

func (*Value) Uint32

func (v *Value) Uint32() uint32

type ValuesBlock

type ValuesBlock struct {
	sync.Mutex

	TypeMask guid.TypeMask
	// Descriptor describes the exact structure of a particular version's SMSG_UPDATE_OBJECT.
	Descriptor *Descriptor
	// Points to chunks that have been updated
	ChangeMask *Bitmask
	// StorageDescriptor is the version and type-specific structure. Descriptors can be found in packages labelled d<build number>
	// Write your own descriptors to support a lesser known version if there is a change in SMSG_UPDATE_OBJECT
	StorageDescriptor reflect.Value
}

ValuesBlock acts a wrapper container for reflection-based update field storage and serialization

func NewValuesBlock

func NewValuesBlock(build vsn.Build, mask guid.TypeMask) (*ValuesBlock, error)

func (*ValuesBlock) ClearChanges

func (vb *ValuesBlock) ClearChanges()

func (*ValuesBlock) ClearChangesAndUnlock

func (vb *ValuesBlock) ClearChangesAndUnlock()

func (*ValuesBlock) Copy

func (v *ValuesBlock) Copy() *ValuesBlock

ValuesBlock data is copied into a new region of memory where it can be changed without ruining the original, at the cost of GC

func (*ValuesBlock) Get

func (vb *ValuesBlock) Get(name string) *Value

func (*ValuesBlock) SetBit

func (vb *ValuesBlock) SetBit(glob string, value bool)

func (*ValuesBlock) SetByte

func (vb *ValuesBlock) SetByte(glob string, value uint8)

func (*ValuesBlock) SetFloat32

func (vb *ValuesBlock) SetFloat32(glob string, value float32)

func (*ValuesBlock) SetGUID

func (vb *ValuesBlock) SetGUID(glob string, value guid.GUID)

func (*ValuesBlock) SetInt32

func (vb *ValuesBlock) SetInt32(glob string, value int32)

func (*ValuesBlock) SetUint32

func (vb *ValuesBlock) SetUint32(glob string, nvalue uint32)

func (*ValuesBlock) Type

func (vb *ValuesBlock) Type() BlockType

func (*ValuesBlock) Value

func (vb *ValuesBlock) Value() *Value

func (*ValuesBlock) WriteData

func (valuesBlock *ValuesBlock) WriteData(e *Encoder, viewMask VisibilityFlags, create bool) error

type ValuesDecoder

type ValuesDecoder struct {
	Decoder          *Decoder
	CurrentBitmask   *Bitmask
	CurrentChunk     [4]byte
	ChunkPos, BitPos uint32
}

func (*ValuesDecoder) BytePos

func (valdec *ValuesDecoder) BytePos() int

func (*ValuesDecoder) Decode

func (valdec *ValuesDecoder) Decode(field reflect.Value, name string) error

func (*ValuesDecoder) FillCurrentChunk

func (valdec *ValuesDecoder) FillCurrentChunk()

func (*ValuesDecoder) Fwd

func (valdec *ValuesDecoder) Fwd(n uint32)

Fwd the decoder's chunk offset forward by n chunks

func (*ValuesDecoder) FwdBits

func (valdec *ValuesDecoder) FwdBits(n uint32)

FwdBits move the decoder's bit offset by n bits

func (*ValuesDecoder) FwdBytes

func (valdec *ValuesDecoder) FwdBytes(n uint32)

FwdBits move the decoder's byte offset by n bytes

func (*ValuesDecoder) ReadBit

func (valdec *ValuesDecoder) ReadBit(to reflect.Value) error

func (*ValuesDecoder) ReadByte

func (valdec *ValuesDecoder) ReadByte(to reflect.Value) error

func (*ValuesDecoder) ReadFloat32

func (valdec *ValuesDecoder) ReadFloat32(to reflect.Value) error

func (*ValuesDecoder) ReadGUID

func (valdec *ValuesDecoder) ReadGUID(to reflect.Value) error

func (*ValuesDecoder) ReadInt32

func (valdec *ValuesDecoder) ReadInt32(to reflect.Value) error

func (*ValuesDecoder) ReadUint16

func (valdec *ValuesDecoder) ReadUint16(to reflect.Value) error

func (*ValuesDecoder) ReadUint32

func (valdec *ValuesDecoder) ReadUint32(to reflect.Value) error

func (*ValuesDecoder) ReadUint64

func (valdec *ValuesDecoder) ReadUint64(to reflect.Value) error

type ValuesEncoder

type ValuesEncoder struct {
	Encoder        *Encoder
	ViewMask       VisibilityFlags
	Create         bool
	ValuesBlock    *ValuesBlock
	CurrentBitmask *Bitmask
	ChunkPos       uint32
	BitPos         uint32
	NextChunk      [4]byte
	// WritePos: the current chunk position being recorded to the stream.
	WritePos uint32
}

func (*ValuesEncoder) ChunkCount

func (ve *ValuesEncoder) ChunkCount(mask *Bitmask) int

func (*ValuesEncoder) EncodeValue

func (valenc *ValuesEncoder) EncodeValue(value reflect.Value, name string, tag FieldTag) error

func (*ValuesEncoder) SetCreateBits

func (valenc *ValuesEncoder) SetCreateBits() error

func (*ValuesEncoder) Write

func (v *ValuesEncoder) Write(b []byte) (int, error)

type VisibilityFlags

type VisibilityFlags uint32
const (
	None        VisibilityFlags = 0
	Owner       VisibilityFlags = 0x01
	PartyMember VisibilityFlags = 0x02
	UnitAll     VisibilityFlags = 0x04
	Empath      VisibilityFlags = 0x08
)

Directories

Path Synopsis
Descriptor module for version 12340 3.3.5a (WotLK)
Descriptor module for version 12340 3.3.5a (WotLK)
Descriptor module for version 3368 (Alpha)
Descriptor module for version 3368 (Alpha)
Descriptor module for protocol 5875 1.12.1 (Vanilla)
Descriptor module for protocol 5875 1.12.1 (Vanilla)
Descriptor module for version 8606 2.4.3 (TBC)
Descriptor module for version 8606 2.4.3 (TBC)
This package imports all the official object update descriptors.
This package imports all the official object update descriptors.

Jump to

Keyboard shortcuts

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