Documentation ¶
Overview ¶
Package guid stores the GUID or (Globally Unique Identifier), a 128-bit data type which can contain a type specifier, a server ID, and a global counter. This package uses the 128-bit format, but allows lossy conversion and semi-compatibility the old 64-bit format.
Index ¶
- Variables
- func DecodePacked64(r io.Reader) uint64
- func EncodeTypeID(version vsn.Build, id TypeID, out io.Writer) error
- type GUID
- func Classic(u64 uint64) GUID
- func DecodePacked(version vsn.Build, reader io.Reader) (GUID, error)
- func DecodePacked128(r io.Reader) GUID
- func DecodeUnpacked(version vsn.Build, reader io.Reader) (GUID, error)
- func FromString(s string) (GUID, error)
- func Global(t HighType, low uint64) GUID
- func MapSpecific(t HighType, realmID uint64, subType uint8, mapID uint16, serverID uint32, ...) GUID
- func New(high, low uint64) GUID
- func RealmSpecific(t HighType, realmID, low uint64) GUID
- func (g GUID) Classic() uint64
- func (g GUID) Cmp(g2 GUID) int
- func (g GUID) Counter() uint64
- func (g GUID) EncodePacked(version vsn.Build, w io.Writer)
- func (g GUID) EncodeUnpacked(version vsn.Build, w io.Writer)
- func (g GUID) HiClassic() uint32
- func (g GUID) HighType() HighType
- func (g GUID) HighTypeBuild(build vsn.Build) uint64
- func (g GUID) IsUnit() bool
- func (g GUID) LoClassic() uint32
- func (g GUID) RealmID() uint32
- func (g GUID) SetRealmID(realmID uint64) GUID
- func (g GUID) String() string
- func (g GUID) Summary() string
- type HighType
- type TypeID
- type TypeIDDescriptor
- type TypeMask
- type TypeMaskDescriptor
Constants ¶
This section is empty.
Variables ¶
var ( // Nil represents the zero value of a GUID. Nil = GUID{0, 0} // Oldest known revision, unchanged until NewFormat OldFormat vsn.Build = 3368 NewFormat vsn.Build = 19027 )
var ( TypeIDDescriptors = map[vsn.Build]TypeIDDescriptor{ vsn.Alpha: { TypeObject: 0, TypeItem: 1, TypeContainer: 2, TypeUnit: 3, TypePlayer: 4, TypeGameObject: 5, TypeDynamicObject: 6, TypeCorpse: 7, }, } )
var ( TypeMaskDescriptors = map[vsn.Build]TypeMaskDescriptor{ vsn.Alpha: { TypeMaskObject: 0x0001, TypeMaskItem: 0x0002, TypeMaskContainer: 0x0004, TypeMaskUnit: 0x0008, TypeMaskPlayer: 0x0010, TypeMaskGameObject: 0x0020, TypeMaskDynamicObject: 0x0040, TypeMaskCorpse: 0x0080, }, } )
Functions ¶
func DecodePacked64 ¶
Types ¶
type GUID ¶
func DecodePacked128 ¶
func FromString ¶
func MapSpecific ¶
func RealmSpecific ¶
func (GUID) EncodePacked ¶
EncodePacked GUIDs are encoded in a couple ways. 64-bit GUIDs can be encoded plainly as an 8-byte field, or in the "packed" format, a very simple compression mechanism. The packed format is a 8-bit mask value, followed by up to 8 bytes. If a bit n is true in the mask, it means that there is a byte that follows it at that position. If bit n is false, there is no byte that follows it and its decoded byte should be zero. Example (3 bytes):
byte(01000010) + byte(31) + byte(36)
Is decoded as (8 bytes):
[8]byte{0, 31, 0, 0, 0, 0, 36, 0}
The 128-bit format uses the exact same packing scheme, just with a 16-bit mask and up to 16 bytes following it.
func (GUID) SetRealmID ¶
type HighType ¶
type HighType uint64
const ( Null HighType = 0 Uniq HighType = 1 Player HighType = 2 Item HighType = 3 WorldTransaction HighType = 4 StaticDoor HighType = 5 //NYI Transport HighType = 6 Conversation HighType = 7 Creature HighType = 8 Vehicle HighType = 9 Pet HighType = 10 GameObject HighType = 11 DynamicObject HighType = 12 AreaTrigger HighType = 13 Corpse HighType = 14 LootObject HighType = 15 SceneObject HighType = 16 Scenario HighType = 17 AIGroup HighType = 18 DynamicDoor HighType = 19 ClientActor HighType = 20 //NYI Vignette HighType = 21 CallForHelp HighType = 22 AIResource HighType = 23 AILock HighType = 24 AILockTicket HighType = 25 ChatChannel HighType = 26 Party HighType = 27 Guild HighType = 28 WowAccount HighType = 29 BNetAccount HighType = 30 GMTask HighType = 31 MobileSession HighType = 32 //NYI RaidGroup HighType = 33 Spell HighType = 34 Mail HighType = 35 WebObj HighType = 36 //NYI LFGObject HighType = 37 //NYI LFGList HighType = 38 //NYI UserRouter HighType = 39 PVPQueueGroup HighType = 40 UserClient HighType = 41 PetBattle HighType = 42 //NYI UniqUserClient HighType = 43 BattlePet HighType = 44 CommerceObj HighType = 45 ClientSession HighType = 46 Cast HighType = 47 ClientConnection HighType = 48 // virtual gophercraft codes for back compatibility Mo_Transport HighType = 60 Instance HighType = 61 Group HighType = 62 )
type TypeIDDescriptor ¶
type TypeMask ¶
type TypeMask uint32
const ( TypeMaskObject TypeMask = 0x0001 TypeMaskItem TypeMask = 0x0002 TypeMaskContainer TypeMask = 0x0004 TypeMaskAzeriteEmpoweredItem TypeMask = 0x0008 TypeMaskAzeriteItem TypeMask = 0x0010 TypeMaskUnit TypeMask = 0x0020 TypeMaskPlayer TypeMask = 0x0040 TypeMaskActivePlayer TypeMask = 0x0080 TypeMaskGameObject TypeMask = 0x0100 TypeMaskDynamicObject TypeMask = 0x0200 TypeMaskCorpse TypeMask = 0x0400 TypeMaskAreaTrigger TypeMask = 0x0800 TypeMaskSceneObject TypeMask = 0x1000 TypeMaskConversation TypeMask = 0x2000 TypeMaskSeer TypeMask = TypeMaskPlayer | TypeMaskUnit | TypeMaskDynamicObject )