I wrote this real quick and didnt really test it out but im pretty positive it will compile without errors.
Credits = Me (fokui) :P
MaxSkill.cpp
Code:
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4305)// warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
class SCRIPT_DECL MaxSkill : 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 MaxSkill::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
{
Menu->AddItem(9, "Advance All Weapon Skills", 1);
}
if(AutoSend)
Menu->SendTo(Plr);
}
void MaxSkill::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;
GossipMenu * Menu;
switch(IntId)
{
case 0:
GossipHello(pObject, Plr, true);
break;
case 1: // Advance Weapon Skills
{
if (Plr->_HasSkillLine(43))
{Plr->_AdvanceSkillLine(43, 375);}
if (Plr->_HasSkillLine(55))
{Plr->_AdvanceSkillLine(55, 375);}
if (Plr->_HasSkillLine(44))
{Plr->_AdvanceSkillLine(44, 375);}
if (Plr->_HasSkillLine(95))
{Plr->_AdvanceSkillLine(95, 375);}
if (Plr->_HasSkillLine(54))
{Plr->_AdvanceSkillLine(54, 375);}
if (Plr->_HasSkillLine(45))
{Plr->_AdvanceSkillLine(45, 375);}
if (Plr->_HasSkillLine(46))
{Plr->_AdvanceSkillLine(46, 375);}
if (Plr->_HasSkillLine(136))
{Plr->_AdvanceSkillLine(136, 375);}
if (Plr->_HasSkillLine(160))
{Plr->_AdvanceSkillLine(160, 375);}
if (Plr->_HasSkillLine(162))
{Plr->_AdvanceSkillLine(162, 375);}
if (Plr->_HasSkillLine(172))
{Plr->_AdvanceSkillLine(172, 375);}
if (Plr->_HasSkillLine(173))
{Plr->_AdvanceSkillLine(173, 375);}
if (Plr->_HasSkillLine(176))
{Plr->_AdvanceSkillLine(176, 375);}
if (Plr->_HasSkillLine(226))
{Plr->_AdvanceSkillLine(226, 375);}
if (Plr->_HasSkillLine(228))
{Plr->_AdvanceSkillLine(228, 375);}
if (Plr->_HasSkillLine(229))
{Plr->_AdvanceSkillLine(229, 375);}
if (Plr->_HasSkillLine(473))
{Plr->_AdvanceSkillLine(473, 375);}
Plr->BroadcastMessage("Weapon skills advanced,Enjoy being lazy!");
Plr->Gossip_Complete();
}
}
}
void MaxSkill::GossipEnd(Object * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}
void SetupMaxSkill(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new MaxSkill();
mgr->register_gossip_script(NPCID, gs);
}
Setup.cpp
Code:
#include "StdAfx.h"
#include "Setup.h"
#define SKIP_ALLOCATOR_SHARING 1
#include <ScriptSetup.h>
extern "C" SCRIPT_DECL uint32 _exp_get_script_type()
{
return SCRIPT_TYPE_MISC;
}
extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)
{
SetupMaxSkill(mgr);
}
#ifdef WIN32
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
return TRUE;
}
#endif
Setup.h
Code:
#ifndef INSTANCE_SCRIPTS_SETUP_H
#define INSTANCE_SCRIPTS_SETUP_H
void SetupMaxSkill(ScriptMgr * mgr);
#endif