Code:
#include "StdAfx.h"
#include "Setup.h"
#define ADV_SKILL_NPC 85000
#ifdef WIN32
#pragma warning(disable:4305)// warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
class SCRIPT_DECL AdvSkillNPC : public GossipScript
{
public:
void GossipHello(Object * pObject, Player* Plr, bool AutoSend);
void GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code);
void GossipEnd(Object * pObject, Player* Plr);
void Destroy()
{
delete this;
}
};
void AdvSkillNPC::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
if(!Plr->CombatStatus.IsInCombat())
{
Menu->AddItem(9, "Advance my weapon skills!", 1);
Menu->AddItem(5, "Goodbye!", 5);
}
else
Plr->BroadcastMessage("You are in combat!");
if(AutoSend)
Menu->SendTo(Plr);
};
void AdvSkillNPC::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NULL;
if(pCreature==NULL)
return;
switch(IntId)
{
case 0:
GossipHello(pObject, Plr, true);
break;
case 5:
{
Plr->Gossip_Complete();//Ends Conversation
}
break;
case 1:
{
if (Plr->_HasSkillLine(43))
{Plr->_AdvanceSkillLine(43, 400);}//Swords
if (Plr->_HasSkillLine(44))
{Plr->_AdvanceSkillLine(44, 400);}//Axes
if (Plr->_HasSkillLine(45))
{Plr->_AdvanceSkillLine(45, 400);}//Bows
if (Plr->_HasSkillLine(46))
{Plr->_AdvanceSkillLine(46, 400);}//Guns
if (Plr->_HasSkillLine(54))
{Plr->_AdvanceSkillLine(54, 400);}//Maces
if (Plr->_HasSkillLine(95))
{Plr->_AdvanceSkillLine(95, 400);}//Defense
if (Plr->_HasSkillLine(136))
{Plr->_AdvanceSkillLine(136, 400);}//Staves
if (Plr->_HasSkillLine(160))
{Plr->_AdvanceSkillLine(160, 400);}//Two-Handed Swords
if (Plr->_HasSkillLine(162))
{Plr->_AdvanceSkillLine(162, 400);}//Unarmed
if (Plr->_HasSkillLine(172))
{Plr->_AdvanceSkillLine(172, 400);}//Two-Handed Axes
if (Plr->_HasSkillLine(173))
{Plr->_AdvanceSkillLine(173, 400);}//Daggers
if (Plr->_HasSkillLine(176))
{Plr->_AdvanceSkillLine(176, 400);}//Thrown
if (Plr->_HasSkillLine(226))
{Plr->_AdvanceSkillLine(226, 400);}//Crossbows
if (Plr->_HasSkillLine(228))
{Plr->_AdvanceSkillLine(228, 400);}//Wands
if (Plr->_HasSkillLine(229))
{Plr->_AdvanceSkillLine(229, 400);}//Polearms
if (Plr->_HasSkillLine(473))
{Plr->_AdvanceSkillLine(473, 400);}//Fist Weapons - I am not sure if this is a skill that is like the others, I thought fist weapons contributed towards unarmed.
if (Plr->_HasSkillLine(633))
{Plr->_AdvanceSkillLine(633, 400);}//Lockpicking - I know its not a weapon skill, but it's always a bitch to level.
Plr->BroadcastMessage("You weapon skills have been advanced!");
Plr->Gossip_Complete();
}
}
}
void AdvSkillNPC::GossipEnd(Object * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}
void SetupAdvSkillNPC(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new AdvSkillNPC();
mgr->register_gossip_script(ADV_SKILL_NPC, gs);
}
Screenshot: