Files
TCPlayerbotCore/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp
T

63 lines
1.9 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/>
*
* 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/>.
*/
2009-10-17 15:51:44 -07:00
/* ScriptData
SDName: Deadmines
SD%Complete: 0
SDComment: Placeholder
SDCategory: Deadmines
EndScriptData */
2009-10-17 15:51:44 -07:00
#include "ScriptPCH.h"
#include "deadmines.h"
2008-12-01 18:32:00 -06:00
#include "Spell.h"
2009-10-17 15:51:44 -07:00
2008-12-01 18:32:00 -06:00
/*#####
# item_Defias_Gunpowder
#####*/
2009-10-17 15:51:44 -07:00
2009-10-27 21:28:20 -07:00
bool ItemUse_item_defias_gunpowder(Player* pPlayer, Item* pItem, SpellCastTargets const& targets)
2008-12-01 18:32:00 -06:00
{
ScriptedInstance *pInstance = pPlayer->GetInstanceData();
2009-10-17 15:51:44 -07:00
2009-08-14 00:02:13 +02:00
if (!pInstance)
2008-12-01 18:32:00 -06:00
{
2009-08-14 00:02:13 +02:00
pPlayer->GetSession()->SendNotification("Instance script not initialized");
2008-12-01 18:32:00 -06:00
return true;
}
2009-01-22 22:05:51 +01:00
if (pInstance->GetData(EVENT_STATE)!= CANNON_NOT_USED)
2008-12-01 18:32:00 -06:00
return false;
2009-08-14 00:02:13 +02:00
if (targets.getGOTarget() && targets.getGOTarget()->GetTypeId() == TYPEID_GAMEOBJECT &&
2008-12-01 18:32:00 -06:00
targets.getGOTarget()->GetEntry() == GO_DEFIAS_CANNON)
{
pInstance->SetData(EVENT_STATE, CANNON_GUNPOWDER_USED);
}
2009-10-17 15:51:44 -07:00
2009-10-27 21:28:20 -07:00
pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true);
2008-12-01 18:32:00 -06:00
return true;
}
2009-10-17 15:51:44 -07:00
2009-10-27 13:11:33 +01:00
void AddSC_deadmines()
2008-12-01 18:32:00 -06:00
{
Script *newscript;
newscript = new Script;
newscript->Name = "item_defias_gunpowder";
newscript->pItemUse = &ItemUse_item_defias_gunpowder;
newscript->RegisterSelf();
}