Customize Class Trainer NPC to boost level

I would like the various class trainers in Stormwind to provide instant level 60 boosts for 5,000 gold and instant level 70 boosts to 60+ characters for 10,000 gold.

I imagine it would be similar to the way a player obtains dual specialization: speak with NPC, click gossip, click confirm in exchange for required currency.

This would be a good way for me to learn how to write a custom script.

If you are insistent on a gossip npc, I would advise sketching out the gossip menu using outline mode in your favorite word processor and from that design your tree, the gossip enumerations and commands needed. There are plenty of “how to npc gossip” tutorials from google results (the recent vipvendor posted in the forum might be some quick clues), some results even on this forum. Once you get the enumerations and the switch/case statement your pretty golden.

However I would suggest you might find it easier to code a '60 level boost token' and '70' boost token (require 60 to use) from a vendor and then just add the item to a npc vendor. Forget about making a new 'item' part during development, just grab item (scroll) and toy with [that](https://trinitycore.atlassian.net/wiki/display/tc/item_template#item_template-ScriptName). This is the natural blizzlike way the game works as well (except for some horrible rep hand ins from tbc and such) and its easy to .mailitem to someone if you want.

You might want to logic up some thing more than just firing off the equivalent of .character level #, such as logic for 'this may break relationship with RaF', 'have the item fail if used on greater than level 60,70 respectively' and so forth.

If you want a more incremental development, make a simple spell that adds spellid [49441](http://www.wowhead.com/spell=49411) to an item, for some "i have the power" nonsense and then build on that to do your leveling.

Cheers




PS

I found an aborted attempt to do something similar that I had around, this would be added to your custom_script_loader.cpp and worked through an item scriptname.

[SIZE=11px][FONT=‘Courier New’]#include “ScriptMgr.h”
#include “Player.h”[/FONT][/SIZE]

[SIZE=11px][FONT=‘Courier New’]class item_vip : public ItemScript
{
public:
item_vip() : ItemScript(“item_vip”) { }[/FONT][/SIZE]

[SIZE=11px][FONT=‘Courier New’] // fancy same script different itemid
// enum VIPITEMS {
// BOOST60 = (10001000) + 61, // itemid 1m+61
// BOOST70 = (1000
1000) + 62, // itemid 1m+62
// }; [/FONT][/SIZE]

[SIZE=11px][FONT=‘Courier New’] bool OnUse(Player* player, Item* item, SpellCastTargets const& /targets/) override
{
// ChatHandler(player->GetSession()).PSendSysMessage(“OnUse”); [/FONT][/SIZE]

[SIZE=11px][FONT=‘Courier New’] // fancy same script different itemid
// uint32 itemid = blaugh blaugh
// switch(itemid) {
// case BOOST60: boostlevel = 60; break;
// case BOOST70: boostlevel = 70; break;
// default: return false; break;
// }
// uint8 boostlevel = 60; [/FONT][/SIZE]

[SIZE=11px][FONT=‘Courier New’] if ( player->getLevel() >= boostlevel) {
ChatHandler(player->GetSession()).PSendSysMessage(“You are too high of level.”);
return false;
}[/FONT][/SIZE]

[SIZE=11px][FONT=‘Courier New’] player->GiveLevel(boostlevel);
player->InitTalentForLevel();
player->SetUInt32Value(PLAYER_XP, 0);[/FONT][/SIZE]

[SIZE=11px][FONT=‘Courier New’] return true;
}
};[/FONT][/SIZE]

[SIZE=11px][FONT=‘Courier New’]void AddSC_item_vip()
{
new item_vip();
}[/FONT][/SIZE]