aboutsummaryrefslogtreecommitdiff
path: root/src/bindings/scripts/base
diff options
context:
space:
mode:
authorKudlaty <none@none>2009-08-16 21:46:31 +0200
committerKudlaty <none@none>2009-08-16 21:46:31 +0200
commit91f3d69edf754c4e62d973cf1ae81e9a2e36d7bc (patch)
treee22378836f78bf1e4a2eb16922eb487dbd39cbc7 /src/bindings/scripts/base
parent81ee07fa2a2ac050e56ed5666892e96997dd17bf (diff)
Merge [SD2]
r1314 Correct some spellId's and apply SD2 code style r1315 Correct more spells and apply SD2 code style r1316 Replace magic number with enum type name UNIT_DYNFLAG_DEAD r1317 Add support for quest 1249. Patch by jotapdiez r1318 Move AI's implementation from headers. Original patch/idea by DasBlub r1319 Convert script related to quest 938 to use followerAI r1320 Add new virtual function WaypointStart() to escortAI. --HG-- branch : trunk
Diffstat (limited to 'src/bindings/scripts/base')
-rw-r--r--src/bindings/scripts/base/escort_ai.cpp24
-rw-r--r--src/bindings/scripts/base/escort_ai.h6
-rw-r--r--src/bindings/scripts/base/guard_ai.cpp5
-rw-r--r--src/bindings/scripts/base/guard_ai.h4
4 files changed, 34 insertions, 5 deletions
diff --git a/src/bindings/scripts/base/escort_ai.cpp b/src/bindings/scripts/base/escort_ai.cpp
index f4979487d31..2c28aa6b9a6 100644
--- a/src/bindings/scripts/base/escort_ai.cpp
+++ b/src/bindings/scripts/base/escort_ai.cpp
@@ -19,6 +19,25 @@ enum
POINT_HOME = 0xFFFFFE
};
+npc_escortAI::npc_escortAI(Creature* pCreature) : ScriptedAI(pCreature),
+ IsBeingEscorted(false),
+ IsOnHold(false),
+ PlayerGUID(0),
+ MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE),
+ CanMelee(true),
+ m_uiPlayerCheckTimer(1000),
+ m_uiWPWaitTimer(2500),
+ m_bIsReturning(false),
+ m_bIsActiveAttacker(true),
+ m_bIsRunning(false),
+ DespawnAtEnd(true),
+ DespawnAtFar(true),
+ m_pQuestForEscort(NULL),
+ m_bCanInstantRespawn(false),
+ m_bCanReturnToStart(false),
+ ScriptWP(false)
+{}
+
void npc_escortAI::AttackStart(Unit* pWho)
{
if (!pWho)
@@ -159,7 +178,10 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
if (!IsOnHold)
{
m_creature->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
- debug_log("TSCR: EscortAI Next WP is: %u, %f, %f, %f", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
+ debug_log("TSCR: EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
+
+ WaypointStart(CurrentWP->id);
+
m_uiWPWaitTimer = 0;
}
}
diff --git a/src/bindings/scripts/base/escort_ai.h b/src/bindings/scripts/base/escort_ai.h
index 5d27aebfec6..663e11d79f6 100644
--- a/src/bindings/scripts/base/escort_ai.h
+++ b/src/bindings/scripts/base/escort_ai.h
@@ -28,12 +28,12 @@ struct Escort_Waypoint
struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI
{
public:
- explicit npc_escortAI(Creature* pCreature) : ScriptedAI(pCreature),
- IsBeingEscorted(false), IsOnHold(false), PlayerGUID(0), MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), CanMelee(true), m_uiPlayerCheckTimer(1000), m_uiWPWaitTimer(2500), m_bIsReturning(false), m_bIsActiveAttacker(true), m_bIsRunning(false), DespawnAtEnd(true), DespawnAtFar(true), m_pQuestForEscort(NULL), m_bCanInstantRespawn(false), m_bCanReturnToStart(false), ScriptWP(false) {}
+ explicit npc_escortAI(Creature* pCreature);
~npc_escortAI() {}
// Pure Virtual Functions
- virtual void WaypointReached(uint32) = 0;
+ virtual void WaypointReached(uint32 uiPointId) = 0;
+ virtual void WaypointStart(uint32 uiPointId) {}
// CreatureAI functions
void AttackStart(Unit* who);
diff --git a/src/bindings/scripts/base/guard_ai.cpp b/src/bindings/scripts/base/guard_ai.cpp
index 7f1daa1e2df..b55eae2dbad 100644
--- a/src/bindings/scripts/base/guard_ai.cpp
+++ b/src/bindings/scripts/base/guard_ai.cpp
@@ -32,6 +32,11 @@ EndScriptData */
#define SAY_GUARD_SIL_AGGRO2 -1070002
#define SAY_GUARD_SIL_AGGRO3 -1070003
+guardAI::guardAI(Creature* pCreature) : ScriptedAI(pCreature),
+ GlobalCooldown(0),
+ BuffTimer(0)
+{}
+
void guardAI::Reset()
{
GlobalCooldown = 0;
diff --git a/src/bindings/scripts/base/guard_ai.h b/src/bindings/scripts/base/guard_ai.h
index 85baa30fb9d..a7fff32e3ab 100644
--- a/src/bindings/scripts/base/guard_ai.h
+++ b/src/bindings/scripts/base/guard_ai.h
@@ -9,7 +9,9 @@
struct TRINITY_DLL_DECL guardAI : public ScriptedAI
{
- guardAI(Creature *c) : ScriptedAI(c) {}
+ public:
+ explicit guardAI(Creature* pCreature);
+ ~guardAI() {}
uint32 GlobalCooldown; //This variable acts like the global cooldown that players have (1.5 seconds)
uint32 BuffTimer; //This variable keeps track of buffs