ArcEmu: [ArcScript]Algalon the Obverser[Test] - ArcEmu

Jump to content

Toggle shoutbox Lastest Announcements

dfighter  : (07 December 2014 - 12:06 PM) Arcemu is in hibernation mode, please read http://arcemu.org/fo...showtopic=26903
dfighter  : (01 January 2013 - 05:56 PM) Arcemu wishes you all a happy new year!
Hasbro  : (12 September 2012 - 10:01 AM) Please excuse our outage from the web! Our web host had a major malfunction!
dfighter  : (01 September 2012 - 04:05 PM) Since the spam bots just don't want to stop, I've enabled admin verification when registering.
dfighter  : (23 January 2012 - 09:56 PM) Please note that from now on you will need to confirm your email on the wiki in order to edit it!
Hasbro  : (31 December 2011 - 12:50 PM) Happy New Years all!
Navid  : (26 December 2011 - 04:09 AM) Merry Christmas !!!!!! Happy holidays all :)
WAmadeus  : (24 December 2011 - 03:54 PM) Merry Christmas to all!
dfighter  : (24 December 2011 - 11:05 AM) The Arcemu team wishes y'all a Merry Christmukkah!
Hasbro  : (05 October 2011 - 12:53 PM) Looking for web designers for upcoming web related project. If you're interested in designing user interfaces contact me
dfighter  : (02 September 2011 - 03:47 PM) So who here wants vehicles in Arcemu? :P http://arcemu.org/fo...showtopic=25440
Hasbro  : (14 August 2011 - 03:25 PM) Join us on irc, grab an irc client and connect to irc.freenode.net join channel #arcemu /server irc.freenode.net:6667 /join #arcemu
jackpoz  : (03 August 2011 - 05:33 AM) to all Lua Engine (old one) users: please check http://arcemu.org/fo...showtopic=25274
Hasbro  : (20 May 2011 - 05:27 PM) Looking for people experienced with CMake configuration and setup! Contact me asap
Hasbro  : (15 May 2011 - 05:03 PM) ArcEmu is recruiting C++ programmers, contact Hasbro if interested.
paroxysm  : (03 May 2011 - 06:26 PM) Updated luabridge gossip example to describe the whole gossip creation process rather than just how to create menu. Gossip tutorial
paroxysm  : (23 April 2011 - 11:35 AM) Lua writers can refer to the Luabridge Tutorials section in the Wiki to learn how to write gossip code correctly.
Hasbro  : (20 April 2011 - 05:22 PM) Thank you for your continuous contribution of bug reports, we are working on them.
Hasbro  : (17 April 2011 - 03:20 AM) Please consider donating to support our bills. Donations can be sent using PayPal to donations@arcemu.org - Thank you for your support.
paroxysm  : (10 April 2011 - 12:43 AM) Refer to the Luabridge Tutorials section in the Wiki to learn the new syntax of luabridge.
Resize Shouts Area

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[ArcScript]Algalon the Obverser[Test] Algalon the Obverser beta script!

#1 User is offline   Azolex 

  • Member
  • Group: Contributor
  • Posts: 54
  • Joined: 08-August 08
  • Gender:Male
  • Location:Serbia
  • Interests:Music, Computers, School and Girls!

Posted 14 November 2009 - 06:01 PM

Hello dear users and supporters of ArcEmu, last few days i was developing Algalon the Obverser encounter in Ulduar, here is log:

Quote

-Intro scene is fully done, only spawn event is uncorrect.
-Phase 1:
-Stars are fully working, random movement and on death they will despawn and spawn dark holes(ill provide queries soon)
-Dark holes work, they port to phase where adds should be spawned(ill provide queries soon)
-Adds that fly around are working(Living smth) they will despawn if 2 close 2 dark hole same happens to dark holes, they cast spell and move around(ill provide queries soon)
-Big bang with correct timers, announcement and big bang WILL remove phase aura(blizzlike)
-Phase punch is casted, however it does not work on 5th stack, ill fix this before official commit
-Phase 2:
-All previous creatures/adds/dark holes are despawned
-4 new black holes spawn, with incorrect coordinates, but will get fixed on official commit
-They spawn adds(ill provide queries soon)
-He stops casting all previous spells
-Encounter end and chest spawn

Known BUGS and UNFINISHED stuff:
-Cosmic smash is broken, core does not support spells of that type, as soon as core start supporting that spells i will update script
-Scene upon finishing of encounter is not added yet i will add it before official commit
-Not all emotes are added, will add it before official commit
-Code is not clean yet!


Here it is v0.1.3:
/*
 * ArcScripts for ArcEmu MMORPG Server
 * Copyright (C) 2009 ArcEmu Team <http://www.arcemu.org/>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "StdAfx.h"
#include "Setup.h"
#include "../Common/Base.h" 

static Coords RoomPoints[]=
{
	{ 1646.411499f, -280.270538f, 417.321686f },
	{ 1654.442139f, -296.619995f, 417.321686f },
	{ 1649.935181f, -312.869995f, 417.321991f },
	{ 1635.889160f, -323.114960f, 417.321991f },
	{ 1626.588257f, -334.422952f, 417.321991f },
	{ 1609.273315f, -325.008759f, 417.321991f },
	{ 1613.084351f, -311.113373f, 417.321991f },
	{ 1608.645264f, -300.140015f, 417.321991f },
	{ 1611.737549f, -287.944885f, 417.321991f },
	{ 1622.536509f, -289.462799f, 417.321991f },
	{ 1634.319824f, -276.142670f, 417.321991f },
	{ 1642.059082f, -288.031097f, 417.321991f },
	{ 1654.436279f, -286.942200f, 417.321991f }
};

static Coords BlackHoleSpawns[]=
{
	{ 1640.192749f, -313.252136f, 417.321686f, 2.244802f },
	{ 1621.535767f, -311.449310f, 417.321686f, 0.723486f },
	{ 1625.286743f, -291.989807f, 417.321686f, 5.373048f },
	{ 1643.084351f, -301.061035f, 417.321686f, 3.614546f }
};

static Coords BronzebeardWaypoint[]=
{
	{ 1632.451904f, -173.976532f, 427.262726f, 4.693232f, 0 },
	{ 1631.937988f, -221.072922f, 418.409332f, 4.693232f, 0 }
};

static Coords LivingConstellationWP[]=
{
	{ 1618.260010f, -303.169342f, 420.658508f, 6.241804f },
	{ 1631.825928f, -319.399384f, 421.392365f, 1.560456f },
	{ 1642.386353f, -305.013702f, 421.466583f, 3.218021f }
};

static Coords LivingConstellationSpawn[]=
{
	{ 1678.458862f, -306.932587f, 438.095001f, 3.126851f },
	{ 1588.860718f, -312.406250f, 536.889526f, 6.256645f },
	{ 1633.562012f, -355.855469f, 434.713654f, 1.860765f }
};

static Coords AlgalonEndEvent[]=
{
	{ 1632.140381f, -302.678314f, 417.321106f, 1.604511f }, 
	{ 1632.315308f, -307.865356f, 417.321106f, 1.604511f } 
};

enum ALGALON_DEFINES
{
	// Game Objects
	Doodad_UL_SigilDoor_01						= 194767,
	Doodad_UL_UniverseGlobe_01					= 194148,
	Doodad_UL_UniverseFloor_01					= 194715,
	Doodad_UL_UniverseFloor_02					= 194716,
	Doodad_UL_TrapDoor_03						= 194253,
	Doodad_UL_SigilDoor_03						= 194910,
	UL_GIFT_OF_THE_OBSERVER						= 194821,
	// Creatures
	CN_ALGALON									= 32871,
	CN_BRANN									= 33235,  // used at intro scene
	CN_AZEROTH									= 34246,
	CN_COLLAPSING_STAR							= 32955,
	CN_BLACK_HOLE								= 32953,
	CN_LIVING_CONSTELLATION						= 33052,
	CN_DARK_MATTER								= 33089,
	CN_UNLEASEHED_DARK_MATTER					= 34097,
	// Algalon Spells 
	ALGALON_QUANTUM_STRIKE_10					= 64395,
	ALGALON_QUANTUM_STRIKE_25					= 64592,
	ALGALON_BIG_BANG_10							= 64443, 
	ALGALON_BIG_BANG_25							= 64584,
	ALGALON_BERSEK								= 47008,
	ALGALON_PHASE_PUNCH							= 64412,
	ALGALON_ASCEND_TO_HEAVENS					= 64487,
	// Stars spells
	STAR_EXPLODE								= 64122, // used on stars death
	STAR_SUMMON_BLACK_HOLE						= 62189,
	// phase related spells
	BLACK_HOLE_DAMAGE_AURA						= 62169,
	BLACK_HOLE_PHASE_AURA						= 64417,
	BLACK_HOLE_VISUAL_VOID_ZONE					= 64017,
	// Living Constellation spells
	ARCANE_BARRAGE								= 64599,
	// thanks to Compboy for this 2 ids, start event spells
	ALGALON_CHANNEL								= 64996,
	ALGALON_ARRIVAL								= 64997,
	// achievement killcredit spell
	ALGALON_KILLCREDIT							= 65184,
	// Algalon Sound ids
	UR_ALGALON_SUMMON01							= 15405,      //UR_Algalon_Summon01.wav
	UR_ALGALON_SUMMON02							= 15406,      //UR_Algalon_Summon02.wav
	UR_ALGALON_SUMMON03							= 15407,     //UR_Algalon_Summon03.wav
	UR_ALGALON_AGGRO01							= 15386,      //UR_Algalon_Aggro01.wav
	UR_ALGALON_ADDS01							= 15392,      //UR_Algalon_Adds01.wav
	UR_ALGALON_BHOLE01							= 15391,      //UR_Algalon_BHole01.wav
	UR_ALGALON_SPECIAL01						= 15396,      //UR_Algalon_Special01.wav
	UR_ALGALON_SPACE01							= 15390,      //UR_Algalon_Space01.wav
	UR_ALGALON_BERSERK01                        = 15394,      //UR_Algalon_Berzerk01.wav
	// Branns sound ids
	UR_BRANN_ALGALONSUMMONED01					= 15824,      //UR_Brann_AlgalonSummoned01.wav
	UR_BRANN_ALGALONSUMMONED02					= 15825,      //UR_Brann_AlgalonSummoned02.wav
	// timer macros
	TIMER_STAR_01								= 15000, 
	TIMER_STAR_02								= 40000,
	TIMER_START_DELAY							= 12000,
	TIMER_BIG_BANG								= 90000,
	TIMER_BIG_BANG_CAST							= 8000,
	TIMER_ENRAGE								= 360000,
	TIMER_SUMMON_DARK_MATTER					= 30000,
	TIMER_LIVING_CONSTELLATION_JOIN				= 38000,
};

typedef std::vector<Creature*> EncounterArray;

class AlgalonAI : public MoonScriptBossAI
{
public:
	MOONSCRIPT_FACTORY_FUNCTION(AlgalonAI, MoonScriptBossAI);
	AlgalonAI(Creature* pCreature) : MoonScriptBossAI(pCreature)
	{
		AddPhaseSpell( 2, AddSpell( ALGALON_QUANTUM_STRIKE_10, Target_Current, 50, 0, 6 ) );
		AddPhaseSpell( 2, AddSpell( ALGALON_PHASE_PUNCH, Target_Current, 99, 0, 12 ) );
		AddPhaseSpell( 3, AddSpell( ALGALON_QUANTUM_STRIKE_10, Target_Current, 50, 0, 6 ) );
		AddPhaseSpell( 3, AddSpell( ALGALON_PHASE_PUNCH, Target_Current, 99, 0, 12 ) );
		mEnrage = AddSpell( ALGALON_BERSEK, Target_Self, 0, 0, 0 ); // 6 minutes enrage

		AddEmote( Event_OnCombatStart, "Your actions are illogical. All possible results for this encounter have been calculated. The pantheon will receive the observer's message regardless outcome.", Text_Yell, UR_ALGALON_AGGRO01 );
	
		SetCanEnterCombat( false );
		SetFlyMode( true );

		mIntro = true;
		mFirstEncounter = true;
		mEndScene = false;
		mScene = 0;
		mTimer = 0;
		pAzeroth = NULL;
		
		_bigBang = false;
		mEnrageTimer = INVALIDATE_TIMER;
		mAddTimer = INVALIDATE_TIMER;
		mTimeoutTimer = INVALIDATE_TIMER;
		mBigBangTimer = INVALIDATE_TIMER;

		RegisterAIUpdateEvent( 1000 );
	};

	void OnCombatStart(Unit* pTarget)
	{
		// additional spell timers
		mAddTimer = AddTimer( TIMER_STAR_01 + TIMER_START_DELAY ); // star timer
		mBigBangTimer = AddTimer( TIMER_BIG_BANG + TIMER_START_DELAY ); //90 seconds + 12 seconds
		mEnrageTimer = AddTimer( TIMER_ENRAGE ); // 6 minutes
		_bigBang = false;

		// add timers and stop him from doing anything
		mTimeoutTimer = AddTimer( TIMER_START_DELAY );
		DelayNextAttack( TIMER_START_DELAY );
		_unit->SetUInt64Value( UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_9 );
		
		SetAllowMelee( false );
		SetAllowSpell( false );
		SetAllowTargeting( false );
		SetCanMove( false );
		TriggerCooldownOnAllSpells(); 
	
		ParentClass::OnCombatStart( pTarget );
	};

	

	void AIUpdate()
	{
		if( mIntro )
		{
			++mTimer;
			switch( mTimer )
			{
			case 1:
			case 5:
			case 9:
			case 12:
			case 19:
			case 29:
			case 34:
				IntroScene();
			break;
			};	
		}

		

		if( GetHealthPercent() <= 3 && GetPhase() == 3 )
		{
			// lets set him out of combat
			mEndScene = true;
			SetCanEnterCombat(false);
			_unit->GetAIInterface()->HandleEvent( EVENT_LEAVECOMBAT, _unit, 0 );
			
			AddWaypoint(CreateWaypoint( 1, 0, Flag_Run, AlgalonEndEvent[1] ));
			ForceWaypointMove( 1 );
		};

		if( GetHealthPercent() <= 20 && GetPhase() == 2 )
			PhaseThree();

		if( IsTimerFinished( mEnrageTimer ) )
		{
			CastSpellNowNoScheduling( mEnrage );
			Emote( "You are... out of time.", Text_Yell, UR_ALGALON_BERSERK01 );
			RemoveTimer( mEnrageTimer );
		};

		if( IsTimerFinished( mTimeoutTimer ) )
			StartHandler();

		if( IsTimerFinished( mAddTimer ) )
			SummonStars();
		
		if( IsTimerFinished( mBigBangTimer ) )
			BigBang();

		ParentClass::AIUpdate();
	};

	void OnCombatStop(Unit* pTarget)
	{
		DespawnAllEncounterCreatures();

		if( pPlanet != NULL && pPlanet->GetState() == 0)
			pPlanet->SetState(1);

		if( pFloor1 != NULL && pFloor1->GetState() == 1)
			pFloor1->SetState(0);
		
		if( pFloor2 != NULL && pFloor2->GetState() == 0) 
			pFloor2->SetState(1);

		if( pTrapDoor != NULL && pTrapDoor->GetState() == 0 )
			pTrapDoor->SetState(1);

		if( pLimitDoor != NULL && pFloor2->GetState() == 1 )		
			pLimitDoor->SetState(0);

		ParentClass::OnCombatStop( pTarget );

		if( !mEndScene )
		{
			/* to prevent possible bugs */
			mFirstEncounter = false;
			RemoveAIUpdateEvent();
			_unit->SetUInt64Value( UNIT_FIELD_FLAGS, 0 );
		}
	};

	void OnReachWP(uint32 iWaypointId, bool bForwards )
	{
		if ( iWaypointId == 1 )
		{
			/*for( set<Player*>::iterator PlayerIter = _unit->GetInRangePlayerSetBegin(); PlayerIter != _unit->GetInRangePlayerSetEnd(); ++PlayerIter ) 
			{
				(*PlayerIter)->CastSpell( (*PlayerIter), ALGALON_KILLCREDIT, true );
			}*/
			_unit->GetMapMgr()->GetInterface()->SpawnGameObject( UL_GIFT_OF_THE_OBSERVER, AlgalonEndEvent[0].mX, AlgalonEndEvent[0].mY, AlgalonEndEvent[0].mZ, AlgalonEndEvent[0].mO, false, 0, 0, 1 ); 
			//RegisterAIUpdate( 1000 );
			//_unit->CombatStatus.TryToClearAttackTargets();
		};
	};

	void IntroScene()
	{
		if( mScene != 7 )
		{
			switch( mScene )
			{
			case 0:
				_unit->CastSpell( _unit, ALGALON_ARRIVAL, true );
				break;
			case 1:
				Emote( "Translocation complete. Commencing planetary analysis of Azeroth.", Text_Say, UR_ALGALON_SUMMON01 );
				break;
			case 2:
				_unit->Emote( EMOTE_ONESHOT_SPELLCAST_OMNI );
				SpawnCreature( CN_AZEROTH, 1631.762817f, -293.814301f, 417.321106f, 1.573153f );
				break;
			case 3:
				Emote( "Stand back mortals. I am not here to fight you.", Text_Say, UR_ALGALON_SUMMON02 );
				SetFlyMode( false );
				pAzeroth = static_cast<Creature*>( ForceCreatureFind(CN_AZEROTH, 1631.762817f, -293.814301f, 417.321106f ) );
				if( pAzeroth != NULL )
					SetTargetToChannel( pAzeroth, ALGALON_CHANNEL );
				break;
			case 4:
				Emote( "It is in the universe's best interest to re-originate this planet, should my analysis find systemic corruption. Do not interfere.", Text_Say, UR_ALGALON_SUMMON03 );
				break;
			case 5:
				SetTargetToChannel( NULL, 0 );
				pAzeroth->Despawn(0, 0);
				break;
			case 6:
				SetCanEnterCombat( true );
				mIntro = false;
				RemoveAIUpdateEvent();
				break;
			}
			++mScene;
		}
	};

	void StartHandler()
	{
		if( mFirstEncounter )
		{
			Emote( "See your world through my eyes: A universe so vast as to be immeasurable - incomprehensible even to your greatest minds.", Text_Yell, UR_ALGALON_SPACE01 );
			mFirstEncounter = false;
		};

		_unit->SetUInt64Value( UNIT_FIELD_FLAGS, 0 );

		SetAllowMelee( true );
		SetAllowSpell( true );
		SetAllowTargeting( true );
		SetCanMove( true );
		TriggerCooldownOnAllSpells();

		pPlanet = GetNearestGameObject( Doodad_UL_UniverseGlobe_01 );
		if( pPlanet != NULL && pPlanet->GetState() == 1 )
			pPlanet->SetState( 0 );

		pFloor1 = GetNearestGameObject( Doodad_UL_UniverseFloor_01 );
		if( pFloor1 != NULL && pFloor1->GetState() == 0 )
			pFloor1->SetState( 1 );

		pFloor2 = GetNearestGameObject( Doodad_UL_UniverseFloor_02 );
		if( pFloor2 != NULL && pFloor2->GetState() == 1 )
			pFloor2->SetState( 0 );

		pTrapDoor = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords( 1632.324585f, -246.840393f, 417.323151f, Doodad_UL_TrapDoor_03 );
		if( pTrapDoor != NULL && pFloor2->GetState() == 1 )		
			pTrapDoor->SetState( 0 );

		pLimitDoor = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords( 1632.324585f, -246.840393f, 417.323151f, Doodad_UL_SigilDoor_03 );
		if( pLimitDoor != NULL && pFloor2->GetState() == 0 )		
			pLimitDoor->SetState( 1 );

		for( int i=0; i < 3; i++ )
		{
			SpawnCreature( CN_LIVING_CONSTELLATION, LivingConstellationSpawn[i].mX, LivingConstellationSpawn[i].mY, LivingConstellationSpawn[i].mZ, LivingConstellationSpawn[i].mO, 1 );
		};
		
		SetPhase( 2 );
		RemoveTimer( mTimeoutTimer );
	};

	void SummonStars()
	{
		_unit->SendChatMessage(CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, "Algalon the Observer begins to Summon Collapsing Stars!" );
		Emote( "The stars come to my aid.", Text_Yell, UR_ALGALON_ADDS01 );

		uint32 mRandom = 0;
		for( int i = 0; i < 4; i++ )
		{
			mRandom = RandomUInt( 11 );
			SpawnCreature( CN_COLLAPSING_STAR, RoomPoints[mRandom].mX, RoomPoints[mRandom].mY, RoomPoints[mRandom].mZ, 0, true, 1 );
		};			
		ResetTimer( mAddTimer, TIMER_STAR_02 );
	};

	void BigBang()
	{
		if( !_bigBang )
		{
			_unit->CastSpell( _unit, dbcSpell.LookupEntryForced(ALGALON_BIG_BANG_10), false );
			_unit->SendChatMessage(CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, "Algalon the Observer begins to cast Big Bang!" );
			Emote( "Witness the fury of cosmos!", Text_Yell, UR_ALGALON_SPECIAL01 );
			_bigBang = true;
			ResetTimer( mBigBangTimer, TIMER_BIG_BANG_CAST ); //8 seconds cast time
		}
		else
		{
			bool mPhasedPlayer = false;

			for( set<Player*>::iterator PlayerIter = _unit->GetInRangePlayerSetBegin(); PlayerIter != _unit->GetInRangePlayerSetEnd(); ++PlayerIter ) 
			{
				if( (*PlayerIter)->GetPhase() == 1 )
					mPhasedPlayer = true;
				else
					(*PlayerIter)->RemoveAura( BLACK_HOLE_PHASE_AURA );
			}

			if( mPhasedPlayer == false )
			_unit->CastSpell( _unit, ALGALON_ASCEND_TO_HEAVENS, false ); // wipe raid
			_bigBang = false;
			ResetTimer( mBigBangTimer, TIMER_BIG_BANG );
		};
	};

	void PhaseThree()
	{
		DespawnAllEncounterCreatures();
		for( int i = 0; i < 4; ++i )
		{
			SpawnCreature( CN_BLACK_HOLE, BlackHoleSpawns[i].mX,  BlackHoleSpawns[i].mY,  BlackHoleSpawns[i].mZ,  BlackHoleSpawns[i].mO, false );
		};
		Emote("Beware!", Text_Yell, UR_ALGALON_BHOLE01);
		RemoveTimer( mAddTimer );
		RemoveTimer( mBigBangTimer );
		SetPhase( 3 );
	};

	void AddEncounterCreature( Creature* pCreature )
	{
		mEncounterArray.push_back( pCreature );
	};

	void DespawnAllEncounterCreatures()
	{
		for( vector<Creature*>::iterator CreatureIter = mEncounterArray.begin(); CreatureIter != mEncounterArray.end(); ++CreatureIter )
		{
			if( (*CreatureIter) != NULL )
				(*CreatureIter)->Despawn( 0, 0);
		};
		mEncounterArray.clear();
	};

	void Destroy()
	{
		delete this;
	};

	// Vars:
	// Game Objects
	GameObject*		pPlanet; 
	GameObject*		pFloor1;
	GameObject*		pFloor2;
	GameObject*		pTrapDoor;
	GameObject*		pLimitDoor;

	// Spell Desc
	SpellDesc*		mEnrage;

	// Creature pointer
	Creature*		pAzeroth;

	// boolean
	bool			mIntro;
	bool			mFirstEncounter;
	bool			mEndScene;
	bool			_bigBang;

	// counters
	uint32			mScene;
	uint32			mTimer;

	// timers
	int32			mEnrageTimer;
	int32			mAddTimer;
	int32			mTimeoutTimer;
	int32			mBigBangTimer;

private:
	EncounterArray	mEncounterArray;
};

class AlgalonDoorGO : public GameObjectAIScript
{
public:
	AlgalonDoorGO(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
	static GameObjectAIScript *Create(GameObject* GO) { return new AlgalonDoorGO(GO); }

	void OnActivate(Player* pPlayer)
	{
		RegisterAIUpdateEvent( 45000 ); 
		_gameobject->GetMapMgr()->GetInterface()->SpawnCreature( CN_BRANN, BronzebeardWaypoint[0].mX, BronzebeardWaypoint[0].mY, BronzebeardWaypoint[0].mZ, BronzebeardWaypoint[0].mO, true, true, NULL, NULL, 1);
	};
	
	void AIUpdate()
	{
		_gameobject->GetMapMgr()->GetInterface()->SpawnCreature( CN_ALGALON, 1631.954712f, -303.857910f, 417.321167f, 1.482785f, true, true, NULL, NULL, 1);
		_gameobject->Despawn( 1000, 0 );
	};

	void Destroy()
	{
		delete this;
	};
};

class AzerothAI : public CreatureAIScript
{
public:
	ADD_CREATURE_FACTORY_FUNCTION(AzerothAI);
	AzerothAI(Creature* pCreature) : CreatureAIScript(pCreature) {};

	void OnLoad()
	{
		_unit->SetUInt64Value( UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE );
		_unit->GetAIInterface()->SetAllowedToEnterCombat( false );
	};

	void Destroy()
	{
		delete this;
	};
};

class CollapsingStarAI : public MoonScriptCreatureAI
{
	MOONSCRIPT_FACTORY_FUNCTION(CollapsingStarAI, MoonScriptCreatureAI);
	CollapsingStarAI(Creature* pCreature) : MoonScriptCreatureAI(pCreature){}

	void OnLoad()
	{
		RegisterAIUpdateEvent( 1000 );
		_unit->GetAIInterface()->SetAllowedToEnterCombat( false );
		SetAllowTargeting( false );
		uint32 mRandom = RandomUInt(  11 );
		MoveTo(RoomPoints[mRandom].mX, RoomPoints[mRandom].mY, RoomPoints[mRandom].mZ, false);
		mMoveCounter = 0;

		AlgalonAI* mAlgalon = NULL;
		Creature* pAlgalon = static_cast<Creature*>(ForceCreatureFind( CN_ALGALON, 1632.250000f, -307.548004f, 416.264008f));
		if ( pAlgalon != NULL && pAlgalon->GetScript() != NULL )
		{
				mAlgalon = (AlgalonAI*)(pAlgalon->GetScript());
				mAlgalon->AddEncounterCreature( _unit );
		}
		pAlgalon = NULL;
		mAlgalon = NULL;
	};

	void AIUpdate()
	{
		++mMoveCounter;
		uint32 mHealth = _unit->GetUInt32Value(UNIT_FIELD_HEALTH);
		_unit->SetUInt32Value( UNIT_FIELD_HEALTH, mHealth - ( mHealth / 100 ) ); // loose 1 pct every sec
		if(mMoveCounter == 5)
		{
			uint32 mRandom = RandomUInt( 11 );
			MoveTo(RoomPoints[mRandom].mX, RoomPoints[mRandom].mY, RoomPoints[mRandom].mZ, false);
			mMoveCounter = 0;
		};

		ParentClass::AIUpdate();
	};

	void OnDied(Unit* pUnit)
	{
		_unit->CastSpell(_unit, STAR_EXPLODE, true );
		_unit->CastSpell(_unit, STAR_SUMMON_BLACK_HOLE, true );

		CancelAllSpells();
		CancelAllTimers();
		RemoveAllAuras();

		Despawn( 1000, 0 );
	};

	void Destroy()
	{
		delete this;
	};

private:
	uint32	mMoveCounter;
};

class BlackHoleAI : public MoonScriptCreatureAI
{
	MOONSCRIPT_FACTORY_FUNCTION(BlackHoleAI, MoonScriptCreatureAI);
	BlackHoleAI(Creature* pCreature) : MoonScriptCreatureAI(pCreature){}
	
	void OnLoad()
	{
		_unit->SetUInt64Value( UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE );
		_unit->GetAIInterface()->SetAllowedToEnterCombat( false );
		mVoidZone = false;

		Creature* pAlgalon = static_cast<Creature*>(ForceCreatureFind( CN_ALGALON, 1632.250000f, -307.548004f, 416.264008f));
		AlgalonAI* mAlgalon = NULL;
		if ( pAlgalon != NULL && pAlgalon->GetScript() != NULL )
		{
				mAlgalon = (AlgalonAI*)(pAlgalon->GetScript());
				mAlgalon->AddEncounterCreature( _unit );
				if( mAlgalon->GetPhase() == 3 )
					mPhaseTwo = true;
		}
		pAlgalon = NULL;
		mAlgalon = NULL;

		RegisterAIUpdateEvent( 100 );
	};

	void AIUpdate()
	{
		Unit* pPlayer = GetNearestPlayer();
		if( pPlayer != NULL && pPlayer->isAlive() == true && pPlayer->GetDistance2dSq(static_cast<Object*>(_unit)) <= 3.5f )
		{
			if( !pPlayer->HasAura( BLACK_HOLE_PHASE_AURA ) )
			{
				_unit->CastSpell( pPlayer, BLACK_HOLE_DAMAGE_AURA, true);
				pPlayer->CastSpell( pPlayer, BLACK_HOLE_PHASE_AURA, true);
			}
		};
		
		Creature* pLivingConstellation = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(_unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), CN_LIVING_CONSTELLATION);
		if( pLivingConstellation != NULL && pLivingConstellation->GetDistance2dSq(static_cast<Object*>(_unit)) <= 3.5f )
		{
			pLivingConstellation->Despawn( 0, 0 );
			Despawn();
		};

		if( mPhaseTwo )
			mSummonTimer = AddTimer( TIMER_SUMMON_DARK_MATTER );
		
		if( IsTimerFinished( mSummonTimer ) )
		{
			SpawnCreature( CN_UNLEASEHED_DARK_MATTER );
			ResetTimer( mSummonTimer, TIMER_SUMMON_DARK_MATTER );
		}

		if( !mVoidZone )
			ApplyAura( BLACK_HOLE_VISUAL_VOID_ZONE );
	};

	void Destroy()
	{
		delete this;
	};

private:
	bool		mVoidZone;
	bool		mPhaseTwo;

	int32		mSummonTimer;
};

class LivingConstellationAI : public MoonScriptBossAI
{
	MOONSCRIPT_FACTORY_FUNCTION(LivingConstellationAI, MoonScriptBossAI);
	LivingConstellationAI(Creature* pCreature) : MoonScriptBossAI(pCreature)
	{
		AddPhaseSpell( 2, AddSpell( ARCANE_BARRAGE, Target_RandomPlayer, 100, 2, 5, 0, 60 ) );

		SetFlyMode( true );
		SetCanEnterCombat( false );
		SetAllowMelee( false );
		SetAllowSpell( false );
		SetAllowTargeting( false);
		SetCanMove( false );
	};

	void OnLoad()
	{
		Creature* pAlgalon = static_cast<Creature*>(ForceCreatureFind( CN_ALGALON, 1632.250000f, -307.548004f, 416.264008f));
		AlgalonAI* mAlgalon = NULL;
		if ( pAlgalon != NULL && pAlgalon->GetScript() != NULL )
		{
				mAlgalon = (AlgalonAI*)(pAlgalon->GetScript());
				mAlgalon->AddEncounterCreature( _unit );
		}
		pAlgalon = NULL;
		mAlgalon = NULL;

		SetPhase( 1 );
		mJoinTimer = AddTimer( TIMER_LIVING_CONSTELLATION_JOIN );
		RegisterAIUpdateEvent( 1000 );
	};

	void AIUpdate()
	{
		if( GetPhase() == 1 )
		{
			if( IsTimerFinished( mJoinTimer ) )
			{
				SpawnCreature( CN_LIVING_CONSTELLATION );
				RemoveTimer( mJoinTimer );

				SetCanEnterCombat( true );
				SetAllowSpell( true );
				SetAllowTargeting( true );
				SetCanMove( true );
				SetPhase( 2 );
				
				uint32 mRandom = RandomUInt( 2 );
				AddWaypoint( CreateWaypoint( 1, 0, Flag_Fly, LivingConstellationWP[mRandom] ) );
				ForceWaypointMove( 1 );		
			}
		};

		ParentClass::AIUpdate();
	};

	void OnDied(Unit* pKiller)
	{
		Despawn( 1000, 0 );
	};

	void OnReachWP(uint32 iWaypoinyId, bool bForwards)
	{
		if( !IsInCombat() )
			AggroNearestPlayer(1);
	};

	void Destroy()
	{
		delete this;
	};

	int32		mJoinTimer;
};

class BrannBronzebeardAI : public MoonScriptCreatureAI
{
	MOONSCRIPT_FACTORY_FUNCTION(BrannBronzebeardAI, MoonScriptCreatureAI);
	BrannBronzebeardAI(Creature* pCreature) : MoonScriptCreatureAI(pCreature){}
	
	void OnLoad()
	{
		mScene = 0;
		RegisterAIUpdateEvent( 8000 );
	};

	void OnReachWP(uint32 iWaypointId, bool bForwards)
	{
		if(iWaypointId == 1)
		{
			Emote( "We did it lads! We got here before Algalon's arrival! Maybe we can rig the systems to interfere with his analysis.", Text_Yell, UR_BRANN_ALGALONSUMMONED01);
			_unit->Emote(EMOTE_ONESHOT_TALK);
			RegisterAIUpdateEvent(8000);
		}
	};

	void AIUpdate()
	{
		if(mScene == 0)
		{
			for( int i=0; i < 2; i++ )
			{
				AddWaypoint(CreateWaypoint( i, 0, Flag_Walk, BronzebeardWaypoint[i]));
			}
			++mScene;
			ForceWaypointMove(1);
			RemoveAIUpdateEvent();
		}
		else if( mScene == 1)
		{
			Emote( "I'll head back to the Archivum and see if I can jam his signal. I might be able to buy us some time while you take care of him.", Text_Yell, UR_BRANN_ALGALONSUMMONED02);
			_unit->Emote(EMOTE_ONESHOT_TALK);
			RemoveAIUpdateEvent();
			Despawn();
		}
	};

	void Destroy()
	{
		delete this;
	};

private:
	int32 mScene;
};

class UnleashedDarkMatterAI : public MoonScriptCreatureAI
{
	MOONSCRIPT_FACTORY_FUNCTION(UnleashedDarkMatterAI, MoonScriptCreatureAI);
	UnleashedDarkMatterAI(Creature* pCreature) : MoonScriptCreatureAI(pCreature){}

	void OnLoad()
	{
		Creature* pAlgalon = static_cast<Creature*>(ForceCreatureFind( CN_ALGALON, 1632.250000f, -307.548004f, 416.264008f));
		AlgalonAI* mAlgalon = NULL;
		if ( pAlgalon != NULL && pAlgalon->GetScript() != NULL )
		{
				mAlgalon = (AlgalonAI*)(pAlgalon->GetScript());
				mAlgalon->AddEncounterCreature( _unit );
		}
		pAlgalon = NULL;
		mAlgalon = NULL;
	};
};

class PhasePunchAI  : public SpellScript
{
public:
	ADD_SPELL_FACTORY_FUNCTION(PhasePunchAI);
	PhasePunchAI(Spell* spellinstance) : SpellScript(spellinstance) {};

	void OnCast() 
	{
		if( _spell->GetUnitTarget() && _spell->GetUnitTarget()->IsPlayer())
		{
			Player* pVictim = static_cast<Player*>(_spell->GetUnitTarget());
			if ( pVictim->GetAuraStackCount( ALGALON_PHASE_PUNCH ) == 5 )
			{
					pVictim->RemoveAllAuraById( ALGALON_PHASE_PUNCH );
					Aura* pAura = new Aura( dbcSpell.LookupEntryForced(BLACK_HOLE_PHASE_AURA), 10000, pVictim, pVictim, true);
					if( pAura != NULL )	
						pVictim->AddAura(pAura, NULL);
			};
		}
	};
};

void SetupAlgalon(ScriptMgr * mgr)
{
	mgr->register_creature_script( CN_ALGALON, &AlgalonAI::Create);
	mgr->register_creature_script( CN_AZEROTH, &AzerothAI::Create);
	mgr->register_creature_script( CN_COLLAPSING_STAR, &CollapsingStarAI::Create);
	mgr->register_creature_script( CN_BLACK_HOLE, &BlackHoleAI::Create);
	mgr->register_creature_script( CN_BRANN, &BrannBronzebeardAI::Create);
	mgr->register_creature_script( CN_LIVING_CONSTELLATION, &LivingConstellationAI::Create);
	mgr->register_creature_script( CN_UNLEASEHED_DARK_MATTER, &UnleashedDarkMatterAI::Create );

	mgr->register_gameobject_script( Doodad_UL_SigilDoor_01, &AlgalonDoorGO::Create);

	//mgr->register_spell_script( ALGALON_PHASE_PUNCH, &PhasePunchAI::Create);
};


Please report BUGS and CRASHES here, i am using WhyDB, i will add queries tomorrow!
This is still WIP-Work in Progress!
Credits: Me-Azolex.
Posted Image
0

#2 User is offline   Darren 

  • Occasional Poster
  • PipPip
  • Group: Members
  • Posts: 104
  • Joined: 18-June 08

Posted 15 November 2009 - 01:45 PM

Trying to do this guy in lua, just stuck on BH's and Collapsing stars.
Nice though.
0

#3 User is offline   eatos92 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 193
  • Joined: 06-May 09
  • Gender:Male
  • Location:Serbia, Devil WoW

Posted 01 December 2009 - 07:35 AM

poz za srpskog developera
Posted Image
0

#4 User is offline   suchASunthan 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 246
  • Joined: 29-November 08
  • Gender:Male
  • Location:Frankfurt
  • Interests:Vcpp, vb, sql, all programmlanguages
    more informations >:-]

Posted 11 December 2009 - 11:14 AM

EDIT: No Errors.
Koninzidenz begründet keine Korrelation und ist kein Beweis für Kausalität!

coincidence causes no correlation and in´t a argument for causality!

Posted Image
Posted Image
0

#5 User is offline   suchASunthan 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 246
  • Joined: 29-November 08
  • Gender:Male
  • Location:Frankfurt
  • Interests:Vcpp, vb, sql, all programmlanguages
    more informations >:-]

Posted 02 February 2010 - 04:36 PM

is it still @ developing? i see much more things at your video by mmo. do you add it to arcscripts?
Koninzidenz begründet keine Korrelation und ist kein Beweis für Kausalität!

coincidence causes no correlation and in´t a argument for causality!

Posted Image
Posted Image
0

#6 User is offline   Ogchaos 

  • Interested
  • PipPipPipPip
  • Group: Members
  • Posts: 404
  • Joined: 30-September 09

Posted 03 February 2010 - 04:07 PM

Bump, hows this coming?
0

#7 User is offline   Dzjhenghiz 

  • حشّاشين
  • Group: Contributor
  • Posts: 1,936
  • Joined: 07-June 08
  • Gender:Male
  • Location:2nd stone after the 3rd oase western sahara
  • Interests:M.C.S.E :- Minesweeper Consultant & Solitaire Expert
  • Server OS:Other

Posted 03 February 2010 - 05:01 PM

Think the same as the others, its lying there waiting to get finished ?
Need Help With Arcemu ? ^^
Posted Image
Concordia res parvae crescunt In varietate concordia
Spoiler

0

#8 User is offline   Azolex 

  • Member
  • Group: Contributor
  • Posts: 54
  • Joined: 08-August 08
  • Gender:Male
  • Location:Serbia
  • Interests:Music, Computers, School and Girls!

Posted 05 February 2010 - 06:05 AM

Kind of lol
Posted Image
0

#9 User is offline   Dzjhenghiz 

  • حشّاشين
  • Group: Contributor
  • Posts: 1,936
  • Joined: 07-June 08
  • Gender:Male
  • Location:2nd stone after the 3rd oase western sahara
  • Interests:M.C.S.E :- Minesweeper Consultant & Solitaire Expert
  • Server OS:Other

Posted 05 February 2010 - 07:01 AM

Its kinda sad imo.

OP date : Posted 15 November 2009 - 12:01 AM

And is it Finished ? samne for icecrown Quest, all commits you make needs two / three more. Now in Borean tundra is still a warning (after two commits already)

Idk but testing what u created might be an idea ?
Need Help With Arcemu ? ^^
Posted Image
Concordia res parvae crescunt In varietate concordia
Spoiler

0

#10 User is offline   suchASunthan 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 246
  • Joined: 29-November 08
  • Gender:Male
  • Location:Frankfurt
  • Interests:Vcpp, vb, sql, all programmlanguages
    more informations >:-]

Posted 16 February 2010 - 07:04 AM

actually arcemu revision (3173) i�ve got these errors:

7>..\src\InstanceScripts\Algalon.cpp(409) : error C2440: 'Initialisierung': 'std::_Tree<_Traits>::iterator' kann nicht in 'std::_Tree<_Traits>::iterator' konvertiert werden
7>        with
7>        [
7>            _Traits=std::_Tset_traits<Object *,std::less<Object *>,std::allocator<Object *>,false>
7>        ]
7>        and
7>        [
7>            _Traits=std::_Tset_traits<Player *,std::less<Player *>,std::allocator<Player *>,false>
7>        ]
7>        Quelltyp konnte von keinem Konstruktor angenommen werden, oder die �berladungsaufl�sung des Konstruktors ist mehrdeutig
7>..\src\InstanceScripts\Algalon.cpp(409) : error C2678: Bin�rer Operator '!=': Es konnte kein Operator gefunden werden, der einen linksseitigen Operanden vom Typ 'std::_Tree<_Traits>::iterator' akzeptiert (oder keine geeignete Konvertierung m�glich)
7>        with
7>        [
7>            _Traits=std::_Tset_traits<Player *,std::less<Player *>,std::allocator<Player *>,false>
7>        ]
7>        C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\guiddef.h(197): kann 'int operator !=(const GUID &,const GUID &)' sein
7>        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xtree(314): oder "bool std::_Tree<_Traits>::const_iterator::operator !=(const std::_Tree<_Traits>::const_iterator &) const"
7>        with
7>        [
7>            _Traits=std::_Tset_traits<Player *,std::less<Player *>,std::allocator<Player *>,false>
7>        ]
7>        bei Anpassung der Argumentliste '(std::_Tree<_Traits>::iterator, std::_Tree<_Traits>::iterator)'
7>        with
7>        [
7>            _Traits=std::_Tset_traits<Player *,std::less<Player *>,std::allocator<Player *>,false>
7>        ]
7>        and
7>        [
7>            _Traits=std::_Tset_traits<Object *,std::less<Object *>,std::allocator<Object *>,false>
7>        ]
7>..\src\InstanceScripts\Algalon.cpp(810) : error C2504: 'SpellScript': Basisklasse undefiniert
7>..\src\InstanceScripts\Algalon.cpp(812) : error C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht unterst�tzt.
7>..\src\InstanceScripts\Algalon.cpp(812) : warning C4183: 'ADD_SPELL_FACTORY_FUNCTION': R�ckgabetyp fehlt; Memberfunktion, die 'int' zur�ckgibt wird angenommen
7>..\src\InstanceScripts\Algalon.cpp(813) : error C2614: 'PhasePunchAI': Unzul�ssige Elementinitialisierung: 'SpellScript' ist weder Basis noch Element
7>..\src\InstanceScripts\Algalon.cpp(817) : error C2065: '_spell': nichtdeklarierter Bezeichner
7>..\src\InstanceScripts\Algalon.cpp(817) : error C2227: Links von "->GetUnitTarget" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden.
7>        Typ ist ''unknown-type''
7>..\src\InstanceScripts\Algalon.cpp(817) : error C2065: '_spell': nichtdeklarierter Bezeichner
7>..\src\InstanceScripts\Algalon.cpp(817) : error C2227: Links von "->GetUnitTarget" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden.
7>        Typ ist ''unknown-type''
7>..\src\InstanceScripts\Algalon.cpp(817) : error C2227: Links von "->IsPlayer" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden.
7>..\src\InstanceScripts\Algalon.cpp(819) : error C2065: '_spell': nichtdeklarierter Bezeichner
7>..\src\InstanceScripts\Algalon.cpp(819) : error C2227: Links von "->GetUnitTarget" muss sich ein Zeiger auf Klassen-/Struktur-/Union-/generischen Typ befinden.
7>        Typ ist ''unknown-type''
7>..\src\InstanceScripts\Algalon.cpp(825) : error C2660: 'Unit::AddAura': Funktion akzeptiert keine 2 Argumente


commiting the spell script and change the loop in line 409 to 415 ->
 for( set<Object*>::iterator PlayerIter = _unit->GetInRangePlayerSetBegin(); PlayerIter != _unit->GetInRangePlayerSetEnd(); ++PlayerIter ) 
                        {
                                if( (*PlayerIter)->GetPhase() == 1 )
                                        mPhasedPlayer = true;
                                else
                                        (static_cast< Player* >(*PlayerIter))->RemoveAura(BLACK_HOLE_PHASE_AURA);
                        }

should work the script

when does arc support spellscripts?
Koninzidenz begründet keine Korrelation und ist kein Beweis für Kausalität!

coincidence causes no correlation and in´t a argument for causality!

Posted Image
Posted Image
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users