From 44bdb135f4ed5bb834795cfb928ccbb0504cf834 Mon Sep 17 00:00:00 2001 From: gvcoman Date: Wed, 5 Nov 2008 20:51:05 -0600 Subject: [svn] Implemented player on player and player on creature possession: * Implemented packet and vision forwarding through possessed units * Added new OnPossess script call alerting scripts on when possession is applied/removed * Moved fall damage and fall under map calculations into the Player class * Added new PossessedAI that is applied only while possession on creature is active * Implemented summon possessed spell effect * Fixed Eyes of the Beast --HG-- branch : trunk --- src/bindings/scripts/include/sc_creature.h | 3 +++ src/bindings/scripts/scripts/npc/npc_escortAI.cpp | 19 +++++++++++++++++++ src/bindings/scripts/scripts/npc/npc_escortAI.h | 2 ++ 3 files changed, 24 insertions(+) (limited to 'src/bindings') diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h index da40e2eab60..70a43a4df52 100644 --- a/src/bindings/scripts/include/sc_creature.h +++ b/src/bindings/scripts/include/sc_creature.h @@ -75,6 +75,9 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI //Called at waypoint reached or PointMovement end void MovementInform(uint32, uint32){} + // Called when AI is temporarily replaced or put back when possess is applied or removed + void OnPossess(bool apply) {} + //************* // Variables //************* diff --git a/src/bindings/scripts/scripts/npc/npc_escortAI.cpp b/src/bindings/scripts/scripts/npc/npc_escortAI.cpp index 2c3163b9a7c..04efb0c952d 100644 --- a/src/bindings/scripts/scripts/npc/npc_escortAI.cpp +++ b/src/bindings/scripts/scripts/npc/npc_escortAI.cpp @@ -256,6 +256,25 @@ void npc_escortAI::MovementInform(uint32 type, uint32 id) } } +void npc_escortAI::OnPossess(bool apply) +{ + // We got possessed in the middle of being escorted, store the point + // where we left off to come back to when possess is removed + if (IsBeingEscorted) + { + if (apply) + m_creature->GetPosition(LastPos.x, LastPos.y, LastPos.z); + else + { + Returning = true; + m_creature->GetMotionMaster()->MovementExpired(); + m_creature->GetMotionMaster()->MovePoint(WP_LAST_POINT, LastPos.x, LastPos.y, LastPos.z); + } + } +} + + + void npc_escortAI::AddWaypoint(uint32 id, float x, float y, float z, uint32 WaitTimeMs) { Escort_Waypoint t(id, x, y, z, WaitTimeMs); diff --git a/src/bindings/scripts/scripts/npc/npc_escortAI.h b/src/bindings/scripts/scripts/npc/npc_escortAI.h index 73928f7e2f8..a805bdd45bb 100644 --- a/src/bindings/scripts/scripts/npc/npc_escortAI.h +++ b/src/bindings/scripts/scripts/npc/npc_escortAI.h @@ -51,6 +51,8 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI void MovementInform(uint32, uint32); + void OnPossess(bool apply); + // EscortAI functions void AddWaypoint(uint32 id, float x, float y, float z, uint32 WaitTimeMs = 0); -- cgit v1.2.3