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

61 lines
1.9 KiB
C++
Raw Normal View History

2009-02-17 18:08:26 +01:00
/* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
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
2010-01-19 11:36:05 +01:00
#include "ScriptedPch.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();
}