Hello,
Here is the code I created in order to create a NPC that would allow players to get their skills to the maximum:
[CODE]#include “ScriptPCH.h”
class maxskill : public CreatureScript
{
public:
maxskill() : CreatureScript("maxskill") { }
bool OnGossipHello(Player* pPlayer, Creature* pCreature)
{ pCreature->isTrainer() ;1;
pPlayer->ADD_GOSSIP_ITEM( 3, "Maxskill : I wanna increase my skills" , GOSSIP_SENDER_MAIN, 1000);
pPlayer->ADD_GOSSIP_ITEM( 0, "No thanks, see you." , GOSSIP_SENDER_MAIN, 1001);
pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,pCreature->GetGUID());
return true;
}
void SendDefaultMenu_maxskill(Player* pPlayer, Creature* pCreature, uint32 uiAction)
{
if (pPlayer->isInCombat())
{
pPlayer->CLOSE_GOSSIP_MENU();
pCreature->MonsterSay("You are in combat!", LANG_UNIVERSAL, NULL);
return;
}
switch(uiAction)
{
case 1000:
pPlayer->CLOSE_GOSSIP_MENU();
pPlayer->UpdateSkillsToMaxSkillsForLevel();
pCreature->MonsterWhisper("Your weapon skills are now at the maximum",pPlayer->GetGUID(),true);
break;
case 1001:
pPlayer->CLOSE_GOSSIP_MENU();
break;
}
}
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
if (uiSender == GOSSIP_SENDER_MAIN)
SendDefaultMenu_maxskill(pPlayer, pCreature, uiAction);
return true;
}
};
void AddSC_maxskill()
{
new maxskill;
}[/CODE]
Enjoy and +1 if it helps /emoticons/default_wink.png