All pastes #624524 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-07-18 10:28 UTC
rendered paste body
/* 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 Token Master NPC
NPC Will Exchange GM Tokens for gifts

*/

#include "../sc_defines.h"

bool GossipHello_npc_gm_token_shop(Player *player, Creature *_Creature)
{
	if ( player->getLevel() < 60 )
	{
		player->ADD_GOSSIP_ITEM( 5, "1 GM Token for 2 Level"    , GOSSIP_SENDER_MAIN, 1210);
	}
	else
	{
		player->ADD_GOSSIP_ITEM( 5, "1 GM Token for 1 Level"    , GOSSIP_SENDER_MAIN, 1210);
	}
	player->ADD_GOSSIP_ITEM( 5, "1 GM Token for 200 Honor Points"    , GOSSIP_SENDER_MAIN, 1211);
	player->ADD_GOSSIP_ITEM( 5, "1 GM Token for 200 Arena Points"    , GOSSIP_SENDER_MAIN, 1212);
	player->ADD_GOSSIP_ITEM( 5, "1 GM Token for 500 Gold"    , GOSSIP_SENDER_MAIN, 1213);
	player->ADD_GOSSIP_ITEM( 5, "2 GM Token for 1250 Gold"    , GOSSIP_SENDER_MAIN, 1214);


	player->PlayerTalkClass->SendGossipMenu(5,_Creature->GetGUID());

    return true;
}

/*******************************************************
 *				Start of GOSSIP_MENU
 *******************************************************/

void SendDefaultMenu_npc_gm_token_shop(Player *player, Creature *_Creature, uint32 action)
{
	if(player->isAttacked())
  {
    _Creature->Say("You are in combat!", LANG_UNIVERSAL, NULL);
   return;
	}

switch(action)
{
	case 1210://Add level to player
		player->CLOSE_GOSSIP_MENU();
		if ( player->getLevel() == 70 )
		{
			_Creature->Yell("You have the max level, please select something else.", LANG_UNIVERSAL, NULL);
			return;
		}

		if (player->HasItemCount(69481196, 1) )
		{
		if ( player->getLevel() < 60 )
		{
			player->GiveLevel(player->getLevel()+2);
			player->InitTalentForLevel();
			player->InitStatsForLevel();
			_Creature->Say("You have gained TWO levels, please relog to save the changes", LANG_UNIVERSAL, NULL);
		}
		else
		{
			player->GiveLevel(player->getLevel()+1);
			player->InitTalentForLevel();
			player->InitStatsForLevel();
			_Creature->Say("You have gained One levels, please relog to save the changes", LANG_UNIVERSAL, NULL);
		}
		player->DestroyItemCount(69481196, 1, true);
		}
		else
		{
			_Creature->Yell("You need more GM Token(s), come back when you have some, now begone with you", LANG_UNIVERSAL, NULL);
		}

		
    break;

	case 1211://Give 100 Honor Points to player
		player->CLOSE_GOSSIP_MENU();
		if (player->HasItemCount(69481196, 1) )
		{
		player->SetHonorPoints(player->GetHonorPoints()+200);
		_Creature->Say("You have proved your honor by collecting me a GM token, spend theres honor points the care", LANG_UNIVERSAL, NULL);
		player->DestroyItemCount(69481196, 1, true);
		}
		else
		{
			_Creature->Yell("You need more GM Token(s), come back when you have some, now begone with you", LANG_UNIVERSAL, NULL);
		}
    break;

	case 1212://Give 100 Arena Points to player
		player->CLOSE_GOSSIP_MENU();
		if (player->HasItemCount(69481196, 1) )
		{
		player->SetArenaPoints(player->GetArenaPoints()+200);
		_Creature->Say("You have proved your honor by collecting me a GM token, spend theres arena points the care", LANG_UNIVERSAL, NULL);
		player->DestroyItemCount(69481196, 1, true);
		}
		else
		{
			_Creature->Yell("You need more GM Token(s), come back when you have some, now begone with you", LANG_UNIVERSAL, NULL);
		}
    break;

	case 1213://Give 500g to player
		player->CLOSE_GOSSIP_MENU();
		if (player->HasItemCount(69481196, 1) )
		{
		player->SetMoney(player->GetMoney()+5000000);
		_Creature->Say("Here you go 500 gold coins, dont spend it all at once", LANG_UNIVERSAL, NULL);
		player->DestroyItemCount(69481196, 1, true);
		}
		else
		{
			_Creature->Yell("You need more GM Token(s), come back when you have some, now begone with you", LANG_UNIVERSAL, NULL);
		}
    break;

	case 1214://Give 500g to player
		player->CLOSE_GOSSIP_MENU();
		if (player->HasItemCount(69481196, 2) )
		{
		player->SetMoney(player->GetMoney()+12500000);
		_Creature->Say("Here you go 1250 gold coins, dont spend it all at once", LANG_UNIVERSAL, NULL);
		player->DestroyItemCount(69481196, 2, true);
		}
		else
		{
			_Creature->Yell("You need more GM Token(s), come back when you have some, now begone with you", LANG_UNIVERSAL, NULL);
		}
    break;
}
}

/*******************************************************
 *				End of GOSSIP_MENU
 *******************************************************/

bool GossipSelect_npc_gm_token_shop(Player *player, Creature *_Creature, uint32

sender, uint32 action )

{
// Main menu
if (sender == GOSSIP_SENDER_MAIN)
SendDefaultMenu_npc_gm_token_shop(player, _Creature, action   );

return true;

}


void AddSC_npc_gm_token_shop()

{

Script *newscript;

newscript = new Script;
newscript->Name="npc_gm_token_shop";
newscript->pGossipHello = &GossipHello_npc_gm_token_shop;
newscript->pGossipSelect = &GossipSelect_npc_gm_token_shop;
m_scripts[nrscripts++] = newscript;

}