From 02c7a06410639f68c22bc14c4ecc57fd2e334eac Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Sun, 5 Jul 2015 10:03:05 +0300 Subject: [PATCH] Add GetDBTableGuid method --- CreatureMethods.h | 16 ++++++++++++++++ GameObjectMethods.h | 16 ++++++++++++++++ LuaFunctions.cpp | 4 +++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/CreatureMethods.h b/CreatureMethods.h index e94d074..8e57689 100644 --- a/CreatureMethods.h +++ b/CreatureMethods.h @@ -837,6 +837,22 @@ namespace LuaCreature } #endif + /** + * Returns the guid of the [Creature] that is used as the ID in the database + * + * @return uint32 dbguid + */ + int GetDBTableGUIDLow(Eluna* /*E*/, lua_State* L, Creature* creature) + { +#ifdef TRINITY + Eluna::Push(L, creature->GetDBTableGUIDLow()); +#else + // on mangos based this is same as lowguid + Eluna::Push(L, creature->GetGUIDLow()); +#endif + return 1; + } + /* SETTERS */ /** diff --git a/GameObjectMethods.h b/GameObjectMethods.h index 4ced7fe..d57c2d5 100644 --- a/GameObjectMethods.h +++ b/GameObjectMethods.h @@ -146,6 +146,22 @@ namespace LuaGameObject return 1; } + /** + * Returns the guid of the [GameObject] that is used as the ID in the database + * + * @return uint32 dbguid + */ + int GetDBTableGUIDLow(Eluna* /*E*/, lua_State* L, GameObject* go) + { +#ifdef TRINITY + Eluna::Push(L, go->GetDBTableGUIDLow()); +#else + // on mangos based this is same as lowguid + Eluna::Push(L, go->GetGUIDLow()); +#endif + return 1; + } + /** * Sets the state of a [GameObject] * diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index e5f38c4..7567219 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -149,7 +149,7 @@ ElunaRegister ObjectMethods[] = // Getters { "GetEntry", &LuaObject::GetEntry }, // :GetEntry() - Returns the object's entryId { "GetGUID", &LuaObject::GetGUID }, // :GetGUID() - Returns uint64 guid as hex string - { "GetGUIDLow", &LuaObject::GetGUIDLow }, // :GetGUIDLow() - Returns uint32 guid (low guid) that is used in database. + { "GetGUIDLow", &LuaObject::GetGUIDLow }, // :GetGUIDLow() - Returns uint32 guid (low guid) that is used to differentiate objects of same type. { "GetInt32Value", &LuaObject::GetInt32Value }, // :GetInt32Value(index) - returns an int value from object fields { "GetUInt32Value", &LuaObject::GetUInt32Value }, // :GetUInt32Value(index) - returns an uint value from object fields { "GetFloatValue", &LuaObject::GetFloatValue }, // :GetFloatValue(index) - returns a float value from object fields @@ -775,6 +775,7 @@ ElunaRegister CreatureMethods[] = #ifndef CATA { "GetShieldBlockValue", &LuaCreature::GetShieldBlockValue }, #endif + { "GetDBTableGUIDLow", &LuaCreature::GetDBTableGUIDLow }, // Setters { "SetHover", &LuaCreature::SetHover }, @@ -859,6 +860,7 @@ ElunaRegister GameObjectMethods[] = { "GetLootState", &LuaGameObject::GetLootState }, { "GetLootRecipient", &LuaGameObject::GetLootRecipient }, { "GetLootRecipientGroup", &LuaGameObject::GetLootRecipientGroup }, + { "GetDBTableGUIDLow", &LuaGameObject::GetDBTableGUIDLow }, // Setters { "SetGoState", &LuaGameObject::SetGoState },