From b87a76bf55733d15dc0a902980a554dc9cfb35cb Mon Sep 17 00:00:00 2001 From: Axel Cocat Date: Tue, 1 Jun 2021 00:12:27 +0200 Subject: [PATCH 1/4] add SetInCombatWith --- LuaFunctions.cpp | 1 + UnitMethods.h | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index ef496f6..6d21bf3 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -335,6 +335,7 @@ ElunaRegister UnitMethods[] = #endif { "SetWaterWalk", &LuaUnit::SetWaterWalk }, { "SetStandState", &LuaUnit::SetStandState }, + { "SetInCombatWith", &LuaUnit::SetInCombatWith }, { "ModifyPower", &LuaUnit::ModifyPower }, // Boolean diff --git a/UnitMethods.h b/UnitMethods.h index 8d60aa8..c5dab31 100644 --- a/UnitMethods.h +++ b/UnitMethods.h @@ -1842,6 +1842,18 @@ namespace LuaUnit return 0; } + /** + * Sets the [Unit] to set in combat with the [Unit] of given GUID. + * + * @param ObjectGuid guid : unit to start combat with + */ + int SetInCombatWith(lua_State* L, Unit* unit) + { + Unit* enemy = Eluna::CHECKOBJ(L, 2); + unit->SetInCombatWith(enemy); + return 0; + } + #if (!defined(TBC) && !defined(CLASSIC)) /** * Sets the [Unit]'s FFA flag on or off. From 2cba3b8fe62ad84a73fe6e8cefcdb068370f8fc4 Mon Sep 17 00:00:00 2001 From: Axel Cocat Date: Tue, 1 Jun 2021 00:19:30 +0200 Subject: [PATCH 2/4] fixed doc for SetInCombatWith --- UnitMethods.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitMethods.h b/UnitMethods.h index c5dab31..ca05e3f 100644 --- a/UnitMethods.h +++ b/UnitMethods.h @@ -1845,7 +1845,7 @@ namespace LuaUnit /** * Sets the [Unit] to set in combat with the [Unit] of given GUID. * - * @param ObjectGuid guid : unit to start combat with + * @param [Unit] enemy : the Unit to start combat with */ int SetInCombatWith(lua_State* L, Unit* unit) { From a7b3b4293a60feff1b24fc388c81bb673ce08b12 Mon Sep 17 00:00:00 2001 From: Axel Cocat Date: Tue, 1 Jun 2021 00:21:14 +0200 Subject: [PATCH 3/4] fixed doc for SetInCombatWith --- UnitMethods.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitMethods.h b/UnitMethods.h index ca05e3f..7a18b19 100644 --- a/UnitMethods.h +++ b/UnitMethods.h @@ -1843,7 +1843,7 @@ namespace LuaUnit } /** - * Sets the [Unit] to set in combat with the [Unit] of given GUID. + * Sets the [Unit] in combat with the [Unit] of given GUID. * * @param [Unit] enemy : the Unit to start combat with */ From a563fdbfa07930010273dc8d286663b929750c3f Mon Sep 17 00:00:00 2001 From: Axel Cocat Date: Tue, 1 Jun 2021 00:22:28 +0200 Subject: [PATCH 4/4] fixed doc for SetInCombatWith --- UnitMethods.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UnitMethods.h b/UnitMethods.h index 7a18b19..2798e7a 100644 --- a/UnitMethods.h +++ b/UnitMethods.h @@ -1843,9 +1843,9 @@ namespace LuaUnit } /** - * Sets the [Unit] in combat with the [Unit] of given GUID. + * Sets the [Unit] in combat with the `enemy` [Unit]. * - * @param [Unit] enemy : the Unit to start combat with + * @param [Unit] enemy : the [Unit] to start combat with */ int SetInCombatWith(lua_State* L, Unit* unit) {