--HG--
branch : trunk
This commit is contained in:
Machiavelli
2009-08-20 22:39:21 +02:00
2 changed files with 64 additions and 5 deletions
+4 -3
View File
@@ -43,16 +43,17 @@ class TRINITY_DLL_DECL FollowerAI : public ScriptedAI
void SetFollowPaused(bool bPaused); //if special event require follow mode to hold/resume during the follow void SetFollowPaused(bool bPaused); //if special event require follow mode to hold/resume during the follow
protected:
bool HasFollowState(uint32 uiFollowState) { return (m_uiFollowState & uiFollowState); } bool HasFollowState(uint32 uiFollowState) { return (m_uiFollowState & uiFollowState); }
void AddFollowState(uint32 uiFollowState) { m_uiFollowState |= uiFollowState; }
void RemoveFollowState(uint32 uiFollowState) { m_uiFollowState &= ~uiFollowState; }
protected:
void SetFollowComplete(bool bWithEndEvent = false); void SetFollowComplete(bool bWithEndEvent = false);
Player* GetLeaderForFollower(); Player* GetLeaderForFollower();
private: private:
void AddFollowState(uint32 uiFollowState) { m_uiFollowState |= uiFollowState; }
void RemoveFollowState(uint32 uiFollowState) { m_uiFollowState &= ~uiFollowState; }
uint64 m_uiLeaderGUID; uint64 m_uiLeaderGUID;
uint32 m_uiUpdateFollowTimer; uint32 m_uiUpdateFollowTimer;
uint32 m_uiFollowState; uint32 m_uiFollowState;
@@ -168,11 +168,11 @@ enum
FACTION_ESCORTEE = 113 FACTION_ESCORTEE = 113
}; };
//Script not fully complete. Need more development of followerAI to accomplish misc tasks.
struct TRINITY_DLL_DECL npc_ringoAI : public FollowerAI struct TRINITY_DLL_DECL npc_ringoAI : public FollowerAI
{ {
npc_ringoAI(Creature* pCreature) : FollowerAI(pCreature) { } npc_ringoAI(Creature* pCreature) : FollowerAI(pCreature) { }
uint32 m_uiFaintTimer;
uint32 m_uiEndEventProgress; uint32 m_uiEndEventProgress;
uint32 m_uiEndEventTimer; uint32 m_uiEndEventTimer;
@@ -180,6 +180,7 @@ struct TRINITY_DLL_DECL npc_ringoAI : public FollowerAI
void Reset() void Reset()
{ {
m_uiFaintTimer = urand(30000, 60000);
m_uiEndEventProgress = 0; m_uiEndEventProgress = 0;
m_uiEndEventTimer = 1000; m_uiEndEventTimer = 1000;
pSpraggle = NULL; pSpraggle = NULL;
@@ -205,6 +206,49 @@ struct TRINITY_DLL_DECL npc_ringoAI : public FollowerAI
} }
} }
void SpellHit(Unit* pCaster, const SpellEntry* pSpell)
{
if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_REVIVE_RINGO)
ClearFaint();
}
void SetFaint()
{
if (!HasFollowState(STATE_FOLLOW_POSTEVENT))
{
SetFollowPaused(true);
switch(rand()%4)
{
case 0: DoScriptText(SAY_FAINT_1, m_creature); break;
case 1: DoScriptText(SAY_FAINT_2, m_creature); break;
case 2: DoScriptText(SAY_FAINT_3, m_creature); break;
case 3: DoScriptText(SAY_FAINT_4, m_creature); break;
}
}
//what does actually happen here? Emote? Aura?
m_creature->SetStandState(UNIT_STAND_STATE_SLEEP);
}
void ClearFaint()
{
m_creature->SetStandState(UNIT_STAND_STATE_STAND);
if (HasFollowState(STATE_FOLLOW_POSTEVENT))
return;
switch(rand()%4)
{
case 0: DoScriptText(SAY_WAKE_1, m_creature); break;
case 1: DoScriptText(SAY_WAKE_2, m_creature); break;
case 2: DoScriptText(SAY_WAKE_3, m_creature); break;
case 3: DoScriptText(SAY_WAKE_4, m_creature); break;
}
SetFollowPaused(false);
}
void UpdateFollowerAI(const uint32 uiDiff) void UpdateFollowerAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) if (!UpdateVictim())
@@ -215,7 +259,6 @@ struct TRINITY_DLL_DECL npc_ringoAI : public FollowerAI
{ {
if (!pSpraggle || !pSpraggle->isAlive()) if (!pSpraggle || !pSpraggle->isAlive())
{ {
m_uiEndEventTimer = 1000;
SetFollowComplete(); SetFollowComplete();
return; return;
} }
@@ -236,10 +279,12 @@ struct TRINITY_DLL_DECL npc_ringoAI : public FollowerAI
break; break;
case 4: case 4:
DoScriptText(EMOTE_RIN_END_4, m_creature); DoScriptText(EMOTE_RIN_END_4, m_creature);
SetFaint();
m_uiEndEventTimer = 9000; m_uiEndEventTimer = 9000;
break; break;
case 5: case 5:
DoScriptText(EMOTE_RIN_END_5, m_creature); DoScriptText(EMOTE_RIN_END_5, m_creature);
ClearFaint();
m_uiEndEventTimer = 1000; m_uiEndEventTimer = 1000;
break; break;
case 6: case 6:
@@ -264,6 +309,19 @@ struct TRINITY_DLL_DECL npc_ringoAI : public FollowerAI
else else
m_uiEndEventTimer -= uiDiff; m_uiEndEventTimer -= uiDiff;
} }
else if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
if (!HasFollowState(STATE_FOLLOW_PAUSED))
{
if (m_uiFaintTimer < uiDiff)
{
SetFaint();
m_uiFaintTimer = urand(60000, 120000);
}
else
m_uiFaintTimer -= uiDiff;
}
}
return; return;
} }