/* Copyright (C) 2006 - 2008 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
*/
/* ScriptData
SDName: gas_clouds
SD%Complete: 0
SDComment:
SDCategory:
EndScriptData */
#include "sc_creature.h"
#include "../../../../game/Player.h"
struct MANGOS_DLL_DECL gas_cloudsAI : public ScriptedAI
{
gas_cloudsAI(Creature *c) : ScriptedAI(c) {Reset();}
bool spellHit;
uint32 spellHit_timer;
void Reset()
{
spellHit = false;
spellHit_timer = 300000;
}
void Aggro(Unit *who)
{
}
void UpdateAI(const uint32 diff)
{
if (spellHit == true)
{
if (spellHit_timer < diff)
{
spellHit = false;
}else spellHit_timer -= diff;
}
}
void SpellHit(Unit *Hitter, const SpellEntry *Spellkind)
{
if(Hitter->GetTypeId() == TYPEID_PLAYER)
{
if(Spellkind->Id == 30427 && !spellHit)
{
ItemPosCountVec dest;
uint8 msg = ((Player*)Hitter)->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, 22572, 1);
if( msg == EQUIP_ERR_OK )
{
Item * item = ((Player*)Hitter)->StoreNewItem( dest, 22572, 1);
spellHit = true;
}else ((Player*)Hitter)->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL);
}
}
}
};
CreatureAI* GetAI_gas_clouds(Creature *_Creature)
{
return new gas_cloudsAI (_Creature);
}
void AddSC_gas_clouds()
{
Script *newscript;
newscript = new Script;
newscript->Name="gas_clouds";
newscript->GetAI = GetAI_gas_clouds;
m_scripts[nrscripts++] = newscript;
}