Implemented ObjectGuid support for AzerothCore.

This commit is contained in:
UltraNix
2021-04-21 19:55:37 +02:00
parent ca5f1bb59d
commit c4383324fb
19 changed files with 206 additions and 181 deletions

View File

@@ -602,7 +602,7 @@ namespace LuaUnit
/**
* Returns the [Unit]'s owner's GUID.
*
* @return uint64 ownerGUID
* @return ObjectGuid ownerGUID
*/
int GetOwnerGUID(lua_State* L, Unit* unit)
{
@@ -628,7 +628,7 @@ namespace LuaUnit
/**
* Returns the [Unit]'s creator's GUID.
*
* @return uint64 creatorGUID
* @return ObjectGuid creatorGUID
*/
int GetCreatorGUID(lua_State* L, Unit* unit)
{
@@ -643,7 +643,7 @@ namespace LuaUnit
/**
* Returns the [Unit]'s charmer's GUID.
*
* @return uint64 charmerGUID
* @return ObjectGuid charmerGUID
*/
int GetCharmerGUID(lua_State* L, Unit* unit)
{
@@ -658,7 +658,7 @@ namespace LuaUnit
/**
* Returns the GUID of the [Unit]'s charmed entity.
*
* @return uint64 charmedGUID
* @return ObjectGuid charmedGUID
*/
int GetCharmGUID(lua_State* L, Unit* unit)
{
@@ -675,7 +675,7 @@ namespace LuaUnit
/**
* Returns the GUID of the [Unit]'s pet.
*
* @return uint64 petGUID
* @return ObjectGuid petGUID
*/
int GetPetGUID(lua_State* L, Unit* unit)
{
@@ -690,7 +690,7 @@ namespace LuaUnit
/**
* Returns the GUID of the [Unit]'s charmer or owner.
*
* @return uint64 controllerGUID
* @return ObjectGuid controllerGUID
*/
int GetControllerGUID(lua_State* L, Unit* unit)
{
@@ -705,7 +705,7 @@ namespace LuaUnit
/**
* Returns the GUID of the [Unit]'s charmer or owner or its own GUID.
*
* @return uint64 controllerGUID
* @return ObjectGuid controllerGUID
*/
int GetControllerGUIDS(lua_State* L, Unit* unit)
{
@@ -1355,7 +1355,7 @@ namespace LuaUnit
/**
* Returns the Critter Guid
*
* @return uint64 critterGuid
* @return ObjectGuid critterGuid
*/
int GetCritterGUID(lua_State* L, Unit* unit)
{
@@ -1444,16 +1444,16 @@ namespace LuaUnit
/**
* Sets the [Unit]'s owner GUID to given GUID.
*
* @param uint64 guid : new owner guid
* @param ObjectGuid guid : new owner guid
*/
int SetOwnerGUID(lua_State* L, Unit* unit)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
ObjectGuid guid = Eluna::CHECKVAL<ObjectGuid>(L, 2);
#if defined TRINITY || AZEROTHCORE
unit->SetOwnerGUID(ObjectGuid(guid));
unit->SetOwnerGUID(guid);
#else
unit->SetOwnerGuid(ObjectGuid(guid));
unit->SetOwnerGuid(guid);
#endif
return 0;
}
@@ -1785,15 +1785,15 @@ namespace LuaUnit
/**
* Sets creator GUID
*
* @param uint64 guid
* @param ObjectGuid guid
*/
int SetCreatorGUID(lua_State* L, Unit* unit)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
ObjectGuid guid = Eluna::CHECKVAL<ObjectGuid>(L, 2);
#if defined TRINITY || AZEROTHCORE
unit->SetCreatorGUID(ObjectGuid(guid));
unit->SetCreatorGUID(guid);
#else
unit->SetCreatorGuid(ObjectGuid(guid));
unit->SetCreatorGuid(guid);
#endif
return 0;
}
@@ -1801,15 +1801,15 @@ namespace LuaUnit
/**
* Sets pet GUID
*
* @param uint64 guid
* @param ObjectGuid guid
*/
int SetPetGUID(lua_State* L, Unit* unit)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
ObjectGuid guid = Eluna::CHECKVAL<ObjectGuid>(L, 2);
#if defined TRINITY || AZEROTHCORE
unit->SetPetGUID(ObjectGuid(guid));
unit->SetPetGUID(guid);
#else
unit->SetPetGuid(ObjectGuid(guid));
unit->SetPetGuid(guid);
#endif
return 0;
}
@@ -1907,11 +1907,11 @@ namespace LuaUnit
int SetCritterGUID(lua_State* L, Unit* unit)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
ObjectGuid guid = Eluna::CHECKVAL<ObjectGuid>(L, 2);
#if defined TRINITY || AZEROTHCORE
unit->SetCritterGUID(ObjectGuid(guid));
unit->SetCritterGUID(guid);
#else
unit->SetCritterGuid(ObjectGuid(guid));
unit->SetCritterGuid(guid);
#endif
return 0;
}
@@ -2444,7 +2444,7 @@ namespace LuaUnit
* @param int32 bp1 = nil : custom basepoints for [Spell] effect 2. If nil, no change is made
* @param int32 bp2 = nil : custom basepoints for [Spell] effect 3. If nil, no change is made
* @param [Item] castItem = nil
* @param uint64 originalCaster = 0
* @param ObjectGuid originalCaster = ObjectGuid()
*/
int CastCustomSpell(lua_State* L, Unit* unit)
{
@@ -2458,7 +2458,7 @@ namespace LuaUnit
bool has_bp2 = !lua_isnoneornil(L, 7);
int32 bp2 = Eluna::CHECKVAL<int32>(L, 7, 0);
Item* castItem = Eluna::CHECKOBJ<Item>(L, 8, false);
uint64 originalCaster = Eluna::CHECKVAL<uint64>(L, 9, 0);
ObjectGuid originalCaster = Eluna::CHECKVAL<ObjectGuid>(L, 9, ObjectGuid());
#ifdef TRINITY
CastSpellExtraArgs args;
@@ -2473,7 +2473,7 @@ namespace LuaUnit
if (castItem)
args.SetCastItem(castItem);
if (originalCaster)
args.SetOriginalCaster(ObjectGuid(originalCaster));
args.SetOriginalCaster(originalCaster);
unit->CastSpell(target, spell, args);
#else
unit->CastCustomSpell(target, spell, has_bp0 ? &bp0 : NULL, has_bp1 ? &bp1 : NULL, has_bp2 ? &bp2 : NULL, triggered, castItem, NULL, ObjectGuid(originalCaster));