Files
TCPlayerbotCore/src/server/scripts/EasternKingdoms/wetlands.cpp
T

171 lines
4.3 KiB
C++
Raw Normal View History

/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
2009-08-16 21:46:31 +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.
2009-08-16 21:46:31 +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/>.
2009-08-16 21:46:31 +02:00
*/
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
/* ScriptData
SDName: Wetlands
SD%Complete: 80
SDComment: Quest support: 1249
SDCategory: Wetlands
EndScriptData */
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
/* ContentData
npc_mikhail
npc_tapoke_slim_jahn
EndContentData */
2009-10-17 15:51:44 -07:00
#include "ScriptPCH.h"
2010-01-19 11:36:05 +01:00
#include "ScriptedEscortAI.h"
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
/*######
## npc_tapoke_slim_jahn
######*/
2009-10-17 15:51:44 -07:00
2009-10-17 07:42:48 -07:00
enum eTapokeSlim
2009-08-16 21:46:31 +02:00
{
QUEST_MISSING_DIPLO_PT11 = 1249,
FACTION_ENEMY = 168,
SPELL_STEALTH = 1785,
2009-08-20 02:24:53 +02:00
SPELL_CALL_FRIENDS = 16457, //summons 1x friend
2009-08-16 21:46:31 +02:00
NPC_SLIMS_FRIEND = 4971,
NPC_TAPOKE_SLIM_JAHN = 4962
};
2009-10-17 15:51:44 -07:00
2010-02-05 00:31:28 +01:00
struct npc_tapoke_slim_jahnAI : public npc_escortAI
2009-08-16 21:46:31 +02:00
{
npc_tapoke_slim_jahnAI(Creature* pCreature) : npc_escortAI(pCreature) { }
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
bool m_bFriendSummoned;
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
void Reset()
{
2009-10-11 18:03:59 +02:00
if (!HasEscortState(STATE_ESCORT_ESCORTING))
2009-08-16 21:46:31 +02:00
m_bFriendSummoned = false;
}
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
void WaypointReached(uint32 uiPointId)
{
switch(uiPointId)
{
case 2:
2010-04-14 23:07:41 +02:00
if (me->HasStealthAura())
me->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
SetRun();
2010-04-14 23:07:41 +02:00
me->setFaction(FACTION_ENEMY);
2009-08-16 21:46:31 +02:00
break;
}
}
2009-10-17 15:51:44 -07:00
void EnterCombat(Unit* /*pWho*/)
2009-08-16 21:46:31 +02:00
{
2009-08-17 00:29:53 +02:00
Player* pPlayer = GetPlayerForEscort();
2009-10-17 15:51:44 -07:00
2009-10-11 18:03:59 +02:00
if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_bFriendSummoned && pPlayer)
2009-08-16 21:46:31 +02:00
{
2009-10-17 16:20:24 -07:00
for (uint8 i = 0; i < 3; ++i)
2010-04-14 23:07:41 +02:00
DoCast(me, SPELL_CALL_FRIENDS, true);
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
m_bFriendSummoned = true;
}
}
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
void JustSummoned(Creature* pSummoned)
{
2009-08-17 00:29:53 +02:00
if (Player* pPlayer = GetPlayerForEscort())
2009-08-16 21:46:31 +02:00
pSummoned->AI()->AttackStart(pPlayer);
}
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
void AttackedBy(Unit* pAttacker)
{
2010-04-14 23:07:41 +02:00
if (me->getVictim())
2009-08-16 21:46:31 +02:00
return;
2009-10-17 15:51:44 -07:00
2010-04-14 23:07:41 +02:00
if (me->IsFriendlyTo(pAttacker))
2009-08-16 21:46:31 +02:00
return;
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
AttackStart(pAttacker);
}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage)
2009-08-16 21:46:31 +02:00
{
2010-04-14 23:07:41 +02:00
if (me->GetHealth()*100 < me->GetMaxHealth()*20)
2009-08-16 21:46:31 +02:00
{
2009-08-17 00:29:53 +02:00
if (Player* pPlayer = GetPlayerForEscort())
2009-08-16 21:46:31 +02:00
{
if (pPlayer->GetTypeId() == TYPEID_PLAYER)
2010-04-14 23:07:41 +02:00
CAST_PLR(pPlayer)->GroupEventHappens(QUEST_MISSING_DIPLO_PT11, me);
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
uiDamage = 0;
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
me->RestoreFaction();
2010-04-14 23:07:41 +02:00
me->RemoveAllAuras();
me->DeleteThreatList();
me->CombatStop(true);
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
SetRun(false);
}
}
}
};
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
CreatureAI* GetAI_npc_tapoke_slim_jahn(Creature* pCreature)
{
return new npc_tapoke_slim_jahnAI(pCreature);
}
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
/*######
## npc_mikhail
######*/
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
bool QuestAccept_npc_mikhail(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT11)
{
Creature* pSlim = pCreature->FindNearestCreature(NPC_TAPOKE_SLIM_JAHN, 25.0f);
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
if (!pSlim)
return false;
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
if (!pSlim->HasStealthAura())
pSlim->CastSpell(pSlim, SPELL_STEALTH, true);
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
if (npc_tapoke_slim_jahnAI* pEscortAI = CAST_AI(npc_tapoke_slim_jahnAI, pSlim->AI()))
pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest);
}
return false;
}
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
/*######
## AddSC
######*/
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
void AddSC_wetlands()
{
Script *newscript;
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
newscript = new Script;
newscript->Name = "npc_tapoke_slim_jahn";
newscript->GetAI = &GetAI_npc_tapoke_slim_jahn;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
2009-08-16 21:46:31 +02:00
newscript = new Script;
newscript->Name = "npc_mikhail";
newscript->pQuestAccept = &QuestAccept_npc_mikhail;
newscript->RegisterSelf();
}