Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- *******************************************************************
- ** **
- ** Author: Skyrazer **
- ** Completion: 90% **
- ** In Progress: Acheivement tiggers **
- ** Soul Harvest **
- ** **
- *******************************************************************
- ]]
- SetDBCSpellVar(69146, "EffectRadiusIndex", 5)
- SetDBCSpellVar(69146, "EffectBasePoints", 6000)
- SetDBCSpellVar(70823, "EffectRadiusIndex", 5)
- SetDBCSpellVar(70823, "EffectBasePoints", 8000)
- SetDBCSpellVar(70824, "EffectRadiusIndex", 5)
- SetDBCSpellVar(70824, "EffectBasePoints", 9000)
- SetDBCSpellVar(70825, "EffectRadiusIndex", 5)
- SetDBCSpellVar(70825, "EffectBasePoints", 11000)
- --[[
- *******************************************************************
- ** **
- ** TABLES & VARIABLES **
- ** **
- *******************************************************************
- ]]
- vars = {};
- lordm = {};
- spike = {};
- func = {};
- spell = {
- flame = {
- { spell = 69146 , life = 3000 , damage = 6000},
- { spell = 70823 , life = 3000 , damage = 8000},
- { spell = 70824 , life = 8000 , damage = 9000},
- { spell = 70825 , life = 8000 , damage = 11000}
- },
- storm = {
- { aura = 70834 , duration = 20000 , charge = 3 , maxdam = 6000},
- { aura = 70835 , duration = 20000 , charge = 3 , maxdam = 12000},
- { aura = 70835 , duration = 30000 , charge = 4 , maxdam = 12000},
- { aura = 70836 , duration = 30000 , charge = 4 , maxdam = 14000}
- },
- slice = { 69055 , 70814 , 69055 , 70814 }
- };
- --[[
- *******************************************************************
- ** **
- ** LORD MARROWGAR **
- ** **
- *******************************************************************
- ]]
- function func.lordm.onspawn(pUnit, event)
- pUnit:RegisterEvent("func.lordm.firstenter", 1000, 0)
- local id = pUnit:GetInstanceID()
- vars[id].lordm.start = false
- end
- function func.lordm.firstenter(pUnit, event)
- local plr = pUnit:GetClosestPlayer()
- if plr ~= nil then
- if pUnit:GetDistanceYards(player) <= 65 then
- pUnit:RemoveEvents()
- pUnit:PlaySoundToSet(16950)
- pUnit:SendChatMessage(14, 0, "This is the beginning AND the end, mortals. None may enter the master's sanctum!")
- end
- end
- end
- function func.lordm.oncombat (pUnit, Event)
- math.randomseed(os.time())
- local sUnit = tostring(pUnit)
- local id = pUnit:GetInstanceID()
- local d = pUnit:GetDungeonDifficulty() + 1
- lordm[id].dif = d
- lordm[id].unit = sUnit
- vars[id].starttime = os.time()
- pUnit:SendChatMessage(14, 0, "The Scourge will wash over this world as a swarm of death and destruction!")
- pUnit:PlaySoundToSet(16941)
- pUnit:RegisterEvent("func.lordm.stand", 100, 1)
- end
- function func.lordm.enrage (pUnit, Event)
- local id = pUnit:GetInstanceID()
- if (os.difftime( os.time() , vars[id].starttime ) == 600) then
- if (pUnit:HasAura(69076) == true) then pUnit:RemoveAura(69076) end
- pUnit:RemoveEvents()
- pUnit:CastSpell(26662)
- end
- end
- function func.lordm.stand (pUnit, Event)
- pUnit:RegisterEvent("func.lordm.enrage", 100, 0)
- pUnit:RegisterEvent("func.lordm.boneslice", 2000, 0)
- pUnit:RegisterEvent("func.lordm.bonestorm", 45000, 1)
- pUnit:RegisterEvent("func.lordm.bonespike", 14000, 0)
- pUnit:RegisterEvent("func.lordm.coldflame", 4000, 0)
- end
- function func.lordm.boneslice (pUnit, Event)
- local id = pUnit:GetInstanceID()
- local u = tostring(pUnit)
- pUnit:CastSpell(spell.slice[lordm[id].dif])
- end
- function func.lordm.coldflame (pUnit, Event)
- local plr = nil
- local id = pUnit:GetInstanceID()
- local t = false
- lordm[id].cfcast = lordm[id].cfcast + 1
- local cast = lordm[id].cfcast
- for _, v in pairs (pUnit:GetInRangePlayers()) do
- if pUnit:GetDistanceYards(v) > 10 then
- t = true
- vars[id].temp.m = 10
- break
- end
- end
- if (t == false) then
- plr = pUnit:GetMainTank()
- vars[id].temp.m = plr:GetDistance()
- end
- if (plr == nil) then plr = pUnit:GetRandomPlayer(2) end
- if (plr == nil) then plr = pUnit:GetRandomPlayer(2) end
- vars[id].temp.flametar = plr
- pUnit:CastSpell(69138)
- local x,y,z,o = pUnit:GetLocation()
- pUnit:SpawnCreature(6, x, y, z, o, 14, 0)
- end
- function func.lordm.bonespike (pUnit, Event)
- pUnit:SendChatMessage(14, 0, "Bound by bone!")
- pUnit:PlaySoundToSet(16947)
- pUnit:FullCastSpell(69057) -- Casts the spell "on himself", as it is really a dummy spell
- end
- function func.lordm.bonestorm (pUnit, Event)
- pUnit:RemoveEvents()
- local sUnit = tostring(pUnit)
- local id = pUnit:GetInstanceID()
- local d = lordm[id].dif
- if (d == 3 or 4) then
- local timer = (spell.storm[d].duration/spell.storm[d].charge) - 2000
- local times = spell.storm[d].duration/timer
- pUnit:RegisterEvent("func.lordm.bonespike", timer, times)
- end
- pUnit:Root()
- pUnit:FullCastSpell(69076)
- pUnit:SendChatMessage(14, 0, "BONE STORM!")
- pUnit:SendChatMessage(42, 0, "BONE STORM!")
- pUnit:PlaySoundToSet(16946)
- local move = math.floor((spell.storm[d].duration/spell.storm[d].charge) - 1000)
- pUnit:RegisterEvent("func.lordm.enrage", 100, 0)
- pUnit:RegisterEvent("func.lordm.stormmove", move, spell.storm[d].charge)
- pUnit:RegisterEvent("func.lordm.stormstop", spell.storm[d].duration, 1)
- end
- function func.lordm.stormmove (pUnit, Event)
- local plr = pUnit:GetRandomPlayer(3)
- if (plr == nil) then local plr = pUnit:GetRandomPlayer(2) end
- if (plr == nil) then local plr = pUnit:GetRandomPlayer(0) end
- pUnit:Unroot()
- if (plr ~= nil) then
- local x,y,z = plr:GetLocation()
- pUnit:ModifyRunSpeed(18)
- pUnit:MoveTo(x, y, z)
- pUnit:Root()
- pUnit:CastSpell(69138)
- vars[id].temp.flametar = plr
- end
- end
- function func.lordm.stormeffect (pUnit, Event)
- local id = pUnit:GetInstanceID()
- vars[id].bsplr = {}
- local i = lordm[id].dif
- for _, v in pairs (pUnit:GetInRangePlayers()) do
- if pUnit:GetDistanceYards(v) <= 30 then
- table.insert(vars[id].bsplr, v , pUnit:GetDistanceYards(v))
- end
- end
- for n, d in next,vars[id].bsplr,nil do
- if (d <= 10) then local dam = spell.storm[i].maxdam end
- if (d > 10) then local dam = (1000 + (spell.storm[i].maxdam*(spell.storm[i].maxdam/100))) end
- pUnit:DealDamage(n,dam,spell.storm[i].aura)
- end
- vars[id].bsplr = nil
- end
- function func.lordm.stormstop (pUnit, Event)
- pUnit:Unroot()
- pUnit:ModifyRunSpeed(1)
- pUnit:RemoveAura(69076)
- pUnit:ClearThreatList()
- pUnit:RegisterEvent("func.lordm.stand", 100, 1)
- end
- function func.lordm.onkill (pUnit, Event)
- local id = pUnit:GetInstanceID()
- math.random(); math.random(); math.random()
- local x = math.random(1, 2)
- vars[id].yell = {
- [1] = { num = 16942 , speech = "More bones for the offering!" },
- [2] = { num = 16943 , speech = "Languish in damnation!" }
- }
- pUnit:PlaySoundToSet(vars[id].yell[x][num])
- pUnit:SendChatMessage(14, 0, vars[id].yell[x][speech])
- end
- function func.lordm.ondeath (pUnit, Event)
- pUnit:RemoveEvents()
- local id = pUnit:GetInstanceID()
- local d = lordm[id].dif
- math.random(); math.random(); math.random()
- -- Adding Shadowfrost shard if applicable
- local x = nil
- local plr = pUnit:GetRandomPlayer(0)
- for _, v in pairs (plr:GetGroupPlayers()) do
- if v:HasQuest(24548) == true then
- if (d == 2 or 4) then
- if d == 2 then local n = 25 else local n = 50 end
- if (math.random(1, 100) >= math.random(n, 100)) == true then pUnit:AddLoot( 50274 , 1 , 1 , true ) end
- end
- break
- end
- end
- vars[id] = nil
- lordm[id] = nil
- spike[id] = nil
- pUnit:PlaySoundToSet(16944)
- pUnit:SendChatMessage(12, 0, "I see... only darkness...")
- end
- function func.lordm.onleave (pUnit, Event)
- pUnit:RemoveEvents()
- vars[id] = nil
- lordm[id] = nil
- spike[id] = nil
- pUnit:Despawn(2000, 20000)
- end
- --[[
- *******************************************************************
- ** **
- ** COLD FLAME (and Kobold) **
- ** **
- *******************************************************************
- ]]
- function func.kobold.onspawn(pUnit, event)
- local id = pUnit:GetInstanceID()
- pUnit:Root()
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2)
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
- pUnit:SetInvisible(true)
- pUnit:SetCombatMeleeCapable(false)
- pUnit:SetCombatRangedCapable(false)
- local sUnit = tostring(pUnit)
- vars[id].spcount[sUnit] = 1
- local plr = vars[id].temp.flametar
- local m = vars[id].temp.m
- local d = lordm[id].dif
- local bx,by = pUnit:GetLocation()
- local px,py = plr:GetLocation()
- local angle = pUnit:CalcRadAngle( bx, by, px, py )
- pUnit:SetFaction(35)
- local storming = lordm[id].unit:HasAura(69076)
- if (storming == true) then
- for i=1,16 do
- table.insert ( vars[id].clmpts[sUnit], i, {
- ul = { x = bx + ((3 * i) * math.cos(angle + (math.pi / 4)) ) , y = by + ((3 * i) * math.sin(angle + (math.pi / 4)) ) },
- ll = { x = bx + ((3 * i) * math.cos(angle + (3 * (math.pi / 4))) ) , y = by + ((3 * i) * math.sin(angle + (3 * (math.pi / 4))) ) },
- lr = { x = bx + ((3 * i) * math.cos(angle + (5 * (math.pi / 4))) ) , y = by + ((3 * i) * math.sin(angle + (5 * (math.pi / 4))) ) },
- ur = { x = bx + ((3 * i) * math.cos(angle + (7 * (math.pi / 4))) ) , y = by + ((3 * i) * math.sin(angle + (7 * (math.pi / 4))) ) }
- })
- end
- pUnit:RegisterEvent("func.kobold.coldflames", 500, 16)
- else
- for i=1,16 do
- local r = (m + (2.5 * (i - 1)))
- table.insert (vars[id].cflmpt[sUnit], i, { x = (bx + (r * math.cos(angle))) , y = (by + (r * math.sin(angle)))})
- end
- pUnit:RegisterEvent("func.kobold.coldflame", 500, 16)
- end
- pUnit:RegisterEvent("func.kobold.remove", 8100, 1)
- pUnit:RegisterEvent("func.kobold.bossdead", 100, 0)
- end
- function func.kobold.coldflames(pUnit, event)
- local sUnit = tostring(pUnit)
- local id = pUnit:GetInstanceID()
- local v = vars[id].spcount[sUnit]
- local bx,by = pUnit:GetLocation()
- local d = lordm[id].dif
- for _, i in next,vars[id].clmpts[sUnit][v] do
- local z = pUnit:GetLandHeight( i.x, i.y )
- local o = pUnit:CalcRadAngle( bx, by, i.x, i.y )
- pUnit:SpawnCreature(36672, i.x, i.y, z, o, 14, spell.flame.life[d])
- end
- vars[id].spcount[sUnit] = v + 1
- end
- function func.kobold.coldflame(pUnit, event)
- local sUnit = tostring(pUnit)
- local id = pUnit:GetInstanceID()
- local v = vars[id].spcount[sUnit]
- local x = vars[id].cflmpts[sUnit][v].x
- local y = vars[id].cflmpts[sUnit][v].y
- local z = pUnit:GetLandHeight(x,y)
- local o = pUnit:GetOrientation()
- local d = lordm[id].dif
- pUnit:SpawnCreature(36672, x, y, z, o, 14, spell.flame.life[d])
- vars[id].spcount[sUnit] = v + 1
- end
- function func.kobold.remove(pUnit, event)
- local sUnit = tostring(pUnit)
- local id = pUnit:GetInstanceID()
- vars[id].spcount[sUnit] = nil
- vars[id].cflmpt[sUnit] = nil
- pUnit:RemoveEvents()
- pUnit:RemoveFromWorld()
- end
- function func.kobold.bossdead (pUnit, event)
- if vars[id] = nil then pUnit:RegisterEvent("func.kobold.remove", 100, 1) end
- end
- function func.flame.onspawn(pUnit, event)
- local id = pUnit:GetInstanceID()
- local d = lordm[id].dif
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2)
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
- pUnit:Root()
- pUnit:SetCombatMeleeCapable(false)
- pUnit:SetCombatRangedCapable(false)
- local times = spell.flame[d].life / 1000
- local timer = spell.flame[d].life / times
- pUnit:RegisterEvent("func.flame.spell", timer, times)
- end
- function func.flame.spell(pUnit, event)
- local id = pUnit:GetInstanceID()
- local d = lordm[id].dif
- local x,y,z = pUnit:GetLocation()
- pUnit:CastSpellAoF(x, y, z, spell.flame[d].spell)
- end
- --[[
- *******************************************************************
- ** **
- ** BONE SPIKE **
- ** **
- *******************************************************************
- ]]
- function func.spike.onspawn (pUnit, Event)
- local sUnit = tostring(pUnit)
- local id = pUnit:GetInstanceID()
- pUnit:Root()
- spike[id][sUnit] = pUnit:GetClosestPlayer()
- pUnit:CastSpellOnTarget( 69065, spike[id][sUnit] )
- end
- function func.spike.death (pUnit, Event)
- local sUnit = tostring(pUnit)
- local id = pUnit:GetInstanceID()
- spike[id][sUnit]:RemoveAura(69065)
- spike[id][sUnit] = nil
- end
- function func.spike.kill (pUnit, Event)
- local sUnit = tostring(pUnit)
- local id = pUnit:GetInstanceID()
- pUnit:RemoveFromWorld()
- spike[id][sUnit] = nil
- end
- --[[
- *******************************************************************
- ** **
- ** DUMMY SPELLS **
- ** **
- *******************************************************************
- ]]
- function spell.dummy.bonespike (effectIndex, spell)
- local sUnit = spell:GetCaster()
- local id = sUnit:GetInstanceID()
- -- For 10 Man
- if (lordm[id].dif == 1 or 3) then
- local plr = spell:GetRandomPlayer(7)
- local x,y,z,o = plr:GetLocation()
- sUnit:SpawnCreature(38711,x,y,z,o,14,0)
- end
- -- For 25 Man
- if (lordm[id].dif == 2 or 4) then
- local tar = 0
- local tmp = nil
- -- This section is here to ensure he targets 3 separate people
- for tar=1, 3 do
- tmp = spell:GetRandomPlayer(7)
- vars[id].bsplr = nil
- if tar == 1 then
- vars[id].bsplr[tar] = tmp
- end
- if tar == 2 then
- while (vars[id].bsplr[1] == tmp) do
- tmp = spell:GetRandomPlayer(7)
- end
- vars[id].bsplr[tar] = tmp
- end
- if tar == 3 then
- while (vars[id].bsplr[1] == tmp) or (vars[id].bsplr[2] == tmp) do
- tmp = spell:GetRandomPlayer(7)
- end
- vars[id].bsplr[tar] = tmp
- end
- end
- for v=1,3 do
- local x,y,z,o = vars[id].bsplr[v]:GetLocation()
- sUnit:SpawnCreature(38711,x,y,z,o,14,0)
- end
- end
- end
- --[[
- *******************************************************************
- ** **
- ** MISC & REGISTERS **
- ** **
- *******************************************************************
- ]]
- function func.hook.logout(event, pPlayer)
- if pPlayer:HasAura(69065) then pPlayer:RemoveAura(69065) end -- in case someone DCs during fight, they won't comeback with the aura
- end
- RegisterServerHook(13, "func.hook.logout")
- RegisterDummySpell(69057, "spell.dummy.bonespike")
- RegisterUnitEvent(6, 18, "func.kobold.onspawn")
- RegisterUnitEvent(36672, 18, "func.flame.onspawn")
- RegisterUnitEvent(36612, 18, "func.lordm.onspawn")
- RegisterUnitEvent(36612, 1, "func.lordm.oncombat")
- RegisterUnitEvent(36612, 2, "func.lordm.onleave")
- RegisterUnitEvent(36612, 3, "func.lordm.onkill")
- RegisterUnitEvent(36612, 4, "func.lordm.ondeath")
- RegisterUnitEvent(38711, 18, "func.spike.onspawn")
- RegisterUnitEvent(38711, 3, "func.spike.onkill")
- RegisterUnitEvent(38711, 4, "func.spike.ondeath")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement