Code:
function NPC_main_menu(pUnit, player)
pUnit:GossipCreateMenu(3543, player, 0)
pUnit:GossipMenuAddItem(0, "Welcome to Blahblah's Custom Trainer", 1, 0)
pUnit:GossipMenuAddItem(0, "I am here to train you ur missing spells.", 2, 0)
pUnit:GossipMenuAddItem(3, "Hunter", 3, 0)
pUnit:GossipMenuAddItem(3, "Warlock", 4, 0)
pUnit:GossipMenuAddItem(3, "Warrior", 5, 0)
pUnit:GossipMenuAddItem(3, "Paladin", 6, 0)
pUnit:GossipSendMenu(player)
end
function SkillNPC_on_gossip_talk(pUnit, event, player)
NPC_main_menu(pUnit, player)
end
function SkillNPC_on_gossip_select(pUnit, event, player, id, intid, code, pMisc)
local pclass = player:GetPlayerClass()
local race = player:GetPlayerRace()
if(intid == 3) then
if( pclass == 3 ) then
pUnit:GossipCreateMenu(3543, player, 0)
pUnit:GossipMenuAddItem(4, "Hello, this is the Hunter Training Area, Please click one of the following spells to learn them.", 100, 0)
pUnit:GossipMenuAddItem(3, "Pet Skills", 10, 0)
pUnit:GossipMenuAddItem(3, "Arcane Shot", 11, 0)
pUnit:GossipMenuAddItem(0, "Back", 100, 0)
pUnit:GossipSendMenu(player)
else
pUnit:GossipCreateMenu(3543, player, 0)
pUnit:GossipMenuAddItem(4, "Sorry but you are not a Hunter, You cannot use this Area", 100, 0)
pUnit:GossipMenuAddItem(0, "Back", 100, 0)
pUnit:GossipSendMenu(player)
end
end
if(intid == 4) then
if ( pclass == 9) then
pUnit:GossipCreateMenu(3543, player, 0)
pUnit:GossipMenuAddItem(4, "Hello, this is the Warlock Training Area, Please click one of the following spells to learn them.", 100, 0)
pUnit:GossipMenuAddItem(3, "Give me my Pets Please", 12, 0)
pUnit:GossipSendMenu(player)
else
pUnit:GossipCreateMenu(3543, player, 0)
pUnit:GossipMenuAddItem(4, "Sorry but you are not a Warlock, You cannot use this Area", 100, 0)
pUnit:GossipMenuAddItem(0, "Back", 100, 0)
pUnit:GossipSendMenu(player)
end
end
if(intid == 5) then
if ( pclass == 1) then
pUnit:GossipCreateMenu(3543, player, 0)
pUnit:GossipMenuAddItem(4, "Hello, this is the Warrior Training Area, Please click one of the following spells to learn them.", 100, 0)
pUnit:GossipMenuAddItem(3, "Defensive Stance", 13, 0)
pUnit:GossipMenuAddItem(3, "Berserker Stance", 14, 0)
pUnit:GossipSendMenu(player)
else
pUnit:GossipCreateMenu(3543, player, 0)
pUnit:GossipMenuAddItem(4, "Sorry but you are not a Warrior, You cannot use this Area", 100, 0)
pUnit:GossipMenuAddItem(0, "Back", 100, 0)
pUnit:GossipSendMenu(player)
end
end
if(intid == 6) then
if ( pclass == 2) then
if race==1 or race==3 or race==4 or race==7 or race==11 then
pUnit:GossipCreateMenu(3543, player, 0)
pUnit:GossipMenuAddItem(4, "Hello, this is the Alliance Paladin Training Area, Please click one of the following spells to learn them.", 100, 0)
pUnit:GossipMenuAddItem(3, "Seal of Vengeance", 15, 0)
pUnit:GossipMenuAddItem(0, "Back", 100, 0)
pUnit:GossipSendMenu(player)
else if ( pclass == 2) then
if race==2 or race==5 or race==6 or race==116 or race==1610 then
pUnit:GossipCreateMenu(3543, player, 0)
pUnit:GossipMenuAddItem(4, "Hello, this is the Horde Paladin Training Area, Please click one of the following spells to learn them.", 100, 0)
pUnit:GossipMenuAddItem(3, "Seal of Blood", 16, 0)
pUnit:GossipMenuAddItem(0, "Back", 100, 0)
pUnit:GossipSendMenu(player)
else if ( pclass == 1 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 11) then
pUnit:GossipCreateMenu(3543, player, 0)
pUnit:GossipMenuAddItem(4, "Sorry but you are not a Paladin, You cannot use this Area", 100, 0)
pUnit:GossipMenuAddItem(0, "Back", 100, 0)
pUnit:GossipSendMenu(player)
end
end
end
end
end
if ( pclass == 3 ) then
if(intid == 10) then
player:LearnSpell(883)
player:LearnSpell(2641)
player:LearnSpell(6991)
player:LearnSpell(982)
player:LearnSpell(1515)
player:LearnSpell(5149)
end
end
if ( pclass == 3 ) then
if(intid == 11) then
player:LearnSpell(27019)
end
end
if ( pclass == 9 ) then
if(intid == 12) then
player:LearnSpell(691)
player:LearnSpell(688)
player:LearnSpell(712)
player:LearnSpell(697)
end
end
if(intid == 15) then
player:LearnSpell(31081)
end
if(intid == 16) then
player:LearnSpell(31892)
end
if(intid == 100) then
pUnit:GossipCreateMenu(3543, player, 0)
pUnit:GossipMenuAddItem(0, "Welcome to Blahblah's Custom Trainer", 1, 0)
pUnit:GossipMenuAddItem(0, "I am here to train you ur missing spells.", 2, 0)
pUnit:GossipMenuAddItem(3, "Hunter", 3, 0)
pUnit:GossipMenuAddItem(3, "Warlock", 4, 0)
pUnit:GossipMenuAddItem(3, "Warrior", 5, 0)
pUnit:GossipMenuAddItem(3, "Paladin", 6, 0)
pUnit:GossipSendMenu(player)
end
end
end
RegisterUnitGossipEvent(59996, 1, "SkillNPC_on_gossip_talk")
RegisterUnitGossipEvent(59996, 2, "SkillNPC_on_gossip_select")
Here is the line: local race = player:GetPlayerRace()