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

65 lines
1.8 KiB
C++
Raw Normal View History

/*
2011-01-01 15:01:13 +01:00
* Copyright (C) 2008-2011 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
#####*/
class item_defias_gunpowder : public ItemScript
2008-12-01 18:32:00 -06:00
{
2010-08-08 22:54:58 +06:00
public:
item_defias_gunpowder() : ItemScript("item_defias_gunpowder") { }
2009-10-17 15:51:44 -07:00
bool OnUse(Player* player, Item* item, SpellCastTargets const& targets)
2008-12-01 18:32:00 -06:00
{
InstanceScript* pInstance = player->GetInstanceScript();
2010-08-08 22:54:58 +06:00
if (!pInstance)
{
player->GetSession()->SendNotification("Instance script not initialized");
2010-08-08 22:54:58 +06:00
return true;
}
if (pInstance->GetData(EVENT_STATE)!= CANNON_NOT_USED)
return false;
2011-06-23 13:28:52 +02:00
if (targets.GetGOTarget() && targets.GetGOTarget()->GetEntry() == GO_DEFIAS_CANNON)
2010-08-08 22:54:58 +06:00
{
pInstance->SetData(EVENT_STATE, CANNON_GUNPOWDER_USED);
}
player->DestroyItemCount(item->GetEntry(), 1, true);
2008-12-01 18:32:00 -06:00
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
void AddSC_deadmines()
2008-12-01 18:32:00 -06:00
{
2010-08-08 22:54:58 +06:00
new item_defias_gunpowder();
2008-12-01 18:32:00 -06:00
}