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: Tirisfal_Glades
|
|
|
|
|
SD%Complete: 100
|
2008-12-22 21:20:04 +01:00
|
|
|
SDComment: Quest support: 590, 1819
|
2008-10-21 13:19:26 -05:00
|
|
|
SDCategory: Tirisfal Glades
|
|
|
|
|
EndScriptData */
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-21 13:19:26 -05:00
|
|
|
/* ContentData
|
|
|
|
|
npc_calvin_montague
|
2008-12-22 21:20:04 +01:00
|
|
|
go_mausoleum_door
|
|
|
|
|
go_mausoleum_trigger
|
2008-10-21 13:19:26 -05:00
|
|
|
EndContentData */
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-06-08 23:44:55 +02:00
|
|
|
#include "ScriptPCH.h"
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-21 13:19:26 -05:00
|
|
|
/*######
|
|
|
|
|
## npc_calvin_montague
|
|
|
|
|
######*/
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-10-17 07:42:48 -07:00
|
|
|
enum eCalvin
|
2009-08-07 02:03:27 +02:00
|
|
|
{
|
|
|
|
|
SAY_COMPLETE = -1000431,
|
|
|
|
|
SPELL_DRINK = 2639, // possibly not correct spell (but iconId is correct)
|
|
|
|
|
QUEST_590 = 590,
|
|
|
|
|
FACTION_HOSTILE = 168
|
|
|
|
|
};
|
2010-08-09 01:52:26 +02:00
|
|
|
|
|
|
|
|
class npc_calvin_montague : public CreatureScript
|
2008-10-21 13:19:26 -05:00
|
|
|
{
|
2010-08-08 22:54:58 +06:00
|
|
|
public:
|
|
|
|
|
npc_calvin_montague() : CreatureScript("npc_calvin_montague") { }
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2011-07-02 22:52:42 +02:00
|
|
|
bool OnQuestAccept(Player* player, Creature* creature, Quest const* pQuest)
|
2008-10-21 13:19:26 -05:00
|
|
|
{
|
2010-08-08 22:54:58 +06:00
|
|
|
if (pQuest->GetQuestId() == QUEST_590)
|
|
|
|
|
{
|
2011-07-02 22:18:03 +02:00
|
|
|
creature->setFaction(FACTION_HOSTILE);
|
|
|
|
|
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
|
2011-07-02 22:52:42 +02:00
|
|
|
CAST_AI(npc_calvin_montague::npc_calvin_montagueAI, creature->AI())->AttackStart(player);
|
2010-08-08 22:54:58 +06:00
|
|
|
}
|
|
|
|
|
return true;
|
2008-10-21 13:19:26 -05:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2011-07-02 22:18:03 +02:00
|
|
|
CreatureAI* GetAI(Creature* creature) const
|
2008-10-21 13:19:26 -05:00
|
|
|
{
|
2011-07-02 22:18:03 +02:00
|
|
|
return new npc_calvin_montagueAI (creature);
|
2008-10-21 13:19:26 -05:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-08-08 22:54:58 +06:00
|
|
|
struct npc_calvin_montagueAI : public ScriptedAI
|
2008-10-21 13:19:26 -05:00
|
|
|
{
|
2011-07-02 22:18:03 +02:00
|
|
|
npc_calvin_montagueAI(Creature* creature) : ScriptedAI(creature) { }
|
2010-08-08 22:54:58 +06:00
|
|
|
|
|
|
|
|
uint32 m_uiPhase;
|
|
|
|
|
uint32 m_uiPhaseTimer;
|
|
|
|
|
uint64 m_uiPlayerGUID;
|
|
|
|
|
|
|
|
|
|
void Reset()
|
2009-08-07 02:03:27 +02:00
|
|
|
{
|
2010-08-08 22:54:58 +06:00
|
|
|
m_uiPhase = 0;
|
|
|
|
|
m_uiPhaseTimer = 5000;
|
|
|
|
|
m_uiPlayerGUID = 0;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-08-07 02:03:27 +02:00
|
|
|
me->RestoreFaction();
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2011-04-29 20:47:02 +02:00
|
|
|
if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE))
|
|
|
|
|
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
|
2010-08-08 22:54:58 +06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EnterCombat(Unit* /*who*/) {}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-08-08 22:54:58 +06:00
|
|
|
void AttackedBy(Unit* pAttacker)
|
|
|
|
|
{
|
|
|
|
|
if (me->getVictim() || me->IsFriendlyTo(pAttacker))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
AttackStart(pAttacker);
|
2009-08-07 02:03:27 +02:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-08-08 22:54:58 +06:00
|
|
|
void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
|
2009-08-07 02:03:27 +02:00
|
|
|
{
|
2010-08-26 01:20:57 +06:00
|
|
|
if (uiDamage > me->GetHealth() || me->HealthBelowPctDamaged(15, uiDamage))
|
2009-08-07 02:03:27 +02:00
|
|
|
{
|
2010-08-08 22:54:58 +06:00
|
|
|
uiDamage = 0;
|
|
|
|
|
|
|
|
|
|
me->RestoreFaction();
|
2011-04-29 20:47:02 +02:00
|
|
|
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
|
2010-08-08 22:54:58 +06:00
|
|
|
me->CombatStop(true);
|
|
|
|
|
|
|
|
|
|
m_uiPhase = 1;
|
|
|
|
|
|
|
|
|
|
if (pDoneBy->GetTypeId() == TYPEID_PLAYER)
|
|
|
|
|
m_uiPlayerGUID = pDoneBy->GetGUID();
|
2009-08-07 02:03:27 +02:00
|
|
|
}
|
2010-08-08 22:54:58 +06:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-08-08 22:54:58 +06:00
|
|
|
void UpdateAI(const uint32 uiDiff)
|
|
|
|
|
{
|
|
|
|
|
if (m_uiPhase)
|
2009-08-07 02:03:27 +02:00
|
|
|
{
|
2010-08-08 22:54:58 +06:00
|
|
|
if (m_uiPhaseTimer <= uiDiff)
|
|
|
|
|
m_uiPhaseTimer = 7500;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_uiPhaseTimer -= uiDiff;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch(m_uiPhase)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
DoScriptText(SAY_COMPLETE, me);
|
|
|
|
|
++m_uiPhase;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
2011-07-02 22:52:42 +02:00
|
|
|
if (Player* player = Unit::GetPlayer(*me, m_uiPlayerGUID))
|
|
|
|
|
player->AreaExploredOrEventHappens(QUEST_590);
|
2010-08-08 22:54:58 +06:00
|
|
|
|
|
|
|
|
DoCast(me, SPELL_DRINK, true);
|
|
|
|
|
++m_uiPhase;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
EnterEvadeMode();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
2009-08-07 02:03:27 +02:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-08-08 22:54:58 +06:00
|
|
|
if (!UpdateVictim())
|
|
|
|
|
return;
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-08-08 22:54:58 +06:00
|
|
|
DoMeleeAttackIfReady();
|
|
|
|
|
}
|
|
|
|
|
};
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-21 13:19:26 -05:00
|
|
|
};
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-12-22 21:20:04 +01:00
|
|
|
/*######
|
|
|
|
|
## go_mausoleum_door
|
|
|
|
|
## go_mausoleum_trigger
|
|
|
|
|
######*/
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2009-10-17 07:42:48 -07:00
|
|
|
enum eMausoleum
|
2008-12-22 21:20:04 +01:00
|
|
|
{
|
2009-06-29 06:31:05 +02:00
|
|
|
QUEST_ULAG = 1819,
|
|
|
|
|
NPC_ULAG = 6390,
|
|
|
|
|
GO_TRIGGER = 104593,
|
|
|
|
|
GO_DOOR = 176594
|
|
|
|
|
};
|
2010-08-09 01:52:26 +02:00
|
|
|
|
|
|
|
|
class go_mausoleum_door : public GameObjectScript
|
2008-12-22 21:20:04 +01:00
|
|
|
{
|
2010-08-08 22:54:58 +06:00
|
|
|
public:
|
|
|
|
|
go_mausoleum_door() : GameObjectScript("go_mausoleum_door") { }
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2011-07-02 22:52:42 +02:00
|
|
|
bool OnGossipHello(Player* player, GameObject* /*pGo*/)
|
2008-12-22 21:20:04 +01:00
|
|
|
{
|
2011-07-02 22:52:42 +02:00
|
|
|
if (player->GetQuestStatus(QUEST_ULAG) != QUEST_STATUS_INCOMPLETE)
|
2010-08-08 22:54:58 +06:00
|
|
|
return false;
|
|
|
|
|
|
2011-07-02 22:52:42 +02:00
|
|
|
if (GameObject* pTrigger = player->FindNearestGameObject(GO_TRIGGER, 30.0f))
|
2010-08-08 22:54:58 +06:00
|
|
|
{
|
|
|
|
|
pTrigger->SetGoState(GO_STATE_READY);
|
2011-07-02 22:52:42 +02:00
|
|
|
player->SummonCreature(NPC_ULAG, 2390.26f, 336.47f, 40.01f, 2.26f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300000);
|
2010-08-08 22:54:58 +06:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-22 21:20:04 +01:00
|
|
|
return false;
|
|
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-08-08 22:54:58 +06:00
|
|
|
};
|
2010-08-09 01:52:26 +02:00
|
|
|
|
|
|
|
|
class go_mausoleum_trigger : public GameObjectScript
|
2008-12-22 21:20:04 +01:00
|
|
|
{
|
2010-08-08 22:54:58 +06:00
|
|
|
public:
|
|
|
|
|
go_mausoleum_trigger() : GameObjectScript("go_mausoleum_trigger") { }
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2011-07-02 22:52:42 +02:00
|
|
|
bool OnGossipHello(Player* player, GameObject* pGo)
|
2008-12-22 21:20:04 +01:00
|
|
|
{
|
2011-07-02 22:52:42 +02:00
|
|
|
if (player->GetQuestStatus(QUEST_ULAG) != QUEST_STATUS_INCOMPLETE)
|
2010-08-08 22:54:58 +06:00
|
|
|
return false;
|
|
|
|
|
|
2011-07-02 22:52:42 +02:00
|
|
|
if (GameObject* pDoor = player->FindNearestGameObject(GO_DOOR, 30.0f))
|
2010-08-08 22:54:58 +06:00
|
|
|
{
|
|
|
|
|
pGo->SetGoState(GO_STATE_ACTIVE);
|
2011-04-29 20:47:02 +02:00
|
|
|
pDoor->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
|
2010-08-08 22:54:58 +06:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
2008-12-22 21:20:04 +01:00
|
|
|
}
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-08-08 22:54:58 +06:00
|
|
|
};
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2008-10-21 13:19:26 -05:00
|
|
|
void AddSC_tirisfal_glades()
|
|
|
|
|
{
|
2010-08-08 22:54:58 +06:00
|
|
|
new npc_calvin_montague();
|
|
|
|
|
new go_mausoleum_door();
|
|
|
|
|
new go_mausoleum_trigger();
|
2008-10-21 13:19:26 -05:00
|
|
|
}
|