Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DM = {}
- DM.VAR = {}
- local OBJECT_END = 0x0006
- local GAMEOBJECT_BYTES_1 = OBJECT_END + 0x000B
- local UNIT_FIELD_FLAGS = OBJECT_END + 0x0035 -- Size: 1, Type: INT, Flags: PUBLIC
- local UNIT_FLAG_NOT_SELECTABLE = 0x02000000 -- 26 33554432 cannot select the unit
- local UNIT_FIELD_BYTES_1 = OBJECT_END + 0x0044
- SetDBCSpellVar(47591, "c_is_flags", 0x01000)
- -- First Boss -----------------------------------------------------------------------------
- function DM.VAR.FirstBossCombat(pUnit, Event)
- local id = pUnit:GetInstanceID()
- if id == nil then id = 1 end
- DM[id] = DM[id] or {VAR={}}
- pUnit:SetScale(1.2)
- pUnit:SendChatMessage(12,0,"The entertainment has arrived!")
- pUnit:PlaySoundToSet(13472)
- pUnit:RegisterEvent("DM.VAR.CheckHealthPctFirst", 2500, 0)
- pUnit:RegisterEvent("DM.VAR.Firstbossrandomspells", 2000, 0)
- end
- function DM.VAR.SpawnCatapult(pUnit, event)
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) -- Untargetable
- end
- RegisterUnitEvent(27881, 18, "DM.VAR.SpawnCatapult")
- function DM.VAR.CheckHealthPctFirst(pUnit)
- if pUnit:GetHealthPct() < 50 then
- pUnit:SetScale(1)
- pUnit:SendChatMessage(12,0,"Say hello to some little friends of mine!")
- pUnit:PlaySoundToSet(13476)
- pUnit:RemoveEvents()
- --pUnit:SpawnCreature(116862, -192, -451, 55, 0, 35, 360000)
- local id = pUnit:GetInstanceID()
- if id == nil then id = 1 end
- DM[id] = DM[id] or {VAR={}}
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, 2) -- unattackable
- pUnit:DisableMelee(true)
- local vehicle = pUnit:GetCreatureNearestCoords(-204.6, -446, 53.8, 27881)
- vehicle:SetUInt32Value(UNIT_FIELD_FLAGS, 0) -- Targetable
- pUnit:EnterVehicle(vehicle, 1000)
- vehicle:RegisterEvent("DM.VAR.launchmissilesvehicle", 4000, 0)
- pUnit:RegisterEvent("DM.VAR.THrowbombsAtPlayersFirst", 7500, 0)
- end
- end
- --[[function visualslimespawn(pUnit, event)
- pUnit:FullCastSpell(70343) -- visual
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) -- Untargetable
- pUnit:RegisterEvent("CastVisualsetcfaeo", 1000, 1)
- end
- function CastVisualsetcfaeo(pUnit)
- pUnit:CastSpell(70343) -- visual
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) -- Untargetable
- end
- RegisterUnitEvent(116862, 18, "visualslimespawn")]]
- function DM.VAR.launchmissilesvehicle(pUnit)
- if pUnit then
- if pUnit:IsAlive() then
- local plr = pUnit:GetRandomPlayer(0)
- if plr ~= nil then
- pUnit:CastSpellOnTarget(9796, plr) -- poison
- pUnit:FullCastSpellOnTarget(48211, plr) -- fire at target
- end
- else
- pUnit:RemoveEvents()
- pUnit:Despawn(2000, 0)
- end
- end
- end
- function DM.VAR.THrowbombsAtPlayersFirst(pUnit)
- if pUnit:GetVehicleBase() == nil then
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, 0) -- attackable
- pUnit:DisableMelee(false)
- pUnit:RemoveEvents()
- pUnit:PlaySoundToSet(13473)
- pUnit:SendChatMessage(12,0,"The fun is just beginning!")
- pUnit:CastSpell(53212) -- visual
- pUnit:SetScale(1.2)
- pUnit:RegisterEvent("DM.VAR.Firstbossrandomspells", 5000, 0)
- else
- if pUnit:GetVehicleBase():IsAlive() then
- local pla = pUnit:GetRandomPlayer(0)
- if pla ~= nil then
- --pUnit:CastSpellOnTarget(4068, plr) -- grenade
- pUnit:CastSpellAoF(pla:GetX(), pla:GetY(), pla:GetZ(), 4068)
- end
- else
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, 0) -- attackable
- pUnit:DisableMelee(false)
- pUnit:RemoveEvents()
- pUnit:ExitVehicle()
- pUnit:PlaySoundToSet(13473)
- pUnit:SendChatMessage(12,0,"The fun is just beginning!")
- pUnit:CastSpell(53212) -- visual
- pUnit:SetScale(1.2)
- pUnit:RegisterEvent("DM.VAR.Firstbossrandomspells", 3000, 0)
- end
- end
- end
- function DM.VAR.Firstbossrandomspells(pUnit)
- local choice = math.random(1,3)
- if choice == 1 then
- local plr = pUnit:GetRandomPlayer(0)
- if plr ~= nil then
- pUnit:CastSpellOnTarget(3396, plr) -- poison
- end
- elseif choice == 2 then
- local plr = pUnit:GetRandomPlayer(0)
- if plr ~= nil then
- pUnit:CastSpellOnTarget(744, plr) -- poison
- end
- elseif choice == 3 then
- local plr = pUnit:GetRandomPlayer(0)
- if plr ~= nil then
- pUnit:CastSpellOnTarget(5208, plr) -- poison
- end
- end
- end
- function DM.VAR.FirstBossDone(pUnit, Event)
- --if Event == 2 then
- if pUnit:IsAlive() then
- pUnit:RemoveEvents()
- pUnit:Despawn(3000, 4000)
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, 0) -- attackable
- pUnit:DisableMelee(false)
- --[[local slime = pUnit:GetCreatureNearestCoords(-192, -451, 54.5, 116862)
- slime:RemoveAura(70343) -- visual]]
- if pUnit:GetVehicleBase() ~= nil then
- pUnit:GetVehicleBase():RemoveEvents()
- pUnit:GetVehicleBase():SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
- pUnit:ExitVehicle()
- end
- else
- pUnit:RemoveEvents()
- pUnit:GetGameObjectNearestCoords(-191.6, -456.4, 54.5, 13965):SetByte(GAMEOBJECT_BYTES_1,0,0) -- open door
- --[[pUnit:GetCreatureNearestCoords(-192, -451, 54.5, 116862):RemoveAura(70343) -- visual
- pUnit:GetCreatureNearestCoords(-192, -451, 54.5, 116862):Despawn(5000, 0)]]
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, 0) -- attackable
- pUnit:DisableMelee(false)
- local slime = pUnit:GetCreatureNearestCoords(-192, -451, 54.5, 116862)
- slime:RemoveAura(70343) -- visual
- if pUnit:GetVehicleBase() ~= nil then
- pUnit:GetVehicleBase():RemoveEvents()
- pUnit:GetVehicleBase():SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
- pUnit:ExitVehicle()
- end
- end
- end
- RegisterUnitEvent(253201, 1, "DM.VAR.FirstBossCombat")
- RegisterUnitEvent(253201, 2, "DM.VAR.FirstBossDone")
- RegisterUnitEvent(253201, 4, "DM.VAR.FirstBossDone")
- -- Second boss -----------------------------------------------------------------------------
- function DM.VAR.SecondBossCombat(pUnit, Event)
- pUnit:RegisterEvent("DM.VAR.FreezeCurrentTarget", 8000, 0)
- pUnit:RegisterEvent("DM.VAR.PullTargetToSpider", 5000, 0)
- pUnit:RegisterEvent("DM.VAR.FreezeAllTargetsSpider", 17000, 0)
- pUnit:RegisterEvent("DM.VAR.StompNearbyPlayers", math.random(1000, 21000), 1)
- pUnit:RegisterEvent("DM.VAR.TrapPlayerInCoCoon", 25000, 0)
- pUnit:RegisterEvent("DM.VAR.ENrangeNearLowHealth", 5000, 0)
- end
- function DM.VAR.FreezeCurrentTarget(pUnit)
- local plr = pUnit:GetRandomPlayer(0)
- if plr ~= nil then
- pUnit:FullCastSpellOnTarget(15471, plr) -- Stun for 8 seconds
- end
- end
- function DM.VAR.PullTargetToSpider(pUnit)
- local plr = pUnit:GetRandomPlayer(0)
- if plr ~= nil then
- local cacoon = pUnit:GetCreatureNearestCoords(plr:GetX(), plr:GetY(), plr:GetZ(), 249252)
- if cacoon ~= nil then
- if plr:GetDistanceYards(cacoon) < 3 then
- -- do nothing
- else
- pUnit:FullCastSpellOnTarget(28434, plr) -- Pull player to npc
- end
- else
- pUnit:FullCastSpellOnTarget(28434, plr) -- Pull player to npc
- end
- end
- end
- function DM.VAR.FreezeAllTargetsSpider(pUnit)
- pUnit:CastSpell(56632) -- Freeze all nearby (root)
- end
- function DM.VAR.StompNearbyPlayers(pUnit)
- pUnit:CastSpell(11681) -- damage nearby players (hellfire effect)
- pUnit:RegisterEvent("DM.VAR.StompNearbyPlayers", math.random(1000, 21000), 1)
- end
- function DM.VAR.ENrangeNearLowHealth(pUnit)
- if pUnit:GetHealthPct() < 30 then
- pUnit:CastSpell(42705) -- Enrage (stacks)
- pUnit:CastSpell(30494) -- damage nearby people and slow
- pUnit:CastSpell(56741) -- visual
- end
- end
- function DM.VAR.TrapPlayerInCoCoon(pUnit)
- local plr = pUnit:GetRandomPlayer(0)
- if plr ~= nil then
- local cacoon = pUnit:GetCreatureNearestCoords(plr:GetX(), plr:GetY(), plr:GetZ(), 249252)
- if cacoon ~= nil then
- if plr:GetDistanceYards(cacoon) < 3 then
- -- Re-register?
- else
- pUnit:SendChatMessage(42,0, plr:GetName().." has been trapped in a cacoon!")
- plr:Root()
- plr:SetScale(0.5)
- plr:SetPlayerLock(true)
- pUnit:SpawnCreature(249252, plr:GetX(), plr:GetY(), plr:GetZ(), 0, 21, 120000)
- end
- else
- pUnit:SendChatMessage(42,0, plr:GetName().." has been trapped in a cacoon!")
- plr:Root()
- plr:SetScale(0.5)
- plr:SetPlayerLock(true)
- pUnit:SpawnCreature(249252, plr:GetX(), plr:GetY(), plr:GetZ(), 0, 21, 120000)
- end
- end
- end
- -- Cocoon
- function DM.VAR.TrappedCheckerRegisterTLDR(pUnit, Event)
- pUnit:RegisterEvent("DM.VAR.TrappedPlayerSpawnCheckTLDR", 1000, 0)
- end
- function DM.VAR.TrappedPlayerSpawnCheckTLDR(pUnit)
- local plr = pUnit:GetClosestPlayer()
- if plr ~= nil then
- if ((pUnit:GetHealthPct() < 5) or (not plr:IsAlive())) then
- pUnit:RemoveEvents()
- plr:Unroot()
- plr:SetScale(1)
- plr:SetPlayerLock(false)
- pUnit:Emote(387, 1000)
- pUnit:Despawn(100, 0)
- else
- pUnit:Strike(plr, 2, 70569, 40, 80, 1.2)
- end
- end
- end
- RegisterUnitEvent(249252, 18, "DM.VAR.TrappedCheckerRegisterTLDR")
- function DM.VAR.SeocndBossDone(pUnit, Event)
- pUnit:RemoveEvents()
- if (Event == 4) then
- pUnit:GetGameObjectNearestCoords(-290.4, -535.8, 49.5, 16400):SetByte(GAMEOBJECT_BYTES_1,0,0) -- open door
- end
- end
- RegisterUnitEvent(279761, 1, "DM.VAR.SecondBossCombat")
- RegisterUnitEvent(279761, 2, "DM.VAR.SeocndBossDone")
- RegisterUnitEvent(279761, 4, "DM.VAR.SeocndBossDone")
- -- Third boss -----------------------------------------------------------------------------
- function DM.VAR.FORGE_SHOCKWAVE(pUnit,Event)
- pUnit:RemoveEvents()
- local id = pUnit:GetInstanceID()
- if id == nil then id = 1 end
- DM[id] = DM[id] or {VAR={}}
- DM[id].VAR.Shock = pUnit:GetRandomPlayer(0)
- if pUnit:GetDistanceYards(DM[id].VAR.Shock) < 30 then
- if DM[id].VAR.Shock:IsDead() == false then
- pUnit:SetFacing(DM[id].VAR.Shock:GetO())
- pUnit:SendChatMessageToPlayer(42,0,"Forgemaster Arkvoth Targets YOU!", DM[id].VAR.Shock)
- pUnit:SendChatMessage(42,0,"Forgemaster Arkvoth Begins to Cast \124cff71d5ff\124Hspell:58977\124h[Shockwave]\124h\124r")
- pUnit:Root()
- pUnit:RegisterEvent("DM.VAR.FORGE_SHOCKWAVECAST", 2000,1)
- else
- DM[id].VAR.Shock = nil
- end
- end
- end
- function DM.VAR.FORGE_SHOCKWAVECAST(pUnit,Event)
- local id = pUnit:GetInstanceID()
- if id == nil then id = 1 end
- DM[id] = DM[id] or {VAR={}}
- pUnit:SetFacing(0)
- pUnit:CastSpellOnTarget(58977,DM[id].VAR.Shock)
- DM[id].VAR.Shock = nil
- pUnit:RegisterEvent("DM.VAR.FORGE_Unroot", 1000,1)
- pUnit:RegisterEvent("DM.VAR.FORGE_SHOCKWAVE", 16000,0)
- pUnit:RegisterEvent("DM.VAR.FORGE_FIREPATCH", 6000,0)
- pUnit:RegisterEvent("DM.VAR.FORGE_FIRECHARGE", 10000,0)
- pUnit:RegisterEvent("DM.VAR.FORGE_MELTARMOR", 15000,1)
- pUnit:RegisterEvent("DM.VAR.FORGE_HASAURA", 1000,0)
- end
- function DM.VAR.FORGE_Unroot(pUnit,Event)
- pUnit:Unroot()
- pUnit:SetFacing(1)
- end
- function DM.VAR.FORGE_DEAD(pUnit,Event)
- pUnit:RemoveEvents()
- pUnit:Unroot()
- pUnit:GetGameObjectNearestCoords(-169.5, -580.5, 19.31, 16399):SetByte(GAMEOBJECT_BYTES_1,0,0)
- end
- function DM.VAR.FORGE_COMBAT(pUnit,Event)
- pUnit:RegisterEvent("DM.VAR.FORGE_SHOCKWAVE", 16000,0)
- pUnit:RegisterEvent("DM.VAR.FORGE_FIREPATCH", 6000,0)
- pUnit:RegisterEvent("DM.VAR.FORGE_FIRECHARGE", 10000,0)
- pUnit:RegisterEvent("DM.VAR.FORGE_MELTARMOR", 4000,1)
- pUnit:RegisterEvent("DM.VAR.FORGE_HASAURA", 5000,0)
- end
- function DM.VAR.FORGE_LEAVE(pUnit,Event)
- pUnit:RemoveEvents()
- pUnit:Unroot()
- pUnit:Despawn(3000,4000)
- for place,creatures in pairs(pUnit:GetInRangeUnits()) do
- if creatures:GetEntry() == 6899 then
- creatures:Despawn(1,0)
- end
- end
- end
- function DM.VAR.FORGE_FIREPATCH(pUnit,Event)
- pUnit:CastSpell(19823)
- pUnit:SpawnCreature(6805, pUnit:GetX(), pUnit:GetY(), pUnit:GetZ(), 0, 35, 15000)
- end
- function DM.VAR.FORGE_MELTARMOR(pUnit,Event)
- local tank = pUnit:GetMainTank()
- if tank ~= nil then
- if pUnit:GetDistanceYards(tank) < 12 then
- pUnit:CastSpellOnTarget(61509,tank)
- end
- end
- end
- function DM.VAR.FORGE_FIRECHARGE(pUnit,Event)
- local plr = pUnit:GetRandomPlayer(7)
- if plr ~= nil then
- if pUnit:GetDistanceYards(plr) < 30 then
- if plr:IsDead() == false then
- pUnit:FullCastSpellOnTarget(33971,plr)
- pUnit:RegisterEvent("DM.VAR.FORGE_FIRECHARGEPLANT", 1500,1)
- end
- end
- end
- end
- function DM.VAR.FORGE_FIRECHARGEPLANT(pUnit,Event)
- pUnit:CastSpell(60290)
- pUnit:SpawnCreature(6805, pUnit:GetX(), pUnit:GetY(), pUnit:GetZ(), 0, 35, 15000)
- end
- RegisterUnitEvent(6888, 1, "DM.VAR.FORGE_COMBAT")
- RegisterUnitEvent(6888, 2, "DM.VAR.FORGE_LEAVE")
- RegisterUnitEvent(6888, 4, "DM.VAR.FORGE_DEAD")
- function DM.VAR.STEAMSURGE_DEAD(pUnit,Event)
- pUnit:RemoveEvents()
- pUnit:SpawnCreature(6812, pUnit:GetX(), pUnit:GetY(), pUnit:GetZ(), 0, 35, 15000)
- pUnit:SpawnCreature(6805, pUnit:GetX(), pUnit:GetY(), pUnit:GetZ(), 0, 35, 18000)
- end
- RegisterUnitEvent(6899, 4, "DM.VAR.STEAMSURGE_DEAD")
- function DM.VAR.FireDummyDamage(pUnit,Event)
- pUnit:CastSpell(42345)
- local PlayersAllAround = pUnit:GetInRangePlayers()
- for a, players in pairs(PlayersAllAround) do
- if pUnit:GetDistanceYards(players) < 3.5 then
- if players:IsDead() == false then
- pUnit:Strike(players,1,5679,300,450,1)
- end
- end
- end
- end
- function DM.VAR.FireDummyENEMY(pUnit,Event)
- local Forge = pUnit:GetCreatureNearestCoords(pUnit:GetX(),pUnit:GetY(),pUnit:GetZ(), 6888)
- if Forge ~= nil then
- if pUnit:GetDistanceYards(Forge) < 5 then
- if Forge:IsAlive() then
- local tank = Forge:GetMainTank()
- if tank ~= nil then
- tank:CastSpellOnTarget(61509,Forge)
- end
- end
- end
- end
- end
- function DM.VAR.FireDummySpawn(pUnit,Event)
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
- pUnit:RegisterEvent("DM.VAR.FireDummyDamage",1000,0)
- pUnit:RegisterEvent("DM.VAR.FireDummyENEMY",4000,0)
- pUnit:CastSpell(42345)
- end
- function DM.VAR.FORGE_HASAURA(pUnit,Event)
- local id = pUnit:GetInstanceID()
- if id == nil then id = 1 end
- DM[id] = DM[id] or {VAR={}}
- if DM[id].VAR.Stacks == nil then DM[id].VAR.Stacks = 0 end
- -- if he has aura
- if pUnit:HasAura(61509) == true then
- -- add to stacks
- DM[id].VAR.Stacks = DM[id].VAR.Stacks + 1
- -- if stacks more than 0, cast spell
- pUnit:SendChatMessage(12,0,"I have "..DM[id].VAR.Stacks.." stacks!")
- if DM[id].VAR.Stacks >= 1 then
- -- cast spell
- local PlayersAllAround = pUnit:GetInRangePlayers()
- for a, players in pairs(PlayersAllAround) do
- if pUnit:GetDistanceYards(players) < 20 then
- if players:IsAlive() == true then
- pUnit:CastSpellOnTarget(13878,players)
- end
- end
- end
- else
- -- if more than one stack, spawn adds
- pUnit:SendChatMessage(12,0,"Do I have the aura?")
- if pUnit:HasAura(61509) == false then
- pUnit:SendChatMessage(12,0,"I don't have the aura! Do I have stacks?")
- if DM[id].VAR.Stacks >= 1 then
- pUnit:SendChatMessage(12,0,"Passed stack check!")
- -- spawn creature on nearby players
- DM[id].VAR.Stacks = 0
- local PlayersAllAround = pUnit:GetInRangePlayers()
- for a, players in pairs(PlayersAllAround) do
- if pUnit:GetDistanceYards(players) < 40 then
- pUnit:SendChatMessage(12,0,"Spawning creatures!")
- pUnit:SpawnCreature(6899, players:GetX(), players:GetY(), players:GetZ(), 0, 35, 320000)
- pUnit:SpawnCreature(6812, players:GetX(), players:GetY(), players:GetZ(), 0, 35, 15000)
- end
- end
- end
- end
- end
- end
- end
- RegisterUnitEvent(6805, 18, "DM.VAR.FireDummySpawn")
- -- Last Boss - Dragon --------------------------------------------------------------------
- function DM.VAR.LastBossSPAWNS(pUnit, Event)
- if pUnit:HasAura(60534) then
- pUnit:RemoveAura(60534) -- flying
- end
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, 2) -- Unkillable
- pUnit:SetUInt32Value(UNIT_FIELD_BYTES_1, 3) -- Sleep
- pUnit:RegisterEvent("DM.VAR.SpamEmoteForPlayersWhoAreDelayed", 1000, 0)
- end
- function DM.VAR.SpamEmoteForPlayersWhoAreDelayed(pUnit)
- local plr = pUnit:GetClosestPlayer()
- if plr ~= nil then
- if plr:IsAlive() then
- if pUnit:GetDistanceYards(plr) < 30 then
- pUnit:RemoveEvents()
- pUnit:PlaySoundToSet(17311) -- epic music
- pUnit:SetUInt32Value(UNIT_FIELD_BYTES_1, 0) -- Get Up
- pUnit:SetMovementFlags(2) -- This creature flies
- pUnit:RegisterEvent("DM.VAR.FinalBossFlyIntoAirVisual", 4000, 1)
- pUnit:RegisterEvent("DM.VAR.FinalBossFlyIntoAirPermanent", 6950, 1)
- else
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, 2) -- Unkillable
- pUnit:SetUInt32Value(UNIT_FIELD_BYTES_1, 3) -- Sleep
- end
- end
- end
- end
- function DM.VAR.FinalBossFlyIntoAirVisual(pUnit)
- pUnit:Emote(448, 3000) -- Fly into the air
- end
- function DM.VAR.FinalBossFlyIntoAirPermanent(pUnit)
- pUnit:CastSpell(60534)
- pUnit:SetPosition(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ()+15, pUnit:GetO())
- pUnit:MoveTo(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ()+0.1, 0)
- local id = pUnit:GetInstanceID()
- if id == nil then id = 1 end
- DM[id] = DM[id] or {VAR={}}
- DM[id].VAR.finali = 0
- pUnit:RegisterEvent("DM.VAR.HandleEventsAsTheyHappenLast", 500, 1)
- end
- function DM.VAR.HandleEventsAsTheyHappenLast(pUnit)
- local id = pUnit:GetInstanceID()
- if id == nil then id = 1 end
- DM[id] = DM[id] or {VAR={}}
- if DM[id].VAR.finali == nil then
- DM[id].VAR.finali = 0
- end
- if DM[id].VAR.finali == 0 then
- pUnit:SetMovementFlags(2)
- pUnit:FullCastSpell(3129) -- Frost breath
- pUnit:RegisterEvent("DM.VAR.HandleEventsAsTheyHappenLast", 500, 1)
- elseif DM[id].VAR.finali == 1 then
- for place,players in pairs(pUnit:GetInRangePlayers()) do
- players:CastSpell(47591) -- Freeze self
- end
- pUnit:RegisterEvent("DM.VAR.HandleEventsAsTheyHappenLast", 2000, 1)
- elseif DM[id].VAR.finali == 2 then
- pUnit:MoveTo(64.7, -763.6, 142, 0)
- pUnit:RegisterEvent("DM.VAR.HandleEventsAsTheyHappenLast", 5000, 1)
- elseif DM[id].VAR.finali == 3 then
- pUnit:MoveTo(82.8, -765, 140, 0)
- pUnit:RegisterEvent("DM.VAR.HandleEventsAsTheyHappenLast", 5000, 1)
- elseif DM[id].VAR.finali == 4 then
- for place,players in pairs(pUnit:GetInRangePlayers()) do
- if players:HasAura(47591) then
- players:RemoveAura(47591) -- Freeze self
- end
- end
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, 0) -- Attackable
- DM[id].VAR.dragon = pUnit
- pUnit:RegisterEvent("DM.VAR.IceLancePeopleFinalBoss", 5000, 0)
- pUnit:RegisterEvent("DM.VAR.CheckifWipedLastBoss", 2000, 0)
- pUnit:RegisterEvent("DM.VAR.SpawnCyclonesLastBoss", 45000, 1)
- pUnit:RegisterEvent("DM.VAR.CheckForPlayerPhaseTwoFinal", 1000, 0)
- pUnit:RegisterEvent("DM.VAR.FinalSpawnBlizzards", 5000, 0)
- pUnit:RegisterEvent("DM.VAR.finalplaydramaticmusic", 5000, 1)
- elseif DM[id].VAR.finali == 6 then -- 5 is for cyclone
- pUnit:MoveTo(98, -789, 131.6, 0)
- pUnit:RegisterEvent("DM.VAR.HandleEventsAsTheyHappenLast", 4000, 1)
- elseif DM[id].VAR.finali == 7 then
- local plr = pUnit:GetClosestPlayer()
- if plr ~= nil then
- if plr:IsOnVehicle() then
- plr:ExitVehicle()
- end
- end
- pUnit:Emote(447, 3000) -- land
- pUnit:RegisterEvent("DM.VAR.HandleEventsAsTheyHappenLast", 2950, 1)
- elseif DM[id].VAR.finali == 8 then
- pUnit:RemoveAura(60534)
- pUnit:SetMovementFlags(1)
- pUnit:MoveTo(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ()+0.1, 0)
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, 0)
- pUnit:MoveTo(96.8, -753, 131.6, 0)
- pUnit:RegisterEvent("DM.VAR.CheckifWipedLastBoss", 2000, 0)
- pUnit:RegisterEvent("DM.VAR.HandleEventsAsTheyHappenLast", 5000, 1)
- elseif DM[id].VAR.finali == 9 then
- pUnit:SendChatMessage(42,0,"The Queen prepares to blast everyone in front of her!")
- pUnit:FullCastSpell(16094) -- ice breath
- pUnit:RegisterEvent("DM.VAR.HandleEventsAsTheyHappenLast", 2000, 1)
- elseif DM[id].VAR.finali == 10 then
- pUnit:RegisterEvent("DM.VAR.HandleEventsAsTheyHappenLast", 4000, 1)
- elseif DM[id].VAR.finali == 11 then
- pUnit:CastSpell(15531) -- frost nova
- pUnit:ChannelSpell(7083, pUnit)
- local d = 0
- while d ~= 6 do
- local plr = pUnit:GetRandomPlayer(0)
- if plr ~= nil then
- pUnit:SpawnCreature(30419, plr:GetX(), plr:GetY(), plr:GetZ(), plr:GetO(), 21, 30000)
- plr:CastSpell(69665) -- visual
- end
- d = d + 1
- end
- pUnit:RegisterEvent("DM.VAR.HandleEventsAsTheyHappenLast", 30000, 1)
- elseif DM[id].VAR.finali == 12 then
- pUnit:RemoveEvents()
- pUnit:StopChannel()
- pUnit:Emote(448, 3000) -- Fly into the air
- pUnit:RegisterEvent("DM.VAR.HandleEventsAsTheyHappenLast", 2950, 1)
- elseif DM[id].VAR.finali == 13 then
- pUnit:CastSpell(60534) -- flying
- pUnit:SetPosition(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ()+15, pUnit:GetO())
- pUnit:MoveTo(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ()+0.1, 0)
- pUnit:RegisterEvent("DM.VAR.HandleEventsAsTheyHappenLast", 2000, 1)
- elseif DM[id].VAR.finali == 14 then
- pUnit:SetMovementFlags(2)
- pUnit:MoveTo(64.7, -763.6, 142, 0)
- pUnit:RegisterEvent("DM.VAR.HandleEventsAsTheyHappenLast", 5000, 1)
- elseif DM[id].VAR.finali == 15 then
- pUnit:MoveTo(82.8, -765, 140, 0)
- pUnit:RegisterEvent("DM.VAR.HandleEventsAsTheyHappenLast", 5000, 1)
- elseif DM[id].VAR.finali == 16 then
- pUnit:RegisterEvent("DM.VAR.IceLancePeopleFinalBoss", 5000, 0)
- pUnit:RegisterEvent("DM.VAR.CheckifWipedLastBoss", 2000, 0)
- --pUnit:RegisterEvent("DM.VAR.SpawnCyclonesLastBoss", 45000, 1)
- --pUnit:RegisterEvent("DM.VAR.CheckForPlayerPhaseTwoFinal", 1000, 0)
- pUnit:RegisterEvent("DM.VAR.FinalSpawnBlizzards", 5000, 0)
- end
- DM[id].VAR.finali = DM[id].VAR.finali + 1
- end
- function DM.VAR.finalplaydramaticmusic(pUnit)
- pUnit:PlaySoundToSet(17288) -- Dramatic music
- end
- function DM.VAR.IceLancePeopleFinalBoss(pUnit)
- if math.random(1,4) == 4 then
- pUnit:FullCastSpell(8398) -- frostobolt volley
- else
- local plr = pUnit:GetRandomPlayer(0)
- if plr ~= nil then
- if (not plr:IsOnVehicle()) then
- pUnit:CastSpellOnTarget(42913, plr) -- ice lance
- end
- end
- end
- end
- function DM.VAR.FinalSpawnBlizzards(pUnit)
- local plr = pUnit:GetRandomPlayer(0)
- if plr ~= nil then
- pUnit:SpawnCreature(232159, plr:GetX(), plr:GetY(), plr:GetZ(), 0, 21, 15000)
- end
- end
- function DM.VAR.BlizzardSPawnDa(pUnit, Event)
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) -- Untargetable
- pUnit:RegisterEvent("DM.VAR.CastBlizzardSpellDinal", 1000, 1)
- end
- function DM.VAR.CastBlizzardSpellDinal(pUnit)
- pUnit:CastSpellAoF(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ(), 19099)
- pUnit:RegisterEvent("DM.VAR.CastBlizzardSpellDamage", 1000, 9)
- end
- function DM.VAR.CastBlizzardSpellDamage(pUnit)
- for k,plrs in pairs(pUnit:GetInRangePlayers()) do
- if plrs:IsAlive() then
- if plrs:GetDistanceYards(pUnit) < 10 then
- pUnit:Strike(plrs,1,19099,140,220,1.1)
- end
- end
- end
- end
- RegisterUnitEvent(232159, 18, "DM.VAR.BlizzardSPawnDa")
- function DM.VAR.SpawnCyclonesLastBoss(pUnit)
- pUnit:SendChatMessage(42,0,"A cyclone has appeared, use it!")
- local id = pUnit:GetInstanceID()
- if id == nil then id = 1 end
- DM[id] = DM[id] or {VAR={}}
- if DM[id].VAR.finali == 5 then
- pUnit:SpawnCreature(323321, 90.225, -765.6, 131.6, 0, 35, 120000)
- end
- DM[id].VAR.finali = DM[id].VAR.finali + 1
- end
- function DM.VAR.CheckForPlayerPhaseTwoFinal(pUnit)
- local plr = pUnit:GetClosestPlayer()
- if plr ~= nil then
- if plr:IsOnVehicle() then
- pUnit:RemoveEvents()
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, 2)
- pUnit:MoveTo(63.9, -784.6, 140, 0)
- pUnit:RegisterEvent("DM.VAR.HandleEventsAsTheyHappenLast", 2500, 1)
- end
- end
- end
- function DM.VAR.CheckifWipedLastBoss(pUnit)
- -- The boss cannot leave combat since it never enters combat - vehicle
- local reset = true
- for place,players in pairs(pUnit:GetInRangePlayers()) do
- if players:IsAlive() then
- reset = false
- end
- end
- if reset then
- pUnit:RemoveEvents()
- pUnit:ReturnToSpawnPoint()
- pUnit:RegisterEvent("DM.VAR.LastBossSPAWNS", 10000, 1)
- end
- end
- function DM.VAR.BossLeaveOrDeadFinal(pUnit, Event)
- pUnit:RemoveEvents()
- -- spawn chest with loot
- end
- RegisterUnitEvent(30609, 18, "DM.VAR.LastBossSPAWNS")
- RegisterUnitEvent(30609, 4, "DM.VAR.BossLeaveOrDeadFinal")
- function DM.VAR.CycleJumpToCreatureVisual(pUnit, Event)
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) -- Untargetable
- pUnit:RegisterEvent("DM.VAR.CycloneVisualPrepare", 1000, 1)
- end
- function DM.VAR.CycloneVisualPrepare(pUnit)
- pUnit:CastSpell(32332) -- cyclone visual
- pUnit:RegisterEvent("DM.VAR.Cyclevisualchancetospawn", 1000, 0)
- end
- function DM.VAR.Cyclevisualchancetospawn(pUnit)
- local plr = pUnit:GetClosestPlayer()
- if plr ~= nil then
- if plr:GetDistanceYards(pUnit) < 5 then
- local id = pUnit:GetInstanceID()
- if id == nil then id = 1 end
- DM[id] = DM[id] or {VAR={}}
- if DM[id].VAR.dragon ~= nil then
- pUnit:RemoveEvents()
- plr:EnterVehicle(DM[id].VAR.dragon, 1000)
- pUnit:Despawn(1000, 0)
- end
- end
- end
- end
- RegisterUnitEvent(323321, 18, "DM.VAR.CycleJumpToCreatureVisual")
- ------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment