2010-07-06 03:27:41 +02:00
/*
2017-01-01 16:21:30 +01:00
* Copyright (C) 2008-2017 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: Zangarmarsh
SD%Complete: 100
2009-06-15 01:59:46 +02:00
SDComment: Quest support: 9752, 9785, 9803, 10009. Mark Of ... buffs.
2008-10-21 13:19:26 -05:00
SDCategory: Zangarmarsh
EndScriptData */
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/* ContentData
npcs_ashyen_and_keleth
npc_cooshcoosh
npc_elder_kuruti
2009-01-09 23:56:25 +01:00
npc_kayra_longmane
2008-10-21 13:19:26 -05:00
EndContentData */
2009-10-17 15:51:44 -07:00
2012-07-29 21:40:10 +02:00
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
2010-01-19 11:36:05 +01:00
#include "ScriptedEscortAI.h"
2012-11-17 05:18:37 +01:00
#include "Player.h"
2012-11-20 14:54:33 +01:00
#include "WorldSession.h"
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/*######
## npcs_ashyen_and_keleth
######*/
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
#define GOSSIP_ITEM_BLESS_ASH "Grant me your mark, wise ancient."
#define GOSSIP_ITEM_BLESS_KEL "Grant me your mark, mighty ancient."
2012-12-07 10:04:40 +01:00
enum AshyenAndKeleth
{
NPC_ASHYEN = 17900 ,
NPC_KELETH = 17901 ,
SPELL_BLESS_ASH_EXA = 31815 ,
SPELL_BLESS_ASH_REV = 31811 ,
SPELL_BLESS_ASH_HON = 31810 ,
SPELL_BLESS_ASH_FRI = 31808 ,
SPELL_BLESS_KEL_EXA = 31814 ,
SPELL_BLESS_KEL_REV = 31813 ,
SPELL_BLESS_KEL_HON = 31812 ,
SPELL_BLESS_KEL_FRI = 31807
};
2009-10-17 15:51:44 -07:00
2010-08-07 13:04:00 +06:00
class npcs_ashyen_and_keleth : public CreatureScript
2008-10-21 13:19:26 -05:00
{
2010-08-07 13:04:00 +06:00
public :
npcs_ashyen_and_keleth () : CreatureScript ( "npcs_ashyen_and_keleth" ) { }
2014-04-29 16:35:11 +02:00
bool OnGossipHello ( Player * player , Creature * creature ) override
2008-10-21 13:19:26 -05:00
{
2011-07-02 22:52:42 +02:00
if ( player -> GetReputationRank ( 942 ) > REP_NEUTRAL )
2010-08-07 13:04:00 +06:00
{
2012-12-07 10:04:40 +01:00
if ( creature -> GetEntry () == NPC_ASHYEN )
2016-08-31 00:59:04 +02:00
AddGossipItemFor ( player , GOSSIP_ICON_CHAT , GOSSIP_ITEM_BLESS_ASH , GOSSIP_SENDER_MAIN , GOSSIP_ACTION_INFO_DEF + 1 );
2012-03-28 11:13:37 +08:00
2012-12-07 10:04:40 +01:00
if ( creature -> GetEntry () == NPC_KELETH )
2016-08-31 00:59:04 +02:00
AddGossipItemFor ( player , GOSSIP_ICON_CHAT , GOSSIP_ITEM_BLESS_KEL , GOSSIP_SENDER_MAIN , GOSSIP_ACTION_INFO_DEF + 1 );
2010-08-07 13:04:00 +06:00
}
2016-08-31 00:59:04 +02:00
SendGossipMenuFor ( player , player -> GetGossipTextId ( creature ), creature -> GetGUID ());
2009-10-17 15:51:44 -07:00
2010-08-07 13:04:00 +06:00
return true ;
}
2009-10-17 15:51:44 -07:00
2014-04-29 16:35:11 +02:00
bool OnGossipSelect ( Player * player , Creature * creature , uint32 /*sender*/ , uint32 action ) override
2008-10-21 13:19:26 -05:00
{
2016-08-31 00:59:04 +02:00
ClearGossipMenuFor ( player );
2012-03-07 14:08:30 +01:00
if ( action == GOSSIP_ACTION_INFO_DEF + 1 )
2008-10-21 13:19:26 -05:00
{
2011-07-02 22:18:03 +02:00
creature -> setPowerType ( POWER_MANA );
creature -> SetMaxPower ( POWER_MANA , 200 ); //set a "fake" mana value, we can't depend on database doing it in this case
creature -> SetPower ( POWER_MANA , 200 );
2010-08-07 13:04:00 +06:00
2012-12-07 10:04:40 +01:00
if ( creature -> GetEntry () == NPC_ASHYEN ) //check which Creature we are dealing with
2010-08-07 13:04:00 +06:00
{
2012-12-07 10:04:40 +01:00
uint32 spell = 0 ;
2011-07-02 22:52:42 +02:00
switch ( player -> GetReputationRank ( 942 ))
2010-08-07 13:04:00 +06:00
{ //mark of lore
case REP_FRIENDLY :
2012-12-07 10:04:40 +01:00
spell = SPELL_BLESS_ASH_FRI ;
2010-08-07 13:04:00 +06:00
break ;
case REP_HONORED :
2012-12-07 10:04:40 +01:00
spell = SPELL_BLESS_ASH_HON ;
2010-08-07 13:04:00 +06:00
break ;
case REP_REVERED :
2012-12-07 10:04:40 +01:00
spell = SPELL_BLESS_ASH_REV ;
2010-08-07 13:04:00 +06:00
break ;
case REP_EXALTED :
2012-12-07 10:04:40 +01:00
spell = SPELL_BLESS_ASH_EXA ;
2010-08-07 13:04:00 +06:00
break ;
2010-08-24 14:44:56 +02:00
default :
break ;
2010-08-07 13:04:00 +06:00
}
2012-12-07 10:04:40 +01:00
if ( spell )
{
creature -> CastSpell ( player , spell , true );
}
2008-10-21 13:19:26 -05:00
}
2009-10-17 15:51:44 -07:00
2012-12-07 10:04:40 +01:00
if ( creature -> GetEntry () == NPC_KELETH )
2008-10-21 13:19:26 -05:00
{
2012-12-07 10:04:40 +01:00
uint32 spell = 0 ;
2011-07-02 22:52:42 +02:00
switch ( player -> GetReputationRank ( 942 )) //mark of war
2010-08-07 13:04:00 +06:00
{
case REP_FRIENDLY :
2012-12-07 10:04:40 +01:00
spell = SPELL_BLESS_KEL_FRI ;
2010-08-07 13:04:00 +06:00
break ;
case REP_HONORED :
2012-12-07 10:04:40 +01:00
spell = SPELL_BLESS_KEL_HON ;
2010-08-07 13:04:00 +06:00
break ;
case REP_REVERED :
2012-12-07 10:04:40 +01:00
spell = SPELL_BLESS_KEL_REV ;
2010-08-07 13:04:00 +06:00
break ;
case REP_EXALTED :
2012-12-07 10:04:40 +01:00
spell = SPELL_BLESS_KEL_EXA ;
2010-08-07 13:04:00 +06:00
break ;
2010-08-24 14:44:56 +02:00
default :
break ;
2010-08-07 13:04:00 +06:00
}
2012-12-07 10:04:40 +01:00
if ( spell )
{
creature -> CastSpell ( player , spell , true );
}
2008-10-21 13:19:26 -05:00
}
2016-08-31 00:59:04 +02:00
CloseGossipMenuFor ( player );
2011-07-02 22:52:42 +02:00
player -> TalkedToCreature ( creature -> GetEntry (), creature -> GetGUID ());
2008-10-21 13:19:26 -05:00
}
2010-08-07 13:04:00 +06:00
return true ;
2008-10-21 13:19:26 -05:00
}
2010-08-07 13:04:00 +06:00
};
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/*######
## npc_cooshcoosh
######*/
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
#define GOSSIP_COOSH "You owe Sim'salabim money. Hand them over or die!"
2009-10-17 15:51:44 -07:00
2013-07-06 01:00:05 +02:00
enum Cooshhooosh
2009-06-19 00:22:19 +02:00
{
SPELL_LIGHTNING_BOLT = 9532 ,
QUEST_CRACK_SKULLS = 10009 ,
FACTION_HOSTILE_CO = 45
};
2009-10-17 15:51:44 -07:00
2010-08-07 13:04:00 +06:00
class npc_cooshcoosh : public CreatureScript
2008-10-21 13:19:26 -05:00
{
2010-08-07 13:04:00 +06:00
public :
npc_cooshcoosh () : CreatureScript ( "npc_cooshcoosh" ) { }
2009-10-17 15:51:44 -07:00
2010-08-07 13:04:00 +06:00
struct npc_cooshcooshAI : public ScriptedAI
2008-10-21 13:19:26 -05:00
{
2012-03-14 09:20:36 +08:00
npc_cooshcooshAI ( Creature * creature ) : ScriptedAI ( creature )
2010-08-07 13:04:00 +06:00
{
2012-03-14 09:20:36 +08:00
m_uiNormFaction = creature -> getFaction ();
2014-08-31 20:12:47 +02:00
Initialize ();
}
void Initialize ()
{
LightningBolt_Timer = 2000 ;
2010-08-07 13:04:00 +06:00
}
2009-10-17 15:51:44 -07:00
2010-08-07 13:04:00 +06:00
uint32 m_uiNormFaction ;
uint32 LightningBolt_Timer ;
2009-10-17 15:51:44 -07:00
2014-04-29 16:35:11 +02:00
void Reset () override
2010-08-07 13:04:00 +06:00
{
2014-08-31 20:12:47 +02:00
Initialize ();
2010-08-07 13:04:00 +06:00
if ( me -> getFaction () != m_uiNormFaction )
me -> setFaction ( m_uiNormFaction );
}
2014-04-29 16:35:11 +02:00
void EnterCombat ( Unit * /*who*/ ) override { }
2009-10-17 15:51:44 -07:00
2014-04-29 16:35:11 +02:00
void UpdateAI ( uint32 diff ) override
2008-10-21 13:19:26 -05:00
{
2010-08-07 13:04:00 +06:00
if ( ! UpdateVictim ())
return ;
2009-10-17 15:51:44 -07:00
2010-08-07 13:04:00 +06:00
if ( LightningBolt_Timer <= diff )
{
2013-06-22 16:53:13 +02:00
DoCastVictim ( SPELL_LIGHTNING_BOLT );
2010-08-07 13:04:00 +06:00
LightningBolt_Timer = 5000 ;
} else LightningBolt_Timer -= diff ;
2009-10-17 15:51:44 -07:00
2010-08-07 13:04:00 +06:00
DoMeleeAttackIfReady ();
}
};
2009-10-17 15:51:44 -07:00
2014-04-29 16:35:11 +02:00
CreatureAI * GetAI ( Creature * creature ) const override
2010-08-07 13:04:00 +06:00
{
2013-07-08 21:15:23 +02:00
return new npc_cooshcooshAI ( creature );
2010-08-07 13:04:00 +06:00
}
2009-10-17 15:51:44 -07:00
2014-04-29 16:35:11 +02:00
bool OnGossipHello ( Player * player , Creature * creature ) override
2010-08-07 13:04:00 +06:00
{
2011-07-02 22:52:42 +02:00
if ( player -> GetQuestStatus ( QUEST_CRACK_SKULLS ) == QUEST_STATUS_INCOMPLETE )
2016-08-31 00:59:04 +02:00
AddGossipItemFor ( player , GOSSIP_ICON_CHAT , GOSSIP_COOSH , GOSSIP_SENDER_MAIN , GOSSIP_ACTION_INFO_DEF );
2009-10-17 15:51:44 -07:00
2016-08-31 00:59:04 +02:00
SendGossipMenuFor ( player , 9441 , creature -> GetGUID ());
2010-08-07 13:04:00 +06:00
return true ;
}
2014-04-29 16:35:11 +02:00
bool OnGossipSelect ( Player * player , Creature * creature , uint32 /*sender*/ , uint32 action ) override
2008-10-21 13:19:26 -05:00
{
2016-08-31 00:59:04 +02:00
ClearGossipMenuFor ( player );
2012-03-07 14:08:30 +01:00
if ( action == GOSSIP_ACTION_INFO_DEF )
2010-08-07 13:04:00 +06:00
{
2016-08-31 00:59:04 +02:00
CloseGossipMenuFor ( player );
2011-07-02 22:18:03 +02:00
creature -> setFaction ( FACTION_HOSTILE_CO );
2011-07-02 22:52:42 +02:00
creature -> AI () -> AttackStart ( player );
2010-08-07 13:04:00 +06:00
}
return true ;
2008-10-21 13:19:26 -05:00
}
2010-08-07 13:04:00 +06:00
};
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/*######
## npc_elder_kuruti
######*/
2009-10-17 15:51:44 -07:00
2009-12-06 20:32:16 -03:00
#define GOSSIP_ITEM_KUR1 "Greetings, elder. It is time for your people to end their hostility towards the draenei and their allies."
#define GOSSIP_ITEM_KUR2 "I did not mean to deceive you, elder. The draenei of Telredor thought to approach you in a way that would seem familiar to you."
#define GOSSIP_ITEM_KUR3 "I will tell them. Farewell, elder."
2009-10-17 15:51:44 -07:00
2010-08-07 13:04:00 +06:00
class npc_elder_kuruti : public CreatureScript
2008-10-21 13:19:26 -05:00
{
2010-08-07 13:04:00 +06:00
public :
npc_elder_kuruti () : CreatureScript ( "npc_elder_kuruti" ) { }
2009-10-17 15:51:44 -07:00
2014-04-29 16:35:11 +02:00
bool OnGossipHello ( Player * player , Creature * creature ) override
2010-08-07 13:04:00 +06:00
{
2011-07-02 22:52:42 +02:00
if ( player -> GetQuestStatus ( 9803 ) == QUEST_STATUS_INCOMPLETE )
2016-08-31 00:59:04 +02:00
AddGossipItemFor ( player , GOSSIP_ICON_CHAT , GOSSIP_ITEM_KUR1 , GOSSIP_SENDER_MAIN , GOSSIP_ACTION_INFO_DEF );
2009-10-17 15:51:44 -07:00
2016-08-31 00:59:04 +02:00
SendGossipMenuFor ( player , 9226 , creature -> GetGUID ());
2009-10-17 15:51:44 -07:00
2010-08-07 13:04:00 +06:00
return true ;
}
2014-04-29 16:35:11 +02:00
bool OnGossipSelect ( Player * player , Creature * creature , uint32 /*sender*/ , uint32 action ) override
2008-10-21 13:19:26 -05:00
{
2016-08-31 00:59:04 +02:00
ClearGossipMenuFor ( player );
2012-03-07 14:08:30 +01:00
switch ( action )
2008-10-21 13:19:26 -05:00
{
2010-08-07 13:04:00 +06:00
case GOSSIP_ACTION_INFO_DEF :
2016-08-31 00:59:04 +02:00
AddGossipItemFor ( player , GOSSIP_ICON_CHAT , GOSSIP_ITEM_KUR2 , GOSSIP_SENDER_MAIN , GOSSIP_ACTION_INFO_DEF + 1 );
SendGossipMenuFor ( player , 9227 , creature -> GetGUID ());
2010-08-07 13:04:00 +06:00
break ;
case GOSSIP_ACTION_INFO_DEF + 1 :
2016-08-31 00:59:04 +02:00
AddGossipItemFor ( player , GOSSIP_ICON_CHAT , GOSSIP_ITEM_KUR3 , GOSSIP_SENDER_MAIN , GOSSIP_ACTION_INFO_DEF + 2 );
SendGossipMenuFor ( player , 9229 , creature -> GetGUID ());
2010-08-07 13:04:00 +06:00
break ;
case GOSSIP_ACTION_INFO_DEF + 2 :
2008-10-21 13:19:26 -05:00
{
2012-10-23 13:11:08 +02:00
if ( ! player -> HasItemCount ( 24573 ))
2008-10-21 13:19:26 -05:00
{
2010-08-07 13:04:00 +06:00
ItemPosCountVec dest ;
uint32 itemId = 24573 ;
2011-08-03 11:23:08 +02:00
InventoryResult msg = player -> CanStoreNewItem ( NULL_BAG , NULL_SLOT , dest , itemId , 1 , NULL );
2010-08-07 13:04:00 +06:00
if ( msg == EQUIP_ERR_OK )
{
2011-07-02 22:52:42 +02:00
player -> StoreNewItem ( dest , itemId , true );
2010-08-07 13:04:00 +06:00
}
else
2011-07-02 22:52:42 +02:00
player -> SendEquipError ( msg , NULL , NULL , itemId );
2008-10-21 13:19:26 -05:00
}
2016-08-31 00:59:04 +02:00
SendGossipMenuFor ( player , 9231 , creature -> GetGUID ());
2010-08-07 13:04:00 +06:00
break ;
2008-10-21 13:19:26 -05:00
}
}
2010-08-07 13:04:00 +06:00
return true ;
2008-10-21 13:19:26 -05:00
}
2010-08-07 13:04:00 +06:00
};
2009-10-17 15:51:44 -07:00
2009-01-09 23:56:25 +01:00
/*######
## npc_kayra_longmane
######*/
2009-10-17 15:51:44 -07:00
2013-07-06 01:00:05 +02:00
enum Kayra
2009-06-15 01:59:46 +02:00
{
2012-12-07 10:04:40 +01:00
SAY_START = 0 ,
SAY_AMBUSH1 = 1 ,
SAY_PROGRESS = 2 ,
SAY_AMBUSH2 = 3 ,
SAY_END = 4 ,
2009-10-17 15:51:44 -07:00
2009-06-15 01:59:46 +02:00
QUEST_ESCAPE_FROM = 9752 ,
NPC_SLAVEBINDER = 18042
};
2009-10-17 15:51:44 -07:00
2010-08-07 13:04:00 +06:00
class npc_kayra_longmane : public CreatureScript
2009-01-09 23:56:25 +01:00
{
2010-08-07 13:04:00 +06:00
public :
npc_kayra_longmane () : CreatureScript ( "npc_kayra_longmane" ) { }
2009-10-17 15:51:44 -07:00
2010-08-07 13:04:00 +06:00
struct npc_kayra_longmaneAI : public npc_escortAI
2009-02-09 08:16:34 -05:00
{
2013-10-22 20:23:07 +02:00
npc_kayra_longmaneAI ( Creature * creature ) : npc_escortAI ( creature ) { }
2009-10-17 15:51:44 -07:00
2014-04-29 16:35:11 +02:00
void Reset () override { }
2009-10-17 15:51:44 -07:00
2014-04-29 16:35:11 +02:00
void WaypointReached ( uint32 waypointId ) override
2009-02-09 08:16:34 -05:00
{
2011-07-02 22:52:42 +02:00
Player * player = GetPlayerForEscort ();
if ( ! player )
2010-08-07 13:04:00 +06:00
return ;
2012-03-29 15:44:24 +08:00
switch ( waypointId )
2010-08-07 13:04:00 +06:00
{
case 4 :
2013-12-23 14:23:49 +01:00
Talk ( SAY_AMBUSH1 , player );
2010-08-07 13:04:00 +06:00
DoSpawnCreature ( NPC_SLAVEBINDER , - 10.0f , - 5.0f , 0.0f , 0.0f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 30000 );
DoSpawnCreature ( NPC_SLAVEBINDER , - 8.0f , 5.0f , 0.0f , 0.0f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 30000 );
break ;
case 5 :
2013-12-23 14:23:49 +01:00
Talk ( SAY_PROGRESS , player );
2010-08-07 13:04:00 +06:00
SetRun ();
break ;
case 16 :
2013-12-23 14:23:49 +01:00
Talk ( SAY_AMBUSH2 , player );
2010-08-07 13:04:00 +06:00
DoSpawnCreature ( NPC_SLAVEBINDER , - 10.0f , - 5.0f , 0.0f , 0.0f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 30000 );
DoSpawnCreature ( NPC_SLAVEBINDER , - 8.0f , 5.0f , 0.0f , 0.0f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 30000 );
break ;
case 17 :
SetRun ( false );
break ;
case 25 :
2013-12-23 14:23:49 +01:00
Talk ( SAY_END , player );
2011-07-02 22:52:42 +02:00
player -> GroupEventHappens ( QUEST_ESCAPE_FROM , me );
2010-08-07 13:04:00 +06:00
break ;
}
2009-02-09 08:16:34 -05:00
}
2010-08-07 13:04:00 +06:00
};
2009-10-17 15:51:44 -07:00
2014-04-29 16:35:11 +02:00
bool OnQuestAccept ( Player * player , Creature * creature , Quest const * quest ) override
2009-01-09 23:56:25 +01:00
{
2011-10-07 19:45:43 -05:00
if ( quest -> GetQuestId () == QUEST_ESCAPE_FROM )
2010-08-07 13:04:00 +06:00
{
2013-12-23 14:23:49 +01:00
creature -> AI () -> Talk ( SAY_START , player );
2009-10-17 15:51:44 -07:00
2011-07-02 22:18:03 +02:00
if ( npc_escortAI * pEscortAI = CAST_AI ( npc_kayra_longmane :: npc_kayra_longmaneAI , creature -> AI ()))
2011-07-02 22:52:42 +02:00
pEscortAI -> Start ( false , false , player -> GetGUID ());
2010-08-07 13:04:00 +06:00
}
return true ;
2009-01-09 23:56:25 +01:00
}
2009-10-17 15:51:44 -07:00
2014-04-29 16:35:11 +02:00
CreatureAI * GetAI ( Creature * creature ) const override
2010-08-07 13:04:00 +06:00
{
2011-07-02 22:18:03 +02:00
return new npc_kayra_longmaneAI ( creature );
2010-08-07 13:04:00 +06:00
}
};
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_zangarmarsh ()
{
2010-08-07 13:04:00 +06:00
new npcs_ashyen_and_keleth ();
new npc_cooshcoosh ();
new npc_elder_kuruti ();
new npc_kayra_longmane ();
2008-10-21 13:19:26 -05:00
}