datatypes

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddStatusOpcode       = 0x141 // Unchanged for 4.5
	ActionOpcode          = 0x154 // Updated for 4.5
	AoEAction8Opcode      = 0x157 // Updated for 4.5
	AoEAction16Opcode     = 0x158 // Updated for 4.5
	AoEAction24Opcode     = 0x159 // Updated for 4.5
	AoEAction32Opcode     = 0x15A // Updated for 4.5
	CastingOpcode         = 0x17C // Updated for 4.5
	CraftStateOpcode      = 0x1AF // Updated for 4.5
	EquipChangeOpcode     = 0x18B // Updated for 4.5
	GaugeOpcode           = 0x29A // Updated for 4.5
	HateRankingOpcode     = 0x17F // Updated for 4.5
	HateListOpcode        = 0x180 // Updated for 4.5
	InitZoneOpcode        = 0x19A // Updated for 4.5
	MapChangeOpcode       = 0x299 // Updated for 4.5
	MarkerOpcode          = 0x267 // Updated for 4.5
	MountOpcode           = 0x1E8 // Updated for 4.5
	MovementOpcode        = 0x178 // Updated for 4.5
	NotifyOpcode          = 0x142 // Unchanged 4.5
	Notify3Opcode         = 0x143 // Unchanged 4.5
	Notify4Opcode         = 0x144 // Unchanged 4.5
	NPCSpawnOpcode        = 0x176 // Updated for 4.5
	NPCSpawn2Opcode       = 0x177 // Updated for 4.5
	PerformOpcode         = 0x2A5 // Updated for 4.5
	PlayerSpawnOpcode     = 0x175 // Updated for 4.5
	RemoveEntityOpcode    = 0x191 // Unchanged 4.5
	SetPosOpcode          = 0x17A // Updated for 4.5
	UpdateHPMPTPOpcode    = 0x145 // Unchanged 4.5
	UpdateStatusesOpcode  = 0x151 // Updated for 4.5
	WeatherChangeOpcode   = 0x205 // Updated for 4.5
	XWorldPartyListOpcode = 0xA1  // Updated 4.18
)

Opcodes that define the datatypes of incoming (from server) network blocks

View Source
const (
	MyActionOpcode      = 0x138 // Updated for 4.5
	MyMovementOpcode    = 0x13F // Updated for 4.5
	MyMovement2Opcode   = 0x17E // Updated for 4.5
	MyPerformOpcode     = 0x188 // Updated for 4.5
	BeginCraftingOpcode = 0x15D // Updated for 4.5
)

Opcodes that define the datatypes of outgoing (to server) network blocks

Variables

This section is empty.

Functions

func NewBlockData

func NewBlockData(opcode uint16, isOut bool) xivnet.BlockData

NewBlockData is a factory for BlockData that uses the opcode to determine which BlockData to create

func ParseBlock

func ParseBlock(block *xivnet.Block, isOut bool) (*xivnet.Block, error)

ParseBlock takes in raw, unparsed blocks and returns a parsed block if possible. isOut toggles whether we should parse this block as an outgoing block (sent packet) or as an incoming block (recv'd packet)

func UnmarshalBlockBytes

func UnmarshalBlockBytes(data []byte, block xivnet.BlockData) error

UnmarshalBlockBytes converts raw bytes to this block data struct

Types

type Action

type Action struct {
	ActionHeader

	Effects ActionEffects

	U9  uint32
	U10 uint16

	TargetID2   uint32 // Target of effects
	EffectFlags uint32
	U12         uint32
}

Action defines the data array for an ability block

func (Action) IsBlockData

func (Action) IsBlockData()

type ActionEffect

type ActionEffect struct {
	Type        byte
	HitSeverity byte
	P3          byte
	Percentage  byte
	// Total Damage = 65535 * Multiplier * (Flags & 0x40) + Damage
	Multiplier byte
	Flags      byte // (Flags & 0xA0) means attacker receives damage instead
	Damage     uint16
}

ActionEffect defines the data array for an effect that resulted from the action

type ActionEffects

type ActionEffects [8]ActionEffect

ActionEffects defines a block of 8 action effects

type ActionHeader

type ActionHeader struct {
	TargetID          uint32 // Target of actions
	U1                uint32
	ActionIDName      uint32
	GlobalCounter     uint32
	AnimationLockTime float32
	UnkID1            uint32
	HiddenAnimation   uint16
	Direction         uint16 // Quantized direction 0x0000 ~ 0xFFFF, NWSE <=> 0,0x4000,0x8000,0xC000
	ActionID          uint16
	Variation         byte
	EffectDisplayType byte

	U6a         byte
	NumAffected byte
	U6b         uint16
	U7          uint32
	U8          uint16
}

ActionHeader defines the header for an action packet. This is common for single target or multi-target action packets.

type AddStatus

type AddStatus struct {
	U1        uint32
	ActorID   uint32
	U2, U3    byte
	Pad1      uint16
	CurrentHP uint32
	CurrentMP uint16
	CurrentTP uint16
	MaxHP     uint32
	MaxMP     uint16
	Count     byte
	U5        byte
	Entries   [4]AddStatusEntry
	U8        uint32
}

AddStatus defines the data array for an add status effect block This block is used more for updating HP, MP, TP than adding a status effect

func (AddStatus) IsBlockData

func (AddStatus) IsBlockData()

type AddStatusEntry

type AddStatusEntry struct {
	Index    byte // Position of status effect
	U6       byte
	EffectID uint16
	Extra    uint16
	U7       uint16
	Duration float32
	ActorID  uint32
}

AddStatusEntry is an entry of AddStatus

type AoEAction16

type AoEAction16 struct {
	ActionHeader

	EffectsList [16]ActionEffects

	U9  uint32
	U10 uint16

	Targets [16]uint64

	Position PackedPosition
	U11      uint16
	U12      uint32
}

AoEAction16 defines the data array for an AoE action block

func (AoEAction16) IsBlockData

func (AoEAction16) IsBlockData()

type AoEAction24

type AoEAction24 struct {
	ActionHeader

	EffectsList [24]ActionEffects

	U9  uint32
	U10 uint16

	Targets [24]uint64

	Position PackedPosition
	U11      uint16
	U12      uint32
}

AoEAction24 defines the data array for an AoE action block

func (AoEAction24) IsBlockData

func (AoEAction24) IsBlockData()

type AoEAction32

type AoEAction32 struct {
	ActionHeader

	EffectsList [32]ActionEffects

	U9  uint32
	U10 uint16

	Targets [32]uint64

	Position PackedPosition
	U11      uint16
	U12      uint32
}

AoEAction32 defines the data array for an AoE action block

func (AoEAction32) IsBlockData

func (AoEAction32) IsBlockData()

type AoEAction8

type AoEAction8 struct {
	ActionHeader

	EffectsList [8]ActionEffects

	U9  uint32
	U10 uint16

	Targets [8]uint64

	Position PackedPosition
	U11      uint16
	U12      uint32
}

AoEAction8 defines the data array for an AoE action block

func (AoEAction8) IsBlockData

func (AoEAction8) IsBlockData()

type BeginCrafting

type BeginCrafting struct {
	U1, U2, U3  uint32
	Ingredients [9]uint32
	U4          [21]uint32
	Amounts     [9]byte
	U5          [3]byte
	U6          [30]uint32
}

BeginCrafting defines the data array for a begin crafting message

func (BeginCrafting) IsBlockData

func (BeginCrafting) IsBlockData()

type Casting

type Casting struct {
	ActionIDName uint16
	U1           uint16
	ActionID     uint32
	CastTime     float32
	TargetID     uint32
	Direction    float32
	UnkID1       uint32
	Position     PackedPosition
	U3           uint16
}

Casting defines the data array for a casting block

func (Casting) IsBlockData

func (Casting) IsBlockData()

type CraftState

type CraftState struct {
	CharID            uint64
	U1                [9]uint32
	CraftAction       uint32
	U2                uint32
	StepNum           uint32
	TotalProgress     uint32
	ProgressDelta     int32
	TotalQuality      uint32
	QualityDelta      int32
	HQChance          uint32
	Durability        uint32
	DurabilityDelta   int32
	CurrentCondition  uint32
	PreviousCondition uint32
	U6                [17]uint32
}

CraftState defines the data array for an crafting state block

func (CraftState) IsBlockData

func (CraftState) IsBlockData()

type EntityName

type EntityName [32]byte

EntityName is the storage structure for a UTF-8 entity name

func StringToEntityName

func StringToEntityName(s string) EntityName

StringToEntityName converts a string to an entity name data

func (EntityName) MarshalJSON

func (e EntityName) MarshalJSON() ([]byte, error)

MarshalJSON writes the string representation of the entity name to JSON

func (EntityName) String

func (e EntityName) String() string

String returns the string represenation of the entity name data

func (*EntityName) UnmarshalJSON

func (e *EntityName) UnmarshalJSON(data []byte) error

UnmarshalJSON converts the string representation of the entity name to the data structure

type EquipChange

type EquipChange struct {
	WeaponMain WeaponGear
	WeaponSub  WeaponGear
	U1a        byte
	ClassJob   byte
	U1c        byte
	U1d        byte
	Head       Gear
	Body       Gear
	Hand       Gear
	Leg        Gear
	Foot       Gear
	Ear        Gear
	Neck       Gear
	Wrist      Gear
	Ring1      Gear
	Ring2      Gear
	U2         uint32
}

EquipChange defines the data array for a equip change block

func (EquipChange) IsBlockData

func (EquipChange) IsBlockData()

type FCTag

type FCTag [6]byte

FCTag is the storage structure for a UTF-8 FC tag

func StringToFCTag

func StringToFCTag(s string) FCTag

StringToFCTag converts a string to an entity name data

func (FCTag) MarshalJSON

func (e FCTag) MarshalJSON() ([]byte, error)

MarshalJSON writes the string representation of the entity name to JSON

func (FCTag) String

func (e FCTag) String() string

String returns the string represenation of the entity name data

func (*FCTag) UnmarshalJSON

func (e *FCTag) UnmarshalJSON(data []byte) error

UnmarshalJSON converts the string representation of the entity name to the data structure

type Gauge

type Gauge struct {
	ClassJob  byte
	Duration2 uint16 // In millseconds. Indicates duration of gauge 3. (Enochian)
	Duration  uint16 // In milliseconds. Indicates duration of gauge 0.
	Gauge0    int8   // Main gauge. Negative number can mean umbral ice for instance.
	Gauge1    int8   // For example, umbral hearts lives in this gauge
	Gauge2    byte   // Enochian is set via bitfields in this gauge.
	U1        uint32
	U2        uint32
}

Gauge defines the data array for an add status effect block

func (Gauge) IsBlockData

func (Gauge) IsBlockData()

type Gear

type Gear struct {
	ModelID uint16
	Variant uint8
	Dye     uint8
}

Gear defines the data struct for a normal gear

type HateEntry

type HateEntry struct {
	EnemyID uint32 // OwnerID is the entity that has enmity against the Actor
	HatePct byte   // HatePct is how close to aggro aggro this mob (100% is aggro)
	U1      byte   // U1 and U2 are leftovers from reuse of the HateRanking struct
	U2      uint16
}

HateEntry defines the a full hate list entry

type HateList

type HateList struct {
	Count   byte
	U1      byte
	U2      uint16
	Entries [32]HateEntry
	Pad     uint32
}

HateList defines the data array for a hate list

func (HateList) IsBlockData

func (HateList) IsBlockData()

type HateRanking

type HateRanking struct {
	Count   byte
	U1      byte
	U2      uint16
	Entries [32]HateRankingEntry
	Pad     uint32
}

HateRanking defines the data array for the enmity list for the current target

func (HateRanking) IsBlockData

func (HateRanking) IsBlockData()

type HateRankingEntry

type HateRankingEntry struct {
	ActorID uint32 // ActorID is the entity towards which the threat is directed
	Hate    uint32 // Hate is the total amount of enmity accrued by ActorID
}

HateRankingEntry defines a single hate entry for the current target

type InitZone

type InitZone struct {
	U1a             uint16
	TerritoryTypeID uint16
	U1b             uint16
	U2              uint16

	U3, U4             uint32
	WeatherID, Bitmask byte
	U5b                uint16

	U6, U7, U8, U9, U10, U11, U12, U13, U14 uint32

	X, Y, Z float32
	U15     uint32
}

InitZone defines the data array for a map change block

func (InitZone) IsBlockData

func (InitZone) IsBlockData()

type MapChange

type MapChange struct {
	U1              uint32
	TerritoryTypeID uint16
	U2              uint16
	U3, U4          uint32
}

MapChange defines the data array for a map change block

func (MapChange) IsBlockData

func (MapChange) IsBlockData()

type Marker

type Marker struct {
	Type byte
	U1   byte
	U2   uint16
	U3   uint32
	X    float32
	Y    float32
	Z    float32
	U4   uint32
}

Marker defines the data array for a place marker block

func (Marker) IsBlockData

func (Marker) IsBlockData()

type ModelInfo

type ModelInfo struct {
	Race                byte // 2 Elezen, 3 Lalafell, 4 Miqo'te, 5 Roe, 6 Au Ra, else Hyur
	Gender              byte // 0 is male, 1 is female
	BodyType            byte // CHANGE AT OWN RISK
	Height              byte // Scale from 0-100
	Tribe               byte
	Face                byte
	Hairstyle           byte
	HairHighlight       byte // 8th bit toggles highlight
	SkinTone            byte
	OddEyeColor         byte
	HairColor           byte
	HairHighlightColor  byte
	FacialFeatures      byte // Race specific toggles. i.e. 6th bit toggles right limbal ring. 7th bit toggles left limbal ring.
	FacialFeaturesColor byte
	Eyebrows            byte
	EyeColor            byte
	EyeShape            byte
	Nose                byte
	Jaw                 byte
	Mouth               byte // Bitfield toggles light/dark/none lip color
	LipColor            byte
	TailLength          byte // Scale from 1-100
	TailType            byte
	BustSize            byte // Scale from 1-100
	FacePaintType       byte
	FacePaintColor      byte
}

ModelInfo enumerates all of the different options for customizing the character model

type Mount

type Mount struct {
	ID    byte
	Color byte
	U1    byte
	U2    byte
	U3    uint32 // Highly likely to be a Gear
	U4    uint32 // Highly likely to be a Gear
	U5    uint32 // Highly likely to be a Gear
}

Mount defines the data array for a getting on mount block

func (Mount) IsBlockData

func (Mount) IsBlockData()

type MountInfo

type MountInfo struct {
	ID    byte
	Head  byte
	Body  byte
	Feet  byte
	Color byte
}

MountInfo enumerates the fields for mount information

type Movement

type Movement struct {
	Direction uint8 // Quantized direction 0x00~0xFF. NWSE <=> 0,0x40,0x80,0xC0
	U1        uint8
	U2        uint32
	Position  PackedPosition
	U3        uint32
}

Movement defines the data array for a movement block

func (Movement) IsBlockData

func (Movement) IsBlockData()

type MyAction

type MyAction struct {
	Type uint16 // 3 means P1 is target
	U1   uint16
	P1   uint32
	P2   uint32
	P3   uint32
	P4   uint32
	P5   uint32
	P6   uint32
	P7   uint32
}

MyAction defines the data array for a my action block

func (MyAction) IsBlockData

func (MyAction) IsBlockData()

type MyMovement

type MyMovement struct {
	Direction float32 // 0 is South. Range [-pi,pi] <=> Counterclockwise from North
	U1        uint32
	U2        uint32
	X         float32
	Y         float32
	Z         float32
}

MyMovement defines the data array for a my movement block

func (MyMovement) IsBlockData

func (MyMovement) IsBlockData()

type MyMovement2

type MyMovement2 struct {
	Direction float32 // 0 is South. Range [-pi,pi] <=> Counterclockwise from North
	U1        [6]uint32
	X         float32
	Y         float32
	Z         float32
}

MyMovement2 defines the data array for a my movement block

func (MyMovement2) IsBlockData

func (MyMovement2) IsBlockData()

type NPCSpawn

type NPCSpawn struct {
	PlayerSpawn
	U31 uint64
}

NPCSpawn defines the data array for a new entity block Notes: GMRank from PlayerSpawn corresponds to MobAggression in this struct

func (NPCSpawn) IsBlockData

func (NPCSpawn) IsBlockData()

type NPCSpawn2

type NPCSpawn2 struct {
	PlayerSpawn
	U31 [47]uint64
}

NPCSpawn2 defines the data array for a new entity block Notes: GMRank from PlayerSpawn corresponds to MobAggression in this struct This packet type is encountered in the wild when spawning Alliance Raid bosses

func (NPCSpawn2) IsBlockData

func (NPCSpawn2) IsBlockData()

type Notify

type Notify struct {
	Type uint16
	Pad1 uint16
	P1   uint32
	P2   uint32
	P3   uint32
	P4   uint32
	Pad2 uint32
}

Notify defines the data array for a notify block

func (Notify) IsBlockData

func (Notify) IsBlockData()

type Notify3

type Notify3 struct {
	Type uint16
	Pad1 uint16
	P1   uint32
	P2   uint32
	P3   uint32
	P4   uint32
	P5   uint32
	P6   uint32
	Pad2 uint32
}

Notify3 defines the data array for a notify3 block

func (Notify3) IsBlockData

func (Notify3) IsBlockData()

type Notify4

type Notify4 struct {
	Type     uint16
	Pad1     uint16
	P1       uint32
	P2       uint32
	P3       uint32
	P4       uint32
	Pad2     uint32
	TargetID uint32 // 0xE0000000 means deselect target
	U1       uint32
}

Notify4 defines the data array for a notify4 block

func (Notify4) IsBlockData

func (Notify4) IsBlockData()

type PackedCoord

type PackedCoord uint16

PackedCoord represents a 16 bit packed representation of a float32

func (PackedCoord) Float

func (pc PackedCoord) Float() float32

Float returns the floating point representation of the coord

func (PackedCoord) MarshalJSON

func (pc PackedCoord) MarshalJSON() ([]byte, error)

MarshalJSON marhals the packed coordinate as a floating point value

func (*PackedCoord) SetFloat

func (pc *PackedCoord) SetFloat(coord float32)

SetFloat sets the PackedCoord to the uint16 representation of the floating point coord

func (*PackedCoord) UnmarshalJSON

func (pc *PackedCoord) UnmarshalJSON(data []byte) error

UnmarshalJSON marhals the floating point value as a packed coordinate

type PackedPosition

type PackedPosition struct {
	X, Y, Z PackedCoord
}

PackedPosition defines the data array for position

type Perform

type Perform struct {
	Length byte
	Data   [30]byte
	U1     byte
}

Perform defines the struct for a perform block

func (Perform) IsBlockData

func (Perform) IsBlockData()

type PlayerSpawn

type PlayerSpawn struct {
	Title        uint16
	U1b          uint16
	CurrentWorld uint16
	HomeWorld    uint16

	GMRank       byte
	U3c, U4      byte
	OnlineStatus byte

	Pose          byte
	U5a, U5b, U5c byte

	TargetID   uint64
	U6, U7     uint32
	WeaponMain WeaponGear
	WeaponSub  WeaponGear
	CraftSub   WeaponGear

	U14, U15             uint32
	BNPCBase, BNPCName   uint32
	U18, U19, DirectorID uint32
	OwnerID              uint32
	UnkID3               uint32

	MaxHP, CurrentHP uint32
	DisplayFlags     uint32
	FateID           uint16
	CurrentMP        uint16
	CurrentTP        uint16
	MaxMP            uint16

	U21a       uint16
	ModelChara uint16
	Direction  uint16 // Quantized direction 0x0000 ~ 0xFFFF, NWSE <=> 0,0x4000,0x8000,0xC000
	Minion     uint16
	Index      byte
	State      byte // 0-1 for alive, 2 for dead, 3 for persistent emote
	Emote      byte // Applies for when State is 3
	Type       byte // 1 for player, 2 for NPC, else furniture
	Subtype    byte // 4 for players, 2 pet, 3 companion, 5 mob, 7 minion
	Voice      byte
	U25c       uint16

	EnemyType byte // 0 for friendly, anything else is an enemy
	Level     byte
	ClassJob  byte
	U26d      byte
	U27a      uint16

	MountInfo     MountInfo
	StatusLoopVFX byte
	U28c          uint32
	U29           uint32

	Statuses [30]StatusEffect

	X float32
	Y float32
	Z float32

	Head  Gear
	Body  Gear
	Hand  Gear
	Leg   Gear
	Foot  Gear
	Ear   Gear
	Neck  Gear
	Wrist Gear
	Ring1 Gear
	Ring2 Gear

	Name EntityName

	Model ModelInfo

	FCTag FCTag
	U30   uint64
}

PlayerSpawn defines the data array for a new entity block

func (PlayerSpawn) IsBlockData

func (PlayerSpawn) IsBlockData()

type RemoveEntity

type RemoveEntity struct {
	Index byte
	U1    byte
	U2    uint16
	ID    uint32
}

RemoveEntity defines the data array for a remove entity block

func (RemoveEntity) IsBlockData

func (RemoveEntity) IsBlockData()

type SetPos

type SetPos struct {
	Direction   uint16
	WaitForLoad byte
	U1          byte
	U2          uint32
	X           float32
	Y           float32
	Z           float32
	U3          uint32
}

SetPos defines the data array for a movement block

func (SetPos) IsBlockData

func (SetPos) IsBlockData()

type StatusEffect

type StatusEffect struct {
	ID       uint16
	Extra    uint16
	Duration float32
	ActorID  uint32
}

StatusEffect represents the data structure for a status effect

type UpdateHPMPTP

type UpdateHPMPTP struct {
	HP uint32
	MP uint16
	TP uint16
	U1 uint32
	U2 uint32
}

UpdateHPMPTP defines the data array for a updateHPMPTP block

func (UpdateHPMPTP) IsBlockData

func (UpdateHPMPTP) IsBlockData()

type UpdateStatuses

type UpdateStatuses struct {
	U1        uint32
	CurrentHP uint32
	MaxHP     uint32
	CurrentMP uint16
	MaxMP     uint16
	CurrentTP uint16
	U2        uint16 // 0?

	Statuses [30]StatusEffect

	U3 uint32
}

UpdateStatuses defines the data array for an update statuses block

func (UpdateStatuses) IsBlockData

func (UpdateStatuses) IsBlockData()

type WeaponGear

type WeaponGear struct {
	Model1, Model2, Model3, Model4 uint16
}

WeaponGear defines the data struct for a weapon gear

type WeatherChange

type WeatherChange struct {
	ID    byte
	U1    byte
	U2    byte
	U3    byte
	Delay float32
}

WeatherChange defines the data array for a weather change block

func (WeatherChange) IsBlockData

func (WeatherChange) IsBlockData()

type XWorldPartyList

type XWorldPartyList struct {
	PartyLeader uint64
	Entries     [8]XWorldPlayerEntry
}

XWorldPartyList defines the data array for a cross world party list

func (XWorldPartyList) IsBlockData

func (XWorldPartyList) IsBlockData()

type XWorldPlayerEntry

type XWorldPlayerEntry struct {
	PlayerID       uint64
	U1             uint32 // Bitfield, affects the icon in various ways
	U2             uint32
	CharacterID    uint32
	ClientLanguage byte
	U3b            byte
	U3c            uint16
	Level          byte
	U4             byte
	WorldID        uint16
	ClassJob       byte
	U6             byte
	Languages      byte // Bitfield, affects available languages
	GrandCompany   byte
	Name           EntityName
}

XWorldPlayerEntry defines the player entry for a party list

Jump to

Keyboard shortcuts

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