Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Trainer Duel Script --
- local SpellOne = 133
- local SpellTwo = 122
- local function NPC_Start(pPlayer, pQuestGiver, delay)
- if(!delay) then
- pPlayer:Teleport(1, 4603.466797, -5983.677734, 169.672836, 1.958626) -- same map? Do events and all reach this place?
- elseif(delay <= 0) then
- pQuestGiver:SetFaction(2190)
- pPlayer:SendBroadcastMessage("The duel has started!")
- return
- else
- pPlayer:SendBroadcastMessage("Duel starts in: "..delay)
- end
- CreateLuaEvent(function() NPC_Start(pPlayer, pQuestGiver, (delay or 4)-1) end, 1000, 1)
- end
- local function Quest_On_Accept(event, pPlayer, QuestId, pQuestGiver) -- questgiver entry = 600009?
- if (QuestId == 600004) then
- pPlayer:PhaseSet(2)
- CreateLuaEvent(function() NPC_Start(pPlayer, pQuestGiver) end, 4000, 1)
- end
- end
- local function NPC_end(unit)
- if(unit:GetHealthPct() > 5) then
- return
- end
- local player = unit:GetPrimaryCombatTarget()
- if(player) then
- player:PhaseSet(1)
- end
- unit:RemoveEvents()
- unit:SetFaction(35)
- unit:RemoveAllAuras()
- unit:SendChatMessage(12, 0, "You have proven yourself worthy! Meet up with Captain Lerean.")
- end
- local function Trainer_On_Combat(unit, event, pPlayer)
- unit:RegisterEvent(NPC_end, 5000, 0)
- unit:RegisterEvent(function() unit:FullCastSpell(SpellOne) end, 12000, 0)
- unit:RegisterEvent(function() unit:FullCastSpell(SpellTwo) end, 8000, 0)
- end
- local function Trainer_Talk(unit, event, plr)
- unit:GossipCreateMenu(100, plr, 0)
- unit:GossipAddQuests(plr)
- if plr:HasQuest(600003) then
- unit:GossipMenuAddItem(3, "Learn my spells", 1, 0)
- unit:GossipMenuAddItem(0, "Nevermind", 3, 0)
- elseif plr:HasQuest(600004) then
- unit:GossipMenuAddItem(9, "Enough chit-chat, let's duel!", 2, 0)
- unit:GossipMenuAddItem(0, "Nevermind", 3, 0)
- else
- unit:SendChatMessageToPlayer(12,0,"Don't waste my time if you have no point talking to me!", plr)
- end
- unit:GossipSendMenu(plr)
- end
- local function Trainer_Choose(unit, event, plr, id, intid, code)
- if (intid == 1) then
- if(not plr:AddItem(60006, 1)) then -- What if bags are full? AddItem is a bool function
- plr:SendAreaTriggerMessage("Bags are full")
- return plr:GossipComplete()
- end
- local Class = plr:GetPlayerClass()
- if (Class == "Warrior") then
- plr:LearnSpell(100)
- plr:LearnSpell(6673)
- elseif (Class == "Paladin") then
- plr:LearnSpell(20271)
- plr:LearnSpell(20217)
- elseif (Class == "Hunter") then
- plr:LearnSpell(3044)
- plr:LearnSpell(1978)
- elseif (Class == "Rogue") then
- plr:LearnSpell(1784)
- plr:LearnSpell(1833)
- elseif (Class == "Mage") then
- plr:LearnSpell(116)
- plr:LearnSpell(2136)
- elseif (Class == "Priest") then
- plr:LearnSpell(589)
- plr:LearnSpell(139)
- elseif (Class == "Shaman") then
- if(not plr:AddItem(46978)) then
- plr:RemoveItem(60006, 1)
- plr:SendAreaTriggerMessage("Bags are full")
- return plr:GossipComplete()
- end
- plr:LearnSpell(8042)
- plr:LearnSpell(2484)
- elseif (Class == "Warlock") then
- plr:LearnSpell(172)
- plr:LearnSpell(688)
- elseif (Class == "Druid") then
- plr:LearnSpell(8921)
- plr:LearnSpell(339)
- end
- elseif (intid == 2) then
- end
- plr:GossipComplete()
- end
- RegisterUnitEvent(600009, 1, Trainer_On_Combat)
- RegisterUnitGossipEvent(600008, 1, Trainer_Talk)
- RegisterUnitGossipEvent(600008, 2, Trainer_Choose)
- RegisterServerHook(14, Quest_On_Accept)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement