Skip to content

feat(LuaEngine/Packed GUIDs) Add support for writing packed GUIDs and reading packed GUID size #295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 21, 2025

Conversation

mostlynick3
Copy link

This lets users create and manipulate packets that involve packed GUIDs as opposed to full GUIDs directly.

Example implementation, where the client needs to receive a packed GUID:

local function OnCommand_TestPackedGUID(event, player, command)
    if not (command == "testPackedGUID") then return end

    local SMSG_FORCE_MOVE_ROOT = 0x0E8

    local playerGuid = player:GetGUID()
    local packedSize = GetPackedGUIDSize(playerGuid)
    local PACKET_SIZE = math.min(packedSize + 4, 13)  -- Ulong is 4 bytes, packed GUID is up to 9 bytes

    local packet = CreatePacket(SMSG_FORCE_MOVE_ROOT, PACKET_SIZE)
    packet:WritePackedGUID(playerGuid)
    packet:WriteULong(2)

    player:SendPacket(packet)
    player:SendBroadcastMessage("You have been rooted by a packet and your packedGUID!")
    return false
end

RegisterPlayerEvent(42, OnCommand_TestPackedGUID)

@iThorgrim iThorgrim merged commit a63ef3f into azerothcore:master Aug 21, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants