2010-07-06 03:27:41 +02:00
/*
2011-01-01 15:01:13 +01:00
* Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
2010-07-06 03:27:41 +02:00
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
2008-10-21 13:19:26 -05:00
*
2010-07-06 03:27:41 +02:00
* 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 2 of the License, or (at your
* option) any later version.
2008-10-21 13:19:26 -05:00
*
2010-07-06 03:27:41 +02:00
* 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/>.
2008-10-21 13:19:26 -05:00
*/
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/* ScriptData
SDName: Guards
SD%Complete: 100
SDComment: All Guard gossip data, quite some npc_text-id's still missing, adding constantly as new id's are known. CombatAI should be organized better for future.
SDCategory: Guards
EndScriptData */
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/* ContentData
2010-05-26 20:03:40 +02:00
guard_generic
2008-10-21 13:19:26 -05:00
guard_orgrimmar
guard_shattrath_aldor
guard_shattrath_scryer
guard_stormwind
EndContentData */
2009-10-17 15:51:44 -07:00
2010-06-08 23:44:55 +02:00
#include "ScriptPCH.h"
2010-01-19 11:36:05 +01:00
#include "ScriptedGuardAI.h"
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/*******************************************************
2010-05-26 20:03:40 +02:00
* guard_generic
2008-10-21 13:19:26 -05:00
*******************************************************/
2009-10-17 15:51:44 -07:00
2010-08-06 17:07:41 -07:00
class guard_generic : public CreatureScript
2008-10-21 13:19:26 -05:00
{
2010-08-06 17:07:41 -07:00
public :
guard_generic () : CreatureScript ( "guard_generic" ) { }
2010-08-07 13:46:08 +02:00
CreatureAI * GetAI ( Creature * creature ) const
2010-08-06 17:07:41 -07:00
{
return new guardAI ( creature );
}
};
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/*******************************************************
2010-05-26 20:03:40 +02:00
* guard_orgrimmar
2008-10-21 13:19:26 -05:00
*******************************************************/
2009-10-17 15:51:44 -07:00
2010-08-06 17:07:41 -07:00
class guard_orgrimmar : public CreatureScript
2008-10-21 13:19:26 -05:00
{
2010-08-06 17:07:41 -07:00
public :
guard_orgrimmar () : CreatureScript ( "guard_orgrimmar" ) { }
2010-08-07 13:46:08 +02:00
CreatureAI * GetAI ( Creature * creature ) const
2010-08-06 17:07:41 -07:00
{
return new guardAI_orgrimmar ( creature );
}
};
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/*******************************************************
* guard_shattrath_aldor
*******************************************************/
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
#define SPELL_BANISHED_SHATTRATH_A 36642
#define SPELL_BANISHED_SHATTRATH_S 36671
#define SPELL_BANISH_TELEPORT 36643
#define SPELL_EXILE 39533
2009-10-17 15:51:44 -07:00
2010-08-06 17:07:41 -07:00
class guard_shattrath_aldor : public CreatureScript
2008-10-21 13:19:26 -05:00
{
2010-08-06 17:07:41 -07:00
public :
guard_shattrath_aldor () : CreatureScript ( "guard_shattrath_aldor" ) { }
2009-10-17 15:51:44 -07:00
2010-08-06 17:07:41 -07:00
struct guard_shattrath_aldorAI : public guardAI
2008-10-21 13:19:26 -05:00
{
2010-08-06 17:07:41 -07:00
guard_shattrath_aldorAI ( Creature * c ) : guardAI ( c ) {}
2009-10-17 15:51:44 -07:00
2010-08-06 17:07:41 -07:00
uint32 Exile_Timer ;
uint32 Banish_Timer ;
uint64 PlayerGUID ;
bool CanTeleport ;
2009-10-17 15:51:44 -07:00
2010-08-06 17:07:41 -07:00
void Reset ()
{
Banish_Timer = 5000 ;
Exile_Timer = 8500 ;
PlayerGUID = 0 ;
CanTeleport = false ;
}
2009-10-17 15:51:44 -07:00
2010-08-06 17:07:41 -07:00
void EnterCombat ( Unit * /*who*/ ) {}
void UpdateAI ( const uint32 diff )
2008-10-21 13:19:26 -05:00
{
2010-08-06 17:07:41 -07:00
if ( ! UpdateVictim ())
return ;
if ( CanTeleport )
{
if ( Exile_Timer <= diff )
{
if ( Unit * temp = Unit :: GetUnit ( * me , PlayerGUID ))
{
temp -> CastSpell ( temp , SPELL_EXILE , true );
temp -> CastSpell ( temp , SPELL_BANISH_TELEPORT , true );
}
PlayerGUID = 0 ;
Exile_Timer = 8500 ;
CanTeleport = false ;
} else Exile_Timer -= diff ;
}
else if ( Banish_Timer <= diff )
2008-10-21 13:19:26 -05:00
{
2010-08-06 17:07:41 -07:00
Unit * temp = me -> getVictim ();
if ( temp && temp -> GetTypeId () == TYPEID_PLAYER )
2008-10-21 13:19:26 -05:00
{
2010-08-06 17:07:41 -07:00
DoCast ( temp , SPELL_BANISHED_SHATTRATH_A );
Banish_Timer = 9000 ;
PlayerGUID = temp -> GetGUID ();
if ( PlayerGUID )
CanTeleport = true ;
2008-10-21 13:19:26 -05:00
}
2010-08-06 17:07:41 -07:00
} else Banish_Timer -= diff ;
DoMeleeAttackIfReady ();
2008-10-21 13:19:26 -05:00
}
2010-08-06 17:07:41 -07:00
};
2009-10-17 15:51:44 -07:00
2010-08-07 13:46:08 +02:00
CreatureAI * GetAI ( Creature * creature ) const
2010-08-06 17:07:41 -07:00
{
return new guard_shattrath_aldorAI ( creature );
2010-05-26 20:03:40 +02:00
}
};
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/*******************************************************
* guard_shattrath_scryer
*******************************************************/
2009-10-17 15:51:44 -07:00
2010-08-06 17:07:41 -07:00
class guard_shattrath_scryer : public CreatureScript
2008-10-21 13:19:26 -05:00
{
2010-08-06 17:07:41 -07:00
public :
guard_shattrath_scryer () : CreatureScript ( "guard_shattrath_scryer" ) { }
2009-10-17 15:51:44 -07:00
2010-08-06 17:07:41 -07:00
struct guard_shattrath_scryerAI : public guardAI
2008-10-21 13:19:26 -05:00
{
2010-08-06 17:07:41 -07:00
guard_shattrath_scryerAI ( Creature * c ) : guardAI ( c ) {}
2009-10-17 15:51:44 -07:00
2010-08-06 17:07:41 -07:00
uint32 Exile_Timer ;
uint32 Banish_Timer ;
uint64 PlayerGUID ;
bool CanTeleport ;
2009-10-17 15:51:44 -07:00
2010-08-06 17:07:41 -07:00
void Reset ()
{
Banish_Timer = 5000 ;
Exile_Timer = 8500 ;
PlayerGUID = 0 ;
CanTeleport = false ;
}
2009-10-17 15:51:44 -07:00
2010-08-06 17:07:41 -07:00
void EnterCombat ( Unit * /*who*/ ) {}
void UpdateAI ( const uint32 diff )
2008-10-21 13:19:26 -05:00
{
2010-08-06 17:07:41 -07:00
if ( ! UpdateVictim ())
return ;
if ( CanTeleport )
{
if ( Exile_Timer <= diff )
{
if ( Unit * temp = Unit :: GetUnit ( * me , PlayerGUID ))
{
temp -> CastSpell ( temp , SPELL_EXILE , true );
temp -> CastSpell ( temp , SPELL_BANISH_TELEPORT , true );
}
PlayerGUID = 0 ;
Exile_Timer = 8500 ;
CanTeleport = false ;
} else Exile_Timer -= diff ;
}
else if ( Banish_Timer <= diff )
2008-10-21 13:19:26 -05:00
{
2010-08-06 17:07:41 -07:00
Unit * temp = me -> getVictim ();
if ( temp && temp -> GetTypeId () == TYPEID_PLAYER )
2008-10-21 13:19:26 -05:00
{
2010-08-06 17:07:41 -07:00
DoCast ( temp , SPELL_BANISHED_SHATTRATH_S );
Banish_Timer = 9000 ;
PlayerGUID = temp -> GetGUID ();
if ( PlayerGUID )
CanTeleport = true ;
2008-10-21 13:19:26 -05:00
}
2010-08-06 17:07:41 -07:00
} else Banish_Timer -= diff ;
DoMeleeAttackIfReady ();
2008-10-21 13:19:26 -05:00
}
2010-08-06 17:07:41 -07:00
};
2009-10-17 15:51:44 -07:00
2010-08-07 13:46:08 +02:00
CreatureAI * GetAI ( Creature * creature ) const
2010-08-06 17:07:41 -07:00
{
return new guard_shattrath_scryerAI ( creature );
2008-10-21 13:19:26 -05:00
}
};
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/*******************************************************
2010-05-26 20:03:40 +02:00
* guard_stormwind
2008-10-21 13:19:26 -05:00
*******************************************************/
2009-10-17 15:51:44 -07:00
2010-08-06 17:07:41 -07:00
class guard_stormwind : public CreatureScript
2008-10-21 13:19:26 -05:00
{
2010-08-06 17:07:41 -07:00
public :
guard_stormwind () : CreatureScript ( "guard_stormwind" ) { }
2010-08-07 13:46:08 +02:00
CreatureAI * GetAI ( Creature * creature ) const
2010-08-06 17:07:41 -07:00
{
return new guardAI_stormwind ( creature );
}
};
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/*******************************************************
* AddSC
*******************************************************/
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
void AddSC_guards ()
{
2010-08-06 17:07:41 -07:00
new guard_generic ;
new guard_orgrimmar ;
new guard_shattrath_aldor ;
new guard_shattrath_scryer ;
new guard_stormwind ;
2008-10-21 13:19:26 -05:00
}