Code
#include "scriptPCH.h"
#define GOSSIP_ITEM_ARENA_TO_HONOR "Сменить 100 Арены на 15000 Хонора"
#define GOSSIP_ITEM_HONOR_TO_ARENA "Сменить 15000 Хонора на 100 Арены"
class npc_arena_honor : public CreatureScript
{
public:
npc_arena_honor() : CreatureScript("npc_arena_honor") {}
bool OnGossipHello(Player* pPlayer, Creature* pCreature)
{
pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_ARENA_TO_HONOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_HONOR_TO_ARENA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
pPlayer->SEND_GOSSIP_MENU(3961,pCreature->GetGUID());
return true;
}
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
{
if (pPlayer->GetArenaPoints() >= 100)
{
pPlayer->ModifyArenaPoints(-100);
pPlayer->ModifyHonorPoints(+15000);
}else {
pCreature->MonsterWhisper("Недостаточно очков Арены.", pPlayer->GetGUID());
}
pPlayer->CLOSE_GOSSIP_MENU();
return true;
}
if (uiAction == GOSSIP_ACTION_INFO_DEF+2)
{
if (pPlayer->GetHonorPoints() >= 15000)
{
pPlayer->ModifyHonorPoints(-15000);
pPlayer->ModifyArenaPoints(+100);
}else {
pCreature->MonsterWhisper("Недостаточно Хонора.", pPlayer->GetGUID());
}
pPlayer->CLOSE_GOSSIP_MENU();
return true;
}
return true;
}
void AddSC_npc_arena_honor()
{
new npc_arena_honor;
}