Maxskill NPC

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

thx for release +1

nice and useful thx ^^

+1 Thank you.

This may sound noobish, but how do i use this with a NPC? /emoticons/default_tongue.png

However +1, this is what i needed.

Hi,

take a look at this:

http://www.trinitycore.info/How-to:CustomScript

Greets

Ashi

+1!

Thank you, i took a closer look and found out /emoticons/default_smile.png


#

#    AlwaysMaxSkillForLevel

#        Description: Players will automatically gain max skill level when logging in or leveling

#                     up.

#        Default:     0 - (Disabled)

#                     1 - (Enabled)


AlwaysMaxSkillForLevel = 1


OR


#

#    AlwaysMaxWeaponSkill

#        Description: Players will automatically gain max weapon/defense skill when logging in,

#                     or leveling.

#        Default:     0 - (Disabled)

#                     1 - (Enabled)


AlwaysMaxWeaponSkill = 1

Wouldn’t this part of worldserver.conf an easier solution?