diff options
author | Rat <none@none> | 2009-08-28 23:37:06 +0200 |
---|---|---|
committer | Rat <none@none> | 2009-08-28 23:37:06 +0200 |
commit | ff85d6c28940301e14cb6941e73284fc6fea3c68 (patch) | |
tree | ed718b0d374d205ab758675b206c978424643630 /src | |
parent | 04a701246d839d01c3c23466de31173e9b02d9cb (diff) |
*Lurker can now be fished, with anims and all
--HG--
branch : trunk
Diffstat (limited to 'src')
3 files changed, 111 insertions, 29 deletions
diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp index 7758e0fcedb..268d8c3973e 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp @@ -76,7 +76,7 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI TempSpell->Effect[0] = 0;//remove all spell effect, only anim is needed TempSpell->Effect[1] = 0; TempSpell->Effect[2] = 0; - } + } } ScriptedInstance* pInstance; @@ -85,6 +85,7 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI bool Spawned; bool Submerged; bool InRange; + bool CanStartEvent; uint32 RotTimer; uint32 SpoutAnimTimer; uint32 WaterboltTimer; @@ -93,14 +94,18 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI uint32 PhaseTimer; uint32 GeyserTimer; uint32 CheckTimer; + uint32 WaitTimer; + uint32 WaitTimer2; + bool CheckCanStart()//check if players fished + { + if(pInstance && pInstance->GetData(DATA_STRANGE_POOL) == NOT_STARTED) + return false; + return true; + } void Reset() { - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING + MOVEMENTFLAG_LEVITATING); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->RemoveFlag(UNIT_NPC_EMOTESTATE,EMOTE_STATE_SUBMERGED); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); - + m_creature->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING + MOVEMENTFLAG_LEVITATING); SpoutAnimTimer = 1000; RotTimer = 0; WaterboltTimer = 15000;//give time to get in range when fight starts @@ -109,24 +114,25 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI PhaseTimer = 120000; GeyserTimer = rand()%5000 + 15000; CheckTimer = 15000;//give time to get in range when fight starts + WaitTimer = 60000;//never reached + WaitTimer2 = 60000;//never reached - Submerged = false; + Submerged = true;//will be false at combat start Spawned = false; InRange = false; + CanStartEvent = false; Summons.DespawnAll(); if (pInstance) - pInstance->SetData(DATA_THELURKERBELOWEVENT, NOT_STARTED); - - /*if (pInstance->GetData(DATA_STRANGE_POOL) != DONE) { - m_creature->SetReactState(REACT_PASSIVE); - m_creature->SetVisibility(VISIBILITY_OFF); - }else { - m_creature->SetVisibility(VISIBILITY_ON); - m_creature->SetReactState(REACT_AGGRESSIVE); - }*/ + pInstance->SetData(DATA_THELURKERBELOWEVENT, NOT_STARTED); + pInstance->SetData(DATA_STRANGE_POOL, NOT_STARTED); + } + DoCast(m_creature,SPELL_SUBMERGE);//submerge anim + m_creature->SetVisibility(VISIBILITY_OFF);//we start invis under water, submerged + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); } void JustDied(Unit* Killer) @@ -135,7 +141,28 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI pInstance->SetData(DATA_THELURKERBELOWEVENT, DONE); Summons.DespawnAll(); - } + } + + void EnterCombat(Unit *who) + { + if (pInstance) + pInstance->SetData(DATA_THELURKERBELOWEVENT, IN_PROGRESS); + Scripted_NoMovementAI::EnterCombat(who); + } + + void MoveInLineOfSight(Unit *who) + { + if(!CanStartEvent)//boss is invisible, don't attack + return; + if (!m_creature->getVictim() && who->isTargetableForAttack() && (m_creature->IsHostileTo(who))) + { + float attackRadius = m_creature->GetAttackDistance(who); + if (m_creature->IsWithinDistInMap(who, attackRadius)) + { + AttackStart(who); + } + } + } void UpdateAI(const uint32 diff) { @@ -158,9 +185,37 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI } }*/ - //Rotate(diff);//always check rotate things + if(!CanStartEvent)//boss is invisible, don't attack + { + if(CheckCanStart()) + { + if(Submerged) + { + m_creature->SetVisibility(VISIBILITY_ON); + Submerged = false; + WaitTimer2 = 500; + } + if(!Submerged && WaitTimer2 < diff)//wait 500ms before emerge anim + { + m_creature->RemoveAllAuras(); + m_creature->RemoveFlag(UNIT_NPC_EMOTESTATE,EMOTE_STATE_SUBMERGED); + DoCast(m_creature,SPELL_EMERGE,false); + WaitTimer2 = 60000;//never reached + WaitTimer = 3000; + }else WaitTimer2 -= diff; + + if(WaitTimer < diff)//wait 3secs for emerge anim, then attack + { + WaitTimer = 3000; + CanStartEvent=true;//fresh fished from pool + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + }else WaitTimer -= diff; + } + return; + } + - //Return since we have no target if(m_creature->getThreatManager().getThreatList().empty())//check if should evade { diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/def_serpent_shrine.h b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/def_serpent_shrine.h index 13144bc93c0..e3a908a4cd5 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/def_serpent_shrine.h +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/def_serpent_shrine.h @@ -4,7 +4,12 @@ #ifndef DEF_SERPENT_SHRINE_H #define DEF_SERPENT_SHRINE_H - +enum LurkerEventState +{ + LURKER_NOT_STARTED = 0, + LURKER_FISHING = 1, + LURKER_HOOKED = 2, +}; #define DATA_CANSTARTPHASE3 1 #define DATA_CARIBDIS 2 #define DATA_HYDROSSTHEUNSTABLEEVENT 3 diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp index 4819b03ddc1..0a4a8d2b911 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp @@ -64,7 +64,9 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance uint64 ControlConsole; uint64 BridgePart[3]; - uint64 StrangePool; + uint32 StrangePool; + uint32 FishingTimer; + uint32 LurkerSubEvent; bool ShieldGeneratorDeactivated[4]; uint32 m_auiEncounter[MAX_ENCOUNTER]; @@ -93,6 +95,8 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance ShieldGeneratorDeactivated[1] = false; ShieldGeneratorDeactivated[2] = false; ShieldGeneratorDeactivated[3] = false; + FishingTimer = 1000; + LurkerSubEvent = 0; } bool IsEncounterInProgress() const @@ -103,6 +107,19 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance return false; } + void Update (uint32 diff) + { + //Lurker Fishing event + if(LurkerSubEvent == LURKER_FISHING) + { + if(FishingTimer < diff) + { + LurkerSubEvent == LURKER_HOOKED; + SetData(DATA_STRANGE_POOL, IN_PROGRESS);//just fished, signal Lurker script to emerge and start fight, we use IN_PROGRESS so it won't get saved and lurker will be alway invis at start if server restarted + }else FishingTimer -= diff; + } + } + void OnGameObjectCreate(GameObject* pGo, bool add) { switch(pGo->GetEntry()) @@ -126,13 +143,12 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance BridgePart[2] = pGo->GetGUID(); pGo->setActive(true); break; - case 184956: - StrangePool = pGo->GetGUID(); - if (pGo->isActiveObject()) - SetData(DATA_STRANGE_POOL, DONE); - break; - case GAMEOBJECT_FISHINGNODE_ENTRY: - //todo (yes this works) + case GAMEOBJECT_FISHINGNODE_ENTRY://no way checking if fish is hooked, so we create a timed event + if(LurkerSubEvent == LURKER_NOT_STARTED) + { + FishingTimer = 10000+rand()%30000;//random time before lurker emerges + LurkerSubEvent = LURKER_FISHING; + } break; } } @@ -179,7 +195,12 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance { switch(type) { - case DATA_STRANGE_POOL: StrangePool = data; + case DATA_STRANGE_POOL: + { + StrangePool = data; + if(data == NOT_STARTED) + LurkerSubEvent = LURKER_NOT_STARTED; + } case DATA_CONTROL_CONSOLE: if (data == DONE) { @@ -230,6 +251,7 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance case DATA_SHIELDGENERATOR4: return ShieldGeneratorDeactivated[3]; case DATA_CANSTARTPHASE3: if (ShieldGeneratorDeactivated[0] && ShieldGeneratorDeactivated[1] && ShieldGeneratorDeactivated[2] && ShieldGeneratorDeactivated[3])return 1;break; + case DATA_STRANGE_POOL: return StrangePool; } return 0; } |