feat(LuaEngine/Packed GUIDs) Add support for writing packed GUIDs and reading packed GUID size (#295)
This commit is contained in:
@@ -468,6 +468,20 @@ namespace LuaGlobalFunctions
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the byte size in bytes (2-9) of the ObjectGuid when packed.
|
||||
*
|
||||
* @param ObjectGuid guid : the ObjectGuid to get packed size for
|
||||
* @return number size
|
||||
*/
|
||||
int GetPackedGUIDSize(lua_State* L)
|
||||
{
|
||||
ObjectGuid guid = Eluna::CHECKVAL<ObjectGuid>(L, 1);
|
||||
PackedGuid packedGuid(guid);
|
||||
Eluna::Push(L, static_cast<int>(packedGuid.size()));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the area or zone's name.
|
||||
*
|
||||
|
||||
@@ -212,6 +212,19 @@ namespace LuaPacket
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes an ObjectGuid as packed GUID format to the [WorldPacket].
|
||||
*
|
||||
* @param ObjectGuid value : the ObjectGuid to be packed to the [WorldPacket]
|
||||
*/
|
||||
int WritePackedGUID(lua_State* L, WorldPacket* packet)
|
||||
{
|
||||
ObjectGuid guid = Eluna::CHECKVAL<ObjectGuid>(L, 2);
|
||||
PackedGuid packedGuid(guid);
|
||||
(*packet) << packedGuid;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a string to the [WorldPacket].
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user