From 69a7b14d723f0145df9eb2cb2fcf40b50b48a3ff Mon Sep 17 00:00:00 2001 From: Elmsroth Date: Fri, 29 May 2020 09:47:14 +0200 Subject: [PATCH 1/4] Add GameObjectAI Support --- GlobalMethods.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/GlobalMethods.h b/GlobalMethods.h index 26a4e5d..eb01788 100644 --- a/GlobalMethods.h +++ b/GlobalMethods.h @@ -1638,6 +1638,7 @@ namespace LuaGlobalFunctions // DEBUG_LOG(GetMangosString(LANG_GAMEOBJECT_CURRENT), gInfo->name, db_lowGUID, x, y, z, o); map->Add(pGameObj); + pGameObj->AIM_Initialize(); eObjectMgr->AddGameobjectToGrid(db_lowGUID, eObjectMgr->GetGOData(db_lowGUID)); @@ -1661,6 +1662,7 @@ namespace LuaGlobalFunctions pGameObj->SetRespawnTime(durorresptime / IN_MILLISECONDS); map->Add(pGameObj); + pGameObj->AIM_Initialize(); Eluna::Push(L, pGameObj); } From 8e3b74e9b159d331cc851bc16776534929514b52 Mon Sep 17 00:00:00 2001 From: Elmsroth Date: Sat, 14 Nov 2020 17:30:47 +0100 Subject: [PATCH 2/4] Rename some defines --- GlobalMethods.h | 2 +- WorldObjectMethods.h | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/GlobalMethods.h b/GlobalMethods.h index eb01788..f51ed18 100644 --- a/GlobalMethods.h +++ b/GlobalMethods.h @@ -1572,7 +1572,7 @@ namespace LuaGlobalFunctions pCreature->SetActiveObjectState(false); // Also initializes the AI and MMGen - pCreature->Summon(durorresptime ? TEMPSUMMON_TIMED_OR_DEAD_DESPAWN : TEMPSUMMON_MANUAL_DESPAWN, durorresptime); + pCreature->Summon(durorresptime ? TEMPSPAWN_TIMED_OR_DEAD_DESPAWN : TEMPSPAWN_MANUAL_DESPAWN, durorresptime); // Creature Linking, Initial load is handled like respawn if (pCreature->IsLinkingEventTrigger()) diff --git a/WorldObjectMethods.h b/WorldObjectMethods.h index 6205efe..4555cec 100644 --- a/WorldObjectMethods.h +++ b/WorldObjectMethods.h @@ -736,8 +736,8 @@ namespace LuaWorldObject * TEMPSUMMON_TIMED_DESPAWN = 3, // despawns after a specified time * TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT = 4, // despawns after a specified time after the creature is out of combat * TEMPSUMMON_CORPSE_DESPAWN = 5, // despawns instantly after death - * TEMPSUMMON_CORPSE_TIMED_DESPAWN = 6, // despawns after a specified time after death - * TEMPSUMMON_DEAD_DESPAWN = 7, // despawns when the creature disappears + * TEMPSPAWN_CORPSE_TIMED_DESPAWN = 6, // despawns after a specified time after death + * TEMPSPAWN_DEAD_DESPAWN = 7, // despawns when the creature disappears * TEMPSUMMON_MANUAL_DESPAWN = 8, // despawns when UnSummon() is called * TEMPSUMMON_TIMED_OOC_OR_CORPSE_DESPAWN = 9, // despawns after a specified time (OOC) OR when the creature dies * TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN = 10 // despawns after a specified time (OOC) OR when the creature disappears @@ -762,43 +762,43 @@ namespace LuaWorldObject uint32 spawnType = Eluna::CHECKVAL(L, 7, 8); uint32 despawnTimer = Eluna::CHECKVAL(L, 8, 0); - TempSummonType type; + TempSpawnType type; switch (spawnType) { case 1: - type = TEMPSUMMON_TIMED_OR_DEAD_DESPAWN; + type = TEMPSPAWN_TIMED_OR_DEAD_DESPAWN; break; case 2: - type = TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN; + type = TEMPSPAWN_TIMED_OR_CORPSE_DESPAWN; break; case 3: - type = TEMPSUMMON_TIMED_DESPAWN; + type = TEMPSPAWN_TIMED_DESPAWN; break; case 4: #if defined TRINITY || AZEROTHCORE type = TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT; #else - type = TEMPSUMMON_TIMED_OOC_DESPAWN; + type = TEMPSPAWN_TIMED_OOC_DESPAWN; #endif break; case 5: - type = TEMPSUMMON_CORPSE_DESPAWN; + type = TEMPSPAWN_CORPSE_DESPAWN; break; case 6: - type = TEMPSUMMON_CORPSE_TIMED_DESPAWN; + type = TEMPSPAWN_CORPSE_TIMED_DESPAWN; break; case 7: - type = TEMPSUMMON_DEAD_DESPAWN; + type = TEMPSPAWN_DEAD_DESPAWN; break; case 8: - type = TEMPSUMMON_MANUAL_DESPAWN; + type = TEMPSPAWN_MANUAL_DESPAWN; break; #if !defined TRINITY && !AZEROTHCORE case 9: - type = TEMPSUMMON_TIMED_OOC_OR_CORPSE_DESPAWN; + type = TEMPSPAWN_TIMED_OOC_OR_CORPSE_DESPAWN; break; case 10: - type = TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN; + type = TEMPSPAWN_TIMED_OOC_OR_DEAD_DESPAWN; break; #endif default: From b036d96176d87c5507b5221de3ef1d8a8162175e Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Sun, 15 Nov 2020 23:18:45 +0200 Subject: [PATCH 3/4] Try fix CI --- WorldObjectMethods.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/WorldObjectMethods.h b/WorldObjectMethods.h index 4555cec..e0a6cc5 100644 --- a/WorldObjectMethods.h +++ b/WorldObjectMethods.h @@ -762,7 +762,11 @@ namespace LuaWorldObject uint32 spawnType = Eluna::CHECKVAL(L, 7, 8); uint32 despawnTimer = Eluna::CHECKVAL(L, 8, 0); +#if defined TRINITY || AZEROTHCORE + TempSummonType type; +#else TempSpawnType type; +#endif switch (spawnType) { case 1: From 91ef336690278973dbcf3d538042adea7613937c Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Sun, 15 Nov 2020 23:32:45 +0200 Subject: [PATCH 4/4] Fix CI --- WorldObjectMethods.h | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/WorldObjectMethods.h b/WorldObjectMethods.h index 31e3f97..98187c6 100644 --- a/WorldObjectMethods.h +++ b/WorldObjectMethods.h @@ -736,8 +736,8 @@ namespace LuaWorldObject * TEMPSUMMON_TIMED_DESPAWN = 3, // despawns after a specified time * TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT = 4, // despawns after a specified time after the creature is out of combat * TEMPSUMMON_CORPSE_DESPAWN = 5, // despawns instantly after death - * TEMPSPAWN_CORPSE_TIMED_DESPAWN = 6, // despawns after a specified time after death - * TEMPSPAWN_DEAD_DESPAWN = 7, // despawns when the creature disappears + * TEMPSUMMON_CORPSE_TIMED_DESPAWN = 6, // despawns after a specified time after death + * TEMPSUMMON_DEAD_DESPAWN = 7, // despawns when the creature disappears * TEMPSUMMON_MANUAL_DESPAWN = 8, // despawns when UnSummon() is called * TEMPSUMMON_TIMED_OOC_OR_CORPSE_DESPAWN = 9, // despawns after a specified time (OOC) OR when the creature dies * TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN = 10 // despawns after a specified time (OOC) OR when the creature disappears @@ -764,9 +764,37 @@ namespace LuaWorldObject #if defined TRINITY || AZEROTHCORE TempSummonType type; + switch (spawnType) + { + case 1: + type = TEMPSUMMON_TIMED_OR_DEAD_DESPAWN; + break; + case 2: + type = TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN; + break; + case 3: + type = TEMPSUMMON_TIMED_DESPAWN; + break; + case 4: + type = TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT; + break; + case 5: + type = TEMPSUMMON_CORPSE_DESPAWN; + break; + case 6: + type = TEMPSUMMON_CORPSE_TIMED_DESPAWN; + break; + case 7: + type = TEMPSUMMON_DEAD_DESPAWN; + break; + case 8: + type = TEMPSUMMON_MANUAL_DESPAWN; + break; + default: + return luaL_argerror(L, 7, "valid SpawnType expected"); + } #else TempSpawnType type; -#endif switch (spawnType) { case 1: @@ -779,11 +807,7 @@ namespace LuaWorldObject type = TEMPSPAWN_TIMED_DESPAWN; break; case 4: -#if defined TRINITY || AZEROTHCORE - type = TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT; -#else type = TEMPSPAWN_TIMED_OOC_DESPAWN; -#endif break; case 5: type = TEMPSPAWN_CORPSE_DESPAWN; @@ -797,17 +821,16 @@ namespace LuaWorldObject case 8: type = TEMPSPAWN_MANUAL_DESPAWN; break; -#if !defined TRINITY && !AZEROTHCORE case 9: type = TEMPSPAWN_TIMED_OOC_OR_CORPSE_DESPAWN; break; case 10: type = TEMPSPAWN_TIMED_OOC_OR_DEAD_DESPAWN; break; -#endif default: return luaL_argerror(L, 7, "valid SpawnType expected"); } +#endif #ifdef TRINITY Eluna::Push(L, obj->SummonCreature(entry, x, y, z, o, type, Seconds(despawnTimer))); #else