/* Copyright (C) 2006,2007 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
GM NPC Teleporter Script (base for Teleportation Masters)
Biglad
*/
#include "../sc_defines.h"
#include "../../../../game/GossipDef.h"
#include "../../../../game/Player.h"
bool GossipHello_npc_wsg_torch_giver(Player *player, Creature *_Creature)
{
player->ADD_GOSSIP_ITEM( 5, "Can I have a WSG Torch" , GOSSIP_SENDER_MAIN, 1205);
player->ADD_GOSSIP_ITEM( 5, "Relite my WSG Torch" , GOSSIP_SENDER_MAIN, 1207);
player->ADD_GOSSIP_ITEM( 5, "Never Mind, I changed my mind." , GOSSIP_SENDER_MAIN, 1206);
player->PlayerTalkClass->SendGossipMenu(5,_Creature->GetGUID());
return true;
}
/*******************************************************
* Start of GOSSIP_MENU
*******************************************************/
void SendDefaultMenu_npc_wsg_torch_giver(Player *player, Creature *_Creature, uint32 action )
{
if(player->isAttacked())
{
_Creature->Say("You are in combat!", LANG_UNIVERSAL, NULL);
return;
}
if( player->getLevel() < 10 )
{
_Creature->Say("You must be lvl 10+", LANG_UNIVERSAL, NULL);
return;
}
switch(action)
{
case 1205://Give player torch
player->CLOSE_GOSSIP_MENU();
player->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
if (player->HasItemCount(8989892, 1) || player->HasItemCount(8989893, 1) )
{
_Creature->Yell("Go AWAY! You all ready have the WSG torch go away, dont waist my time.", LANG_UNIVERSAL, NULL);
}
else
{
uint32 itemId = 8989892;
uint16 dest;
uint8 msg = player->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemId, 1, false );
if( msg == EQUIP_ERR_OK )
{
Item* item = player->StoreNewItem( dest, itemId, 1, true);
_Creature->Say("The WSG torch is in your backpack.", LANG_UNIVERSAL, NULL);
}
}
break;
case 1206:
player->CLOSE_GOSSIP_MENU();
break;
case 1207://relite torch
player->CLOSE_GOSSIP_MENU();
player->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
if (!player->HasItemCount(8989893, 1) || player->HasItemCount(8989892, 1))
{
_Creature->Yell("You dont have a Extinguished Warsong Gulch Torch so i cant relite it!", LANG_UNIVERSAL, NULL);
}
else
{
player->DestroyItemCount(8989893, 1, true);
uint32 itemId = 8989892;
uint16 dest;
uint8 msg = player->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemId, 1, false );
if( msg == EQUIP_ERR_OK )
{
Item* item = player->StoreNewItem( dest, itemId, 1, true);
_Creature->Say("I have relit your WSG Torch, just visit me again if you need it reliting again.", LANG_UNIVERSAL, NULL);
}
}
break;
}
}
/*******************************************************
* End of GOSSIP_MENU
*******************************************************/
bool GossipSelect_npc_wsg_torch_giver(Player *player, Creature *_Creature, uint32
sender, uint32 action )
{
// Main menu
if (sender == GOSSIP_SENDER_MAIN)
SendDefaultMenu_npc_wsg_torch_giver(player, _Creature, action );
return true;
}
void AddSC_npc_wsg_torch_giver()
{
Script *newscript;
newscript = new Script;
newscript->Name="npc_wsg_torch_giver";
newscript->pGossipHello = &GossipHello_npc_wsg_torch_giver;
newscript->pGossipSelect = &GossipSelect_npc_wsg_torch_giver;
m_scripts[nrscripts++] = newscript;
}