2010-07-06 03:27:41 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
|
|
|
|
|
* 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: Deadmines
|
|
|
|
|
SD%Complete: 0
|
|
|
|
|
SDComment: Placeholder
|
|
|
|
|
SDCategory: Deadmines
|
|
|
|
|
EndScriptData */
|
2009-10-17 15:51:44 -07:00
|
|
|
|
2010-06-08 23:44:55 +02:00
|
|
|
#include "ScriptPCH.h"
|
2009-10-22 12:51:05 +02:00
|
|
|
#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
|
|
|
|
|
#####*/
|
2010-08-08 22:54:58 +06:00
|
|
|
|
2008-12-01 18:32:00 -06:00
|
|
|
class item_defias_gunpowder : public ItemScript
|
2010-08-08 22:54:58 +06:00
|
|
|
{
|
|
|
|
|
public:
|
2009-10-17 15:51:44 -07:00
|
|
|
item_defias_gunpowder() : ItemScript("item_defias_gunpowder") { }
|
2010-08-08 22:54:58 +06:00
|
|
|
|
2008-12-01 18:32:00 -06:00
|
|
|
bool ItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets)
|
2010-08-08 22:54:58 +06:00
|
|
|
{
|
|
|
|
|
InstanceScript *pInstance = pPlayer->GetInstanceScript();
|
|
|
|
|
|
|
|
|
|
if (!pInstance)
|
|
|
|
|
{
|
|
|
|
|
pPlayer->GetSession()->SendNotification("Instance script not initialized");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (pInstance->GetData(EVENT_STATE)!= CANNON_NOT_USED)
|
|
|
|
|
return false;
|
|
|
|
|
if (targets.getGOTarget() && targets.getGOTarget()->GetTypeId() == TYPEID_GAMEOBJECT &&
|
|
|
|
|
targets.getGOTarget()->GetEntry() == GO_DEFIAS_CANNON)
|
|
|
|
|
{
|
|
|
|
|
pInstance->SetData(EVENT_STATE, CANNON_GUNPOWDER_USED);
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-01 18:32:00 -06:00
|
|
|
pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true);
|
|
|
|
|
return true;
|
2009-10-17 15:51:44 -07:00
|
|
|
}
|
2010-08-08 22:54:58 +06:00
|
|
|
|
2009-10-17 15:51:44 -07:00
|
|
|
};
|
2009-10-27 13:11:33 +01:00
|
|
|
|
2008-12-01 18:32:00 -06:00
|
|
|
void AddSC_deadmines()
|
2010-08-08 22:54:58 +06:00
|
|
|
{
|
2008-12-01 18:32:00 -06:00
|
|
|
new item_defias_gunpowder();
|