Files
TrinityCore2/src/server/scripts/Kalimdor/durotar.cpp
T
Xanadu 79622802f3 Merge. Revision history for source files should be all back now.
--HG--
branch : trunk
rename : sql/CMakeLists.txt => sql/tools/CMakeLists.txt
rename : src/server/game/Pools/PoolHandler.cpp => src/server/game/Pools/PoolMgr.cpp
rename : src/server/game/Pools/PoolHandler.h => src/server/game/Pools/PoolMgr.h
rename : src/server/game/PrecompiledHeaders/NixCorePCH.cpp => src/server/game/PrecompiledHeaders/gamePCH.cpp
rename : src/server/game/PrecompiledHeaders/NixCorePCH.h => src/server/game/PrecompiledHeaders/gamePCH.h
2010-07-20 02:49:28 +02:00

104 lines
2.9 KiB
C++

/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.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 2 of the License, or (at your
* option) 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 "ScriptPCH.h"
#include "ScriptPCH.h"
/*######
##Quest 5441: Lazy Peons
##npc_lazy_peon
######*/
enum LazyPeonYells
{
SAY_SPELL_HIT = -1999900 //Ow! OK, I''ll get back to work, $N!'
};
enum LazyPeon
{
QUEST_LAZY_PEONS = 5441,
GO_LUMBERPILE = 175784,
SPELL_BUFF_SLEEP = 17743,
SPELL_AWAKEN_PEON = 19938
};
struct npc_lazy_peonAI : public ScriptedAI
{
npc_lazy_peonAI(Creature *c) : ScriptedAI(c) {}
uint64 uiPlayerGUID;
uint32 m_uiRebuffTimer;
bool work;
void Reset ()
{
uiPlayerGUID = 0;
work = false;
}
void MovementInform(uint32 /*type*/, uint32 id)
{
if (id == 1)
work = true;
}
void SpellHit(Unit *caster, const SpellEntry *spell)
{
if (spell->Id == SPELL_AWAKEN_PEON && caster->GetTypeId() == TYPEID_PLAYER
&& CAST_PLR(caster)->GetQuestStatus(QUEST_LAZY_PEONS) == QUEST_STATUS_INCOMPLETE)
{
caster->ToPlayer()->KilledMonsterCredit(me->GetEntry(),me->GetGUID());
DoScriptText(SAY_SPELL_HIT, me, caster);
me->RemoveAllAuras();
if (GameObject* Lumberpile = me->FindNearestGameObject(GO_LUMBERPILE, 20))
me->GetMotionMaster()->MovePoint(1,Lumberpile->GetPositionX()-1,Lumberpile->GetPositionY(),Lumberpile->GetPositionZ());
}
}
void UpdateAI(const uint32 uiDiff)
{
if (work == true)
me->HandleEmoteCommand(466);
if (m_uiRebuffTimer <= uiDiff)
{
DoCast(me, SPELL_BUFF_SLEEP);
m_uiRebuffTimer = 300000; //Rebuff agian in 5 minutes
}
else
m_uiRebuffTimer -= uiDiff;
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_npc_lazy_peon(Creature* pCreature)
{
return new npc_lazy_peonAI(pCreature);
}
void AddSC_durotar()
{
Script* newscript;
newscript = new Script;
newscript->Name = "npc_lazy_peon";
newscript->GetAI = &GetAI_npc_lazy_peon;
newscript->RegisterSelf();
}